NEW frontpage.html - request comments

Moderator: leecollings

madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by madrian »

Anybody to this?

I tried

Code: Select all

var d = (32/100)*level;
, but it does not work. The plus button decreases the value, not increases. :roll:
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 »

@hpapagaj, that is strange. Can you post the complete function and the code with the dimmer part.
Not using Domoticz anymore
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by madrian »

@G3rard I am using the stock frontpage.js.

In settings I have a standard level controller:

Code: Select all

['25',	'Level',		'cell2',	'Konyha LED','1','1'],
The relevant part from frontpage.js:

Code: Select all

//Dimmer, only works with 1-16 dimmer for now
function ChangeStatus(OpenDicht,level,idx,currentlevel)
	{
	//When switched off return to previous level, no matter if plus or min pressed
	if (level == txt_off) {
		if (currentlevel == 1) {
			currentlevel++;
		}
		//console.log("In uit",currentlevel);
		$.ajax({
		url: $.domoticzurl+"/json.htm?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set Level&level=" + currentlevel,
		async: false,
		dataType: 'json',
		success: function(){
		console.log('SUCCES');
		},
		error: function(){
		console.log('ERROR');
		}
		});
	}
	else {
		level = level * 1;
		console.log(OpenDicht,level);
		if (OpenDicht == "plus")
			{
			var d = level * 3.125;
			
			console.log("in plus",d,level);
			if(d > 32) {
				d = 32;
			}
			$.ajax({
			url: $.domoticzurl+"/json.htm?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set Level&level=" + d,
			async: false,
			dataType: 'json',
			success: function(){
			console.log('SUCCES');
			},
			error: function(){
			console.log('ERROR');
			}
			});
		}
		else {
			var d = Math.round((level / 100.0) * 32);
			console.log("in min",d,level);
			if( d < 0 ){
				d = 0;
			}
			$.ajax({
			url: $.domoticzurl+"/json.htm?type=command&param=switchlight&idx=" + idx + "&switchcmd=Set Level&level=" + d,
			async: false,
			dataType: 'json',
			success: function(){
			console.log('SUCCES');
			},
			error: function(){
			console.log('ERROR');
			}
			});
		}
	}
	RefreshData();
	}
+I added to this function::

Code: Select all

//Dimmer
	if(vtype == 'Level' && item.SwitchType == 'Dimmer') {
this code:

Code: Select all

} else if (item.MaxDimLevel == 32) {
						//vdata2 = vdimmervalue; //used for ChangeStatus
						//vdimmervalue = Math.round(vdimmervalue / 5)*5; //round to ten
						
						vdata = vdimmervalue; //show current dim value
						var hlp = '<span onclick="SwitchToggle('+item.idx+',\'Off\');lightbox_open(\'switch\', '+switch_off_timeout+', '+txt_switch_off+')"; style='+alarmcss+'>'+ vdata+'</span>';
						var plus = "<img src=icons/up.png align=right vspace=12 onclick=ChangeStatus('plus'," + vdata + "," + item.idx + ","+ vdimmercurrent+")>"; //align=right replaced by hspace and vspace
						var min = "<img src=icons/down.png align=left vspace=12 onclick=ChangeStatus('min'," + vdata + "," + item.idx + ","+ vdimmercurrent+")>" //align=left
					}	

In my opinion the bug is in the vdata = vdimmervalue; --> maybe here I am missing a formula or in the var d = level * 3.125;.
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by BarryT »

denisj wrote:
albertvandam wrote:Dear all,

With all the examples and code in this forum, I have managed to create a pretty good frontpage which runs on a wall mounted tablet.

Image
Albert,
can you please upload your frontpage packet some wear in order to download it and take some sample please ?

Thanks in advance
Denis
+1
It isnt that simple as adding a couple tables?

Please explain how did you do this, looks nice!
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
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 »

@hpapagaj,

Can you try this

Code: Select all

var d = ((level + 10)/100 * 32) +  0.5;
in stead of

Code: Select all

var d = level * 3.125;
What is the console showing then when you press plus, related to this part of your code?

Code: Select all

console.log("in plus",d,level);
Level = the old level
d = the new level
Not using Domoticz anymore
ubfssF
Posts: 59
Joined: Monday 02 November 2015 14:12
Target OS: Linux
Domoticz version: 2.2364
Location: Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by ubfssF »

I am using the frontpage-version by Swordfish, which is based on the frontpage of this thread, just some tweaks to cell colors etc. What I cannot achieve is displaying travel times in the frontpage. When I browse the Domoticz database I can see the custom sensor (ID=181) and its value (sValue=12), but I cannot use the sValue. It just displays the Id-number. I can retrieve a few of the other fields of this custom sensor, like CustomImage.
Is there any way to retrieve and display in the Frontpage?
Inserting "Minuten"doesn't work as well:

Code: Select all

        ['181','Minuten',               'cell8',        'Alblasserdam-Gorinchem','1','0'],
See left under, nr 181
See left under, nr 181
Spectacle.kn3558.png (44.54 KiB) Viewed 5749 times
Spectacle.db.png
Spectacle.db.png (121.32 KiB) Viewed 5749 times
ubfssF
Posts: 59
Joined: Monday 02 November 2015 14:12
Target OS: Linux
Domoticz version: 2.2364
Location: Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by ubfssF »

To answer my own question... :D

I had to look up the available datafields, for example in: http://127.0.0.1:8080/json.htm?type=devices&plan=0
There it was clear that I needed the contents of "Data":

So the right line is:

Code: Select all

['181','Data',          'cell8',        'Alblasserdam-Gorinchem','1','0'],
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by madrian »

G3rard wrote:@hpapagaj,

Can you try this

Code: Select all

var d = ((level + 10)/100 * 32) +  0.5;
Super it's working now. :P Thank you!

Little glitch that one step is 6% instead of 3% (like in Domoticz):

50 to 56:

plus 50
in plus 19.7 50
SUCCES

56 to 62:

plus 56
in plus 21.62 56
SUCCES
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: NEW frontpage.html - request comments

Post by EdwinK »

Can this be installed on a Synology NAS? Can't find any map in which Domoticz could be living.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
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 »

To install the frontpage on a Synology, enable Web station and put the frontpage in the web folder.
Not using Domoticz anymore
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: NEW frontpage.html - request comments

Post by EdwinK »

G3rard wrote:To install the frontpage on a Synology, enable Web station and put the frontpage in the web folder.

Just that easy? Thanks :)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: NEW frontpage.html - request comments

Post by Trigun »

G3rard wrote:There is no other documentation, but let my try to help you.

You have to use the IP of your Sonos in the config.php, not the IP of the Pi.
Part of the config.php where 115 is the IDX in Domoticz.

Code: Select all

'zones' => array(
      '115'   => '192.168.1.161', /* kitchen*/
	),
The url you have to use in this example is:

Code: Select all

http://yourserver/tablet/sonos/index.php?zone=115&action=Play
And you have to run the PHP on a PHP enabled web server. So if that's not installed on your Pi, you have to install PHP on it.
Hi G3rard,
I was looking at this post and this is exactly what I would like to use.
I am able to control the sonos via HTTP but I can't get it to work with the PHP option in G3rards files.

perhaps you can help me out here?
maybe a noob question but how do I install the PHP server on the Domoticz Pi?

Thanks in advance!

Kind regards,
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: NEW frontpage.html - request comments

Post by EdwinK »

After reading through the 60 pages in this topic, I still not sure what is going on.

When I open the frontpage on my Synology NAS, the page loads, but then keeps trying to connect to some site, but I can't find out what. Because it does this, I also can't see if my changes work.

Image
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: NEW frontpage.html - request comments

Post by Trigun »

EdKo66 wrote:After reading through the 60 pages in this topic, I still not sure what is going on.

When I open the frontpage on my Synology NAS, the page loads, but then keeps trying to connect to some site, but I can't find out what. Because it does this, I also can't see if my changes work.

Image
did you make any configutations yet?
for example: put in your ip adress and use the right floorplan in the frontpage_settings file?
ubfssF
Posts: 59
Joined: Monday 02 November 2015 14:12
Target OS: Linux
Domoticz version: 2.2364
Location: Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by ubfssF »

Floorplan 0 will do for starting. Later on, you can create one specially for the Frontpage.
IP address of the domoticz server has to be right.
If you have at least one sensor configured, you should see something.
Page loads slowly, but if configured right it should work.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: NEW frontpage.html - request comments

Post by EdwinK »

Yes. I did :) It's just that the frontpage is trying to connect to a site. I think it might either be to Buienradar or the webcam.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: NEW frontpage.html - request comments

Post by EdwinK »

ubfssF wrote: Page loads slowly, but if configured right it should work.
Have been waiting for over an hour. Still no luck.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
ubfssF
Posts: 59
Joined: Monday 02 November 2015 14:12
Target OS: Linux
Domoticz version: 2.2364
Location: Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by ubfssF »

I suspect Buienradar also for the slow loading, but an hour is way too much. I have a Ubuntu setup, so I don't know the pitfalls of a Synology setup, but I suspect that Frontpage isn't able to reach the Domoticz server. The IP address or port number are the first to think of, but maybe with a Synology setup there are other challenges? The long loading times are not due to the Buienradar or things like that, I would say, but the Domoticz server.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: NEW frontpage.html - request comments

Post by EdwinK »

Everything else on the Synology is working normally. I will go investigate it a bit more.


Found that somewhere something is calling to a local address (that I don't have). So now looking for where it exactly sits in the files.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
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 »

@EdJo66, you can check the Console tab in Chrome which you can open with F12.
Normally that would show the error including file and line which is causing that.
Not using Domoticz anymore
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest