NEW frontpage.html - request comments

Moderator: leecollings

ericjuh
Posts: 5
Joined: Tuesday 21 July 2015 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by ericjuh »

trekker25 wrote:
bizziebis wrote:
I have added a IsDark switch and adjusted the correct idx :
var idx_SunState = '113';
var idx_IsDonker = '113'; <!-- for day night css -->

but still only the night css is showing. What am i missing.
Can i easily what this variable
var IsNight = 'No';
during execution of the webpage in the console? Don't see any error logs in the console

EDIT even when i use this code:

Code: Select all

	// change CSS file, depending on sunset and sunrise using virtual switch named IsDonker and set the var IsNight 
	if(item.idx == idx_IsDonker && vdata == 'Off'){
		document.getElementById('dark-styles').disabled  = true;				// day
		IsNight = 'No';
	}
	if(item.idx == idx_IsDonker && vdata == 'On'){
		document.getElementById('dark-styles').disabled  = false;				// night
		IsNight = 'No';
	}
or i make isNight 'Yes" in both if statements, doesn't make any difference?
I also haveing problems with day and night. It seems the variable is cast in frontpage_settings.js and it should change on the state of the virual button. But it doesnt.

I have set my id (91) in frontpage_settings.js:

Code: Select all

var idx_IsDonker = '91'; <!-- for day night css -->
A bit later i see the variable beeing created:

Code: Select all

var IsNight = 'No';
In json i can clearly see the state of the button to "On" or "Off"

If i check frontpage.js i see the following code:

Code: Select all

	if(item.idx == idx_IsDonker && vdata == 'Off'){
		document.getElementById('dark-styles').disabled  = true;				// day
		IsNight = 'No';
	}
	if(item.idx == idx_IsDonker && vdata == 'On'){
		document.getElementById('dark-styles').disabled  = false;				// night
		IsNight = 'Yes';
	}
But still IsNight won't get a value "Yes".

I have made blocky's,but i disabled it to test it. When i turn my switch on or off, there is just nothing happening. When i put a different value in the creation of the variable, like:

Code: Select all

var IsNight = 'Somethingdifferent';
Both, night and day arent working. If i change it to yes:

Code: Select all

var IsNight = 'Yes';
Everything is in daymode.

I dont have a clue where to look anymore. Any idea's?
ericjuh
Posts: 5
Joined: Tuesday 21 July 2015 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by ericjuh »

vil1driver wrote:dummy switch is useless...

frontpage, know sunset and sunrise time, and actual time... and can calculate if it's the night..

already said here
http://www.domoticz.com/forum/viewtopic ... 614#p51614

my work here
https://github.com/vil1driver/monitor
Seems like its still wrong in the gerard33 release i downloaded yesterday. Because the status is still calculated by the switch, but i see code getting the sunrise and sunset values.

I just can't get it to work.
User avatar
bierlaagh
Posts: 42
Joined: Friday 14 March 2014 16:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9984
Contact:

Re: NEW frontpage.html - request comments

Post by bierlaagh »

ericjuh wrote:
vil1driver wrote:dummy switch is useless...

frontpage, know sunset and sunrise time, and actual time... and can calculate if it's the night..

already said here
http://www.domoticz.com/forum/viewtopic ... 614#p51614

my work here
https://github.com/vil1driver/monitor
Seems like its still wrong in the gerard33 release i downloaded yesterday. Because the status is still calculated by the switch, but i see code getting the sunrise and sunset values.

I just can't get it to work.
I also use the release of G3rard
and I have a dark CSS when the sun has set and a day CSS when we have sunrise

As far as I know you have to create a virtual switch (is donker of is dark) The IDS of that switch should be in the FrontPage_Settings.js (somewhere near line 51)

you also need to make a blocky as discribed here: http://www.domoticz.com/forum/viewtopic ... 120#p36615

I just tested it and disabled the blocky, so i could manualy switch the is donker and when isdonker is on i have the night css if it is off you have the Day CSS.
1x Raspberry PI 3 With Domoticz V.3.7318
1X RFXtrx433 USB 433.92MHz
1X Synology DS213j Nas
Toon by Eneco including Toon Zon
several KAKU switches and dimmers
Mysensors WIFI Gateway including meters, switches en humidity sensors
Wifi Dimmers (home made)
ericjuh
Posts: 5
Joined: Tuesday 21 July 2015 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by ericjuh »

bierlaagh wrote:
ericjuh wrote:
vil1driver wrote:dummy switch is useless...

frontpage, know sunset and sunrise time, and actual time... and can calculate if it's the night..

already said here
http://www.domoticz.com/forum/viewtopic ... 614#p51614

my work here
https://github.com/vil1driver/monitor
Seems like its still wrong in the gerard33 release i downloaded yesterday. Because the status is still calculated by the switch, but i see code getting the sunrise and sunset values.

I just can't get it to work.
I also use the release of G3rard
and I have a dark CSS when the sun has set and a day CSS when we have sunrise

As far as I know you have to create a virtual switch (is donker of is dark) The IDS of that switch should be in the FrontPage_Settings.js (somewhere near line 51)

you also need to make a blocky as discribed here: http://www.domoticz.com/forum/viewtopic ... 120#p36615

I just tested it and disabled the blocky, so i could manualy switch the is donker and when isdonker is on i have the night css if it is off you have the Day CSS.
Thanks for your reply. I got it working. It seems there is some code missing.

What i did:

I added this in frontpage_settings.js. NOTE!! day.jpg and night.jpg are files i made and not default. See attachment. I put the files in \css\images

Code: Select all

var bg_day = 'day.jpg';			// Create variable with backgroundimage day
var bg_night = 'night.jpg';			// Create variable with backgroundimage day
var bg_size = 'cover';					// Create variable with value to fill background
I disabled the stringreplace at line 49 and 55 in frontpage.js. Not sure why G3rard added this part and why he didt a substring and removed the last 3 characters. Because the sunrise and sunset is a time, like:
"Sunrise" : "06:55",
"Sunset" : "20:11",

If you remove the last 3 characters you only get the hours. But maybe it was the idea to not look at the minutes.

Code: Select all

	function(data) {
	if (typeof data != 'undefined') {
		$.each(data, function(i,item){
			if ( i == 'Sunrise' ) {
				//console.log("Sunrise: ", item);
				var_sunrise = item;
				//remove seconds from time
				//var_sunrise = var_sunrise.substring(0, var_sunrise.length - 3);
			}
			else if ( i == 'Sunset' ) {
				//console.log("Sunset: ", item);
				var_sunset = item;
				//remove seconds from time
				//var_sunset = var_sunset.substring(0, var_sunset.length - 3);
			}
		});
I then replaced this code (start at line 151 and this code is looking for a virtual switch)

Code: Select all

	// change CSS file, depending on sunset and sunrise using virtual switch named IsDonker and set the var IsNight 
	if(item.idx == idx_IsDonker && vdata == 'Off'){
		document.getElementById('dark-styles').disabled  = true;				// day
		IsNight = 'No';
	}
	if(item.idx == idx_IsDonker && vdata == 'On'){
		document.getElementById('dark-styles').disabled  = false;				// night
		IsNight = 'Yes';
	}
with (tnx @vil1driver):

Code: Select all

 var today=new Date();
                                    
var h1 = today.getHours();
var m1 = today.getMinutes();
                                       
var h2 = var_sunrise.substring(0, 2);
var m2 = var_sunrise.substring(3, 5);
                                    
var h3 = var_sunset.substring(0, 2);
var m3 = var_sunset.substring(3, 5);
                                    
                                    
 h2 = parseInt(h2, 10);
 m2 = parseInt(m2, 10);
 h3 = parseInt(h3, 10);
  m3 = parseInt(m3, 10);
                                    
var t1 = (60 * h1) + m1;   // time
var t2 = (60 * h2) + m2;   // sunrise
var t3 = (60 * h3) + m3;   // sunset
                                    
                                    
  if ( t1 < t3 && t1 > t2) {
   // dag
   IsNight = 'No';
   document.body.style.background='black url(css/images/'+bg_day+') no-repeat top center fixed';
   document.body.style.backgroundSize=bg_size;
   } else {
   // nacht
   IsNight = 'Yes';
   document.body.style.background='black url(css/images/'+bg_night+') no-repeat top center fixed';
   document.body.style.backgroundSize=bg_size;
} 

I have now only 1 problem.

When i keep the site active i have no problems and it keeps refreshing. But when i close it for a few minutes and i open it again i keep getting a error on this part of the code.

Code: Select all

	//Check wether we want to add the last seen to the block
	if (lastseen == '1') {
	    if (thisday == vdate) {
			$('#ls_'+vlabel).html(convStringTime) 						// Show only the time if last change date = today
		} 				
	    else {
			$('#ls_'+vlabel).html(convStringTime+' | '+convStringDate)	// Change this 'Last Seen' into something you like
	    }
	}
	
	if (lastseen == '2') {
	    $('#ls_'+vlabel).html(convStringTime)							// Show only the time
	}
It keeps saying that vdate isnt correct in this line:

Code: Select all

 if (thisday == vdate) {
Attachments
night.jpg
night.jpg (49.43 KiB) Viewed 4083 times
day.jpg
day.jpg (216.32 KiB) Viewed 4083 times
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 »

ericjuh wrote: I disabled the stringreplace at line 49 and 55 in frontpage.js. Not sure why G3rard added this part and why he didt a substring and removed the last 3 characters. Because the sunrise and sunset is a time, like:
"Sunrise" : "06:55",
"Sunset" : "20:11",

If you remove the last 3 characters you only get the hours. But maybe it was the idea to not look at the minutes.

Code: Select all

	function(data) {
	if (typeof data != 'undefined') {
		$.each(data, function(i,item){
			if ( i == 'Sunrise' ) {
				//console.log("Sunrise: ", item);
				var_sunrise = item;
				//remove seconds from time
				//var_sunrise = var_sunrise.substring(0, var_sunrise.length - 3);
			}
			else if ( i == 'Sunset' ) {
				//console.log("Sunset: ", item);
				var_sunset = item;
				//remove seconds from time
				//var_sunset = var_sunset.substring(0, var_sunset.length - 3);
			}
		});
In a previous version of Domoticz also the seconds were shown for the time of sunrise and sunset, so that's way I removed the last 3 characters (which were always :00). In the new version of Domoticz the seconds are already removed so you can indeed remove these lines.
But that part has nothing to do with the day /night theme.
Did you change anything regarding the css files? Because the themes work fine here.

But if the solution of vil1driver works then that's already settled.

The problem you now have with thisday/vdate will probably be caused be the code you have added.
Not using Domoticz anymore
ericjuh
Posts: 5
Joined: Tuesday 21 July 2015 20:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by ericjuh »

G3rard wrote:
ericjuh wrote: I disabled the stringreplace at line 49 and 55 in frontpage.js. Not sure why G3rard added this part and why he didt a substring and removed the last 3 characters. Because the sunrise and sunset is a time, like:
"Sunrise" : "06:55",
"Sunset" : "20:11",

If you remove the last 3 characters you only get the hours. But maybe it was the idea to not look at the minutes.

Code: Select all

	function(data) {
	if (typeof data != 'undefined') {
		$.each(data, function(i,item){
			if ( i == 'Sunrise' ) {
				//console.log("Sunrise: ", item);
				var_sunrise = item;
				//remove seconds from time
				//var_sunrise = var_sunrise.substring(0, var_sunrise.length - 3);
			}
			else if ( i == 'Sunset' ) {
				//console.log("Sunset: ", item);
				var_sunset = item;
				//remove seconds from time
				//var_sunset = var_sunset.substring(0, var_sunset.length - 3);
			}
		});
In a previous version of Domoticz also the seconds were shown for the time of sunrise and sunset, so that's way I removed the last 3 characters (which were always :00). In the new version of Domoticz the seconds are already removed so you can indeed remove these lines.
But that part has nothing to do with the day /night theme.
Did you change anything regarding the css files? Because the themes work fine here.

But if the solution of vil1driver works then that's already settled.

The problem you now have with thisday/vdate will probably be caused be the code you have added.
Tnx for your reply. I did add something in de css files, namely the first 2 cell's where split. But now they are one. But before that the virtuel switch wasnt working either.

I now get this error.. Maybe its because i add some code. But not sure why it is going wrong. All code i added is listed above.

http://i.imgur.com/F3DJ8Cy.png

[edit]

Image was to big, so i replaced it with only a hyperlink.
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

NEW frontpage.html - request comments

Post by G3rard »

Changing the content of the css is no problem. I was wondering if you changed the filenames or something like that, but that seems not to be the case.

I am not sure what causes the vdate issue, but it must be caused by the code you have changed. Maybe you can try to change the lastseen code by commenting some lines out or debug by printing the vdate to the console.log.
I added that option which only shows the date in the cell when the lastseen date is not the current date. So if that's not important to you, it can be changed.
Not using Domoticz anymore
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 »

That's a better solution which indeed will always work.
Not using Domoticz anymore
jossie67
Posts: 39
Joined: Wednesday 31 December 2014 12:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by jossie67 »

Has some one managed to start a playlist on Kodi, with a button on frontpage?
Raspberry Pi (3x)
Master Domoticz installed on a Synology
RFXCOM RFXtrx433E USB
RFLink
USB Z-Wave Mini Adapter
Mi-light
QuinLED
Landis+Gyr ZME120ACd
Kamstrup_M401
USB-IR-Schreib-Lesekopf Alecto WS1700
Watermeter with TCRT5000
Kodi
DS18B20
User avatar
bierlaagh
Posts: 42
Joined: Friday 14 March 2014 16:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9984
Contact:

Re: NEW frontpage.html - request comments

Post by bierlaagh »

jossie67 wrote:Has some one managed to start a playlist on Kodi, with a button on frontpage?
that should not be such a problem.

create a virtual switch in domoticz (remember the IDX)

than you make 2 scripts
1. start playing playlist or something like that ,( i use play readio538, a duch radio station)
2. stop playlist
both with the extension .sh

here are my examples:

Start_radio538.sh

Code: Select all

#!/bin/bash

curl -i -X POST -H "Content-Type: application/json" -d '{"method":"Player.Open","id":44,"jsonrpc":"2.0","params":{"item":{"file":"http://vip-icecast.538.lw.triple-it.nl/RADIO538_MP3.m3u"}}}' http://KODI-IP:KODI-PORT/jsonrpc
and stop_player.sh

Code: Select all

#!/bin/bash
curl -i -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "Player.Stop", "params": { "playerid": 0 }, "id": 44}' http://KODI-IP:KODI-PORT/jsonrpc
more info about the jsonrpc of codi can be found here: http://kodi.wiki/view/JSON-RPC_API/v6
and some examples here http://kodi.wiki/view/JSON-RPC_API/Examples

both scripts have to be executable : chmod +x thenameofthescript.sh
and attatched to the button : script://path/scriptname.sh for both the start and the stop ofcourse

hope that helps

to add this
1x Raspberry PI 3 With Domoticz V.3.7318
1X RFXtrx433 USB 433.92MHz
1X Synology DS213j Nas
Toon by Eneco including Toon Zon
several KAKU switches and dimmers
Mysensors WIFI Gateway including meters, switches en humidity sensors
Wifi Dimmers (home made)
jossie67
Posts: 39
Joined: Wednesday 31 December 2014 12:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by jossie67 »

bierlaagh wrote:
jossie67 wrote:Has some one managed to start a playlist on Kodi, with a button on frontpage?
that should not be such a problem.


hope that helps

to add this
Thanks, it working
Raspberry Pi (3x)
Master Domoticz installed on a Synology
RFXCOM RFXtrx433E USB
RFLink
USB Z-Wave Mini Adapter
Mi-light
QuinLED
Landis+Gyr ZME120ACd
Kamstrup_M401
USB-IR-Schreib-Lesekopf Alecto WS1700
Watermeter with TCRT5000
Kodi
DS18B20
User avatar
galadril
Posts: 828
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: NEW frontpage.html - request comments

Post by galadril »

I've been playing with your frontpage code and here are some results:
what do you think?

Image
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
Heisenberg
Posts: 135
Joined: Monday 27 January 2014 14:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by Heisenberg »

Nice galadril!
is your template ready for production? Could you share the files?
Raspberry Pi Type B
Raspberry Pi Type B2
RFXCOMtrx433e
User avatar
galadril
Posts: 828
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: NEW frontpage.html - request comments

Post by galadril »

Heisenberg wrote:is your template ready for production? Could you share the files?
It works for me now yes, but i need to change some code so that's it's easy to adjust for every one else.


@Hansbit > Should I make a new forum post then?
Or post it here?
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by ThinkPad »

Own topic is better, people can talk about it easier then. Otherwise people will confuse what post is about what frontpage :lol:

It is looking good, but a bit small amount of devices. I show about 20 devices on my frontpage (temp/switches/energy etc)
I am not active on this forum anymore.
SweetPants

Re: NEW frontpage.html - request comments

Post by SweetPants »

ThinkPad wrote:It is looking good, but a bit small amount of devices. I show about 20 devices on my frontpage (temp/switches/energy etc)
How about putting your rooms on the place where you have the switches now?
User avatar
galadril
Posts: 828
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: NEW frontpage.html - request comments

Post by galadril »

ThinkPad wrote:Own topic is better, people can talk about it easier then. Otherwise people will confuse what post is about what frontpage :lol:
Done >>
http://www.domoticz.com/forum/viewtopic.php?f=8&t=8017
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
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 »

vil1driver wrote:hi,

i have add on my frontpage an iframe to see an other site on it
but swipe doesn't work on iframe,
anyone know how enable swipe on iframe ?
I made the frame a bit smaller than the page, so you can still swipe on the sides of the page.
Not using Domoticz anymore
Sevift
Posts: 31
Joined: Monday 21 September 2015 16:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Contact:

Re: NEW frontpage.html - request comments

Post by Sevift »

vil1driver wrote:
my work here
https://github.com/vil1driver/monitor

Code: Select all

// if alarm threshold is defined, make value red
                                                if (typeof valarm != 'undefined' && vtype != 'SetPoint') {
                                                    alarmcss='';
													if ( Number(vdata) >= valarm ) {  
                                                        alarmcss=';color:red;';
['idx','value', 'cellule', 'description','1=lastseen 2=icon 3=both','pas de thermostat','override css','Alarme ou valeur max de thermostat']
can not set any color - Visibility Barometer Temp Gust, yet?

add

I'm a fool
'Alarme ou valeur max de thermostat'
logical default do not use Alarme

Visibility - Alarm < 0.5?
-25 > Temp > 33?
Barometer ?
И т.д.
grelle
Posts: 7
Joined: Thursday 28 November 2013 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sweden / Östersund
Contact:

Re: NEW frontpage.html - request comments

Post by grelle »

G3rard, is there any other documentation about getting the Sonos PHP wrapper to work on domoticz.

I have set up the sonos folder as follows

/domoticz/www/tablet/sonos/

changed config.php to "my-idx" of domoticz dummy switch and my ip of raspberry pi, with and without ports, tested also my ip of the sonos amp controller without ports...

In Domoticx I have added these lines "http://my-local-ip:8080/tablet/sonos/in ... ction=Play"

Nothing happens - when I use the link in a broser "http://yourserver/tablet/sonos/index.ph ... ction=Play" I only get the output of index.php as text...is there a PHP parsing problem you think ?
Sweden / Östersund
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest