NEW frontpage.html - request comments

Moderator: leecollings

User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by G3rard »

FutureCow wrote:I'm trying to move the FrontPage to my own webserver (on the same server as Domoticz)
I have copied al the folders from domoticz/www/ to /var/www/

When i'm opening the FrontPage, everything look gooed, but the switches aren't working! When i'm pusing a switch, i hear the sounds and also see the "inschakelen" on the webpage. But the switch stays "UIT".

Is this a problem with owner/chmod?
I already tried a couple of things, but nothing is working.
Check your frontpage.js file and look for the functions. The URL part has to start with $.domoticzurl+"/. See the example below for function SwitchToggle.

Code: Select all

url: $.domoticzurl+"/json.htm?type=command&param=switchlight" + "&idx=" + idx + "&switchcmd=" + switchcmd,
Add the $.domoticzurl+"/ for all functions and it should work.
Not using Domoticz anymore
FutureCow
Posts: 8
Joined: Monday 30 December 2013 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by FutureCow »

G3rard wrote:
FutureCow wrote:I'm trying to move the FrontPage to my own webserver (on the same server as Domoticz)
I have copied al the folders from domoticz/www/ to /var/www/

When i'm opening the FrontPage, everything look gooed, but the switches aren't working! When i'm pusing a switch, i hear the sounds and also see the "inschakelen" on the webpage. But the switch stays "UIT".

Is this a problem with owner/chmod?
I already tried a couple of things, but nothing is working.
Check your frontpage.js file and look for the functions. The URL part has to start with $.domoticzurl+"/. See the example below for function SwitchToggle.

Code: Select all

url: $.domoticzurl+"/json.htm?type=command&param=switchlight" + "&idx=" + idx + "&switchcmd=" + switchcmd,
Add the $.domoticzurl+"/ for all functions and it should work.
Thanks, that worked!
Last question (for now):
Is it possible to use another FrontPage.js for the day and night? (FrontpageDay.js and FrontPageNight.js) i'm using different weather icons for my day and night screen. And the link to the icons are inside the FrontPage.js

Or is it possible to change the page at a certain time:
go to FrontPage.html:
if time is before sunset --> FrontPageDay.html
if time is after sunset --> FrontPageNight.html
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by G3rard »

FutureCow wrote:
Thanks, that worked!
Last question (for now):
Is it possible to use another FrontPage.js for the day and night? (FrontpageDay.js and FrontPageNight.js) i'm using different weather icons for my day and night screen. And the link to the icons are inside the FrontPage.js

Or is it possible to change the page at a certain time:
go to FrontPage.html:
if time is before sunset --> FrontPageDay.html
if time is after sunset --> FrontPageNight.html
My frontpage uses a Domoticz virtual switch to check whether it is day or night and changes the CSS to that. Also the code in frontpage.js used that to show different icons.
See https://github.com/gerard33/frontpage/b ... ontpage.js on line 444 and further.
Not using Domoticz anymore
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

Love this frontpage! Have been poking around and really love the easiness behind it! Great job to you all!

Two questions...
If I create a third page , would it bee to much for the Rasp PI2 & Domoticz to handle. I've already added an extra row to both of the pages, but I feel I need a 3 page.
And I dont seem to make a switch with custom icons "switchable" ...

I've added this to frontpage_settings.js:

Code: Select all

var idx_Motor = '62'; 
['62','Status',				'cell2_8',	'Motorvärmare','1','0'],
And this in frontpage.js:

Code: Select all

case idx_Motor:
if (vdata == txt_on) {
vdata = '<img src=icons/engine_on.png onclick="bleep.play();SwitchToggle('+item.idx+', \'On\');">';
} else {
vdata = '<img src=icons/engine_off.png onclick="bleep.play();SwitchToggle('+item.idx+', \'Off\');">';									
 }
break;	
Attachments
IMG_1293.PNG
IMG_1293.PNG (177.15 KiB) Viewed 2323 times
IMG_1294.PNG
IMG_1294.PNG (160.96 KiB) Viewed 2323 times
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: NEW frontpage.html - request comments

Post by jannl »

I also need a third page, sensors and more (virtual) switches keep being added.

The work/cpu time for building the page is done on the tablet (mostly javascript). I use 2 json calls to get the data from Domoticz, the rest is done on the tablet by the browser. Because I read floorplan 0, I already have every switch etc present.
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

Good to hear that!

Any help regarding the switch?
Seems that if it locked it uses my icons but when it's unlocked its standard icon. Must be something I'm missing.


Sent from space using an app.
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: NEW frontpage.html - request comments

Post by jannl »

Here the toggle function is not in the vdata. Vdata contains the text or icon to show.
Please check the frontpage.js.
Looks like this here:

Code: Select all

if (typeof vattr == 'undefined') {
            if (item.Protected == true) {
                            $('#'+vlabel).html('<div onClick="lightbox_open(\'protected\', '+switch_protected_timeout+', '+txt_switch_protected+');" style='+alarmcss+'>'+vdata+'</div>');
            } else {
                            $('#'+vlabel).html('<div '+switchclick+' style='+alarmcss+'>'+vdata+'</div>');
            }
}
else if (item.Protected == true) {
            $('#'+vlabel).html( '<div onClick="lightbox_open(\'protected\', '+switch_protected_timeout+ ', '+txt_switch_protected+');" style='+vattr+alarmcss+'>'+vdata+'</div>');
} else {
            $('#'+vlabel).html( '<div '+switchclick+' style='+vattr+alarmcss+'>'+vdata+'</div>');
}

User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

Dont quite follow you....

I've a swich. I added custom icons for it. But when I set the switch as non protected it does not use the custom icons.
However, when the switch is protected the icons show up. But now I cant change the status because it protected... :(
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: NEW frontpage.html - request comments

Post by jannl »

Check the javascript. There is a difference between protected and not protected.
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

jannl wrote:Here the toggle function is not in the vdata. Vdata contains the text or icon to show.
Please check the frontpage.js.
Looks like this here:

Code: Select all

if (typeof vattr == 'undefined') {
            if (item.Protected == true) {
                            $('#'+vlabel).html('<div onClick="lightbox_open(\'protected\', '+switch_protected_timeout+', '+txt_switch_protected+');" style='+alarmcss+'>'+vdata+'</div>');
            } else {
                            $('#'+vlabel).html('<div '+switchclick+' style='+alarmcss+'>'+vdata+'</div>');
            }
}
else if (item.Protected == true) {
            $('#'+vlabel).html( '<div onClick="lightbox_open(\'protected\', '+switch_protected_timeout+ ', '+txt_switch_protected+');" style='+vattr+alarmcss+'>'+vdata+'</div>');
} else {
            $('#'+vlabel).html( '<div '+switchclick+' style='+vattr+alarmcss+'>'+vdata+'</div>');
}

Interesting... This code appears to be not implemented in mine... :(
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: NEW frontpage.html - request comments

Post by jannl »

the protected part obviously is, otherwise you could not get that message.
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

obviously =)

But, as a noob i cant figure out what to search for...
I simply want to change icon for a specific cell with a ON icon and OFF icon wich seems to work when the cell is protected. BUT i want the cell to act as a button. How in earth do I accomplish that =)
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: NEW frontpage.html - request comments

Post by jannl »

you can start with searching for protected in the js file.
The unprotected part is either in the else or a default setting, which makes it harder to find.

When you enable debugging in your browser, you can add console.log messages to see where the code is and what the contents of values are.

Before frontpage I did not know much of javascript either (but can read programming languages).

Luckily google is a big friend...
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

Thanks! I finally made it!
Added this code to frontpage_settings.js

Code: Select all

var idx_Motor = '62';
var txt_Motor_on = '<img src=icons/engine_On.gif>';
var txt_Motor_off = '<img src=icons/engine_Off.gif>';
And this code to frontpage.js

Code: Select all

//						MOTOR Image
						if (item.idx == idx_Motor && vdata == txt_off){
                        //	vdata=new String(vdata).replace( "Off", "Open");
                            vdata=txt_Motor_off;
                        //    alarmcss=color_off;
                        }
						if (item.idx == idx_Motor && vdata == txt_on){
                        //	vdata=new String(vdata).replace( "Off", "Open");
                            vdata=txt_Motor_on;
                        //    alarmcss=color_off;
                        }
So when the engine heater is on i get this flashing icon:
engine_On.gif
engine_On.gif (1.42 KiB) Viewed 2470 times
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
Triangle
Posts: 8
Joined: Wednesday 10 June 2015 20:42
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: NEW frontpage.html - request comments

Post by Triangle »

I'm trying to display the pressure trend. I have the trend in a text sensor from yahoo with a python script (arrow up, down, or same). I'd like to put this trend arrow in front of the pressure number in HPA. So I have to combine the two sensors (text sensor and Temp+Humidity+Baro sensor) in one cell. I can't get my head around how to do this. Is it possible and how would I achieve this? I'm a noob in programming, but I like to fiddle and learn :)

edit: after a good night of sleep, I think I just have to make an extra div and matching changes for the concerning cell, not?
Last edited by Triangle on Saturday 09 January 2016 12:32, edited 1 time in total.
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by G3rard »

Minglarn wrote:Love this frontpage! Have been poking around and really love the easiness behind it! Great job to you all!
I saw you implemented a min and max temperature on the frontpage. Can you share the code for that?
Not using Domoticz anymore
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

Of course... Here come my small contribution to your frontpage...

It's a bit rough but it works and should be easy to implement if you follow these steps...
I use BLOCKY, 2 dummy TEMP sensors and own made PHP scripts as I don't like lua...

Blocky handles the comparison and checks if actual min temp is lower than registered value... See below:
UTE is the outside sensor.
Skärmklipp2.PNG
Skärmklipp2.PNG (13.68 KiB) Viewed 2414 times
If actual value is below registered value it runs the php script. My script even notifies me via PROWL...
set_min.php code:

Code: Select all

<?PHP
//PROWL Class to include
include "class.prowl.php";

// Get UTE temp. IDX: 9
$json_string = file_get_contents("http://192.168.1.236:8080/json.htm?type=devices&rid=9");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$temp = $parsed_json['Temp'];
$today = date("Y-m-d")."Temp: ".$temp;

// Send PROWL -->
$prowl = new Prowl("XXXXX", "XXXXXX", "Temperatur uppdatering!!");
$result = $prowl->send("Ny MIN Temp!", $temp."°C");

// Set new MAX temp to virtual sensor no: 514 using $ute
$ute = "http://192.168.1.236:8080/json.htm?type=command&param=udevice&idx=514&nvalue=0&svalue=".$temp;
$json_string = file_get_contents($ute);
// -----------------------------------------------
?>
set_max.php code:

Code: Select all

<?PHP
//PROWL Class to include
include "class.prowl.php";


// Get UTE temp. IDX: 9
$json_string = file_get_contents("http://192.168.1.236:8080/json.htm?type=devices&rid=9");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$temp = $parsed_json['Temp'];
$today = date("Y-m-d")."Temp: ".$temp;

$ute = "http://192.168.1.236:8080/json.htm?type=command&param=udevice&idx=513&nvalue=0&svalue=".$temp;


// Send PROWL -->

$prowl = new Prowl("XXXXX", "XXXXXX", "Temperatur uppdatering!!");
$result = $prowl->send("Ny MAX Temp!", $temp."°C");

// Set new MAX temp to virtual sensor no: 513 using $ute
$json_string = file_get_contents($ute);
// -----------------------------------------------
?>
As seen in the PHP code I update the virtual TEMP sensors whit the actual TEMP and the result is this:
Attachments
Skärmklipp.PNG
Skärmklipp.PNG (27.66 KiB) Viewed 2414 times
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by G3rard »

Nice, I am going to use that solution :) .
Not using Domoticz anymore
User avatar
Minglarn
Posts: 214
Joined: Friday 21 August 2015 19:27
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Stockholm / Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by Minglarn »

Glad I could help...

But I need some assistance with 2 issues....

1.Trying to add a switch wich. In domotics it is a group containing switches for my outside and garden lights. Cant get it to work...

Code: Select all

	$.PageArray_Scenes = [
		['1','Status', 	'cell4_22',			'Utebelysning'],
Do I need to add something else?

2. Want to make the temperature color RED incase it gets to hot. Have added this to the cell i want to monitor

Code: Select all

		['14','Temp',				'cell7',	'Biorummet','1','0'],
Where do I add the alarm threshold?
Last edited by Minglarn on Saturday 09 January 2016 13:14, edited 1 time in total.
When you eliminate the impossible, whatever remains, however improbable, must be the truth.” -Spock in Star Trek VI
erske
Posts: 2
Joined: Saturday 09 January 2016 12:47
Target OS: Linux
Domoticz version:
Location: Ånge, Sweden
Contact:

Re: NEW frontpage.html - request comments

Post by erske »

Hallå Minglarn.
Nice to have a fellow Swede here. :)

Since it's -29 degrees outside, i was going to implement my engineheater today, and i saw your loving blinkin Icon for it. I wonder if you can share both the "off" and "on" Icons for that, it would make my day so much easier.

Tack på förhand. / Erik
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest