Page 27 of 66

Re: NEW frontpage.html - request comments

Posted: Sunday 22 March 2015 14:22
by ThinkPad
Ah ok. No unfortunately i cannot help you any further then :(

Re: NEW frontpage.html - request comments

Posted: Sunday 22 March 2015 15:03
by Iron Man
No problem, still thanks for the fast reply’s and your input ;)

Re: NEW frontpage.html - request comments

Posted: Monday 23 March 2015 9:15
by mvdl
What about translating your Python to Javascript and including that directly in the frontpage?

From you r example I gather that the Denon has a WebSockets interface and Javascript can easily support that. It may take some coding on your part, but the performance would be even better, cutting out the python interpreter altogether.

Re: NEW frontpage.html - request comments

Posted: Monday 23 March 2015 16:29
by Iron Man
I would be very glad if we could make that work!
But I don’t know how to rewrite the Python code to a JavaScript.
And I know asking for an example wouldn’t match the topic but still I hope you can actually give me an example of the code rewritten in JavaScript?

Code: Select all

#!/usr/bin/python

import socket

# set host and port
HOST = 'IP amplifier'
PORT = 23

# connect to Denon
s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

# Send Command - Denon - Power On
s.sendall("PWON\r")

# disconnect from Denon
s.close()

# Delay Timer 10 Sec
time.sleep(10)
return
Kind regards,
Iron Man

NEW frontpage.html - request comments

Posted: Monday 23 March 2015 19:29
by mvdl
Hi Iron Man,

I know we don't want to highjack this thread, but I want to give you a tip on how to proceed with this.
Unfortunately, I cannot test this since I don't have a Denon lying around... ;)

Try something like the following (save this to a .html file, open it and test the link):

Code: Select all

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
  function WebSocketTest()
  {
    var HOST = "echo.websocket.org";
    var PORT = 80;
    var connection = new WebSocket("ws://" + HOST + ":" + PORT);
    connection.onopen = function () {
      connection.send('PWON\r');
    };
    connection.onerror = function (error) {
      writeToScreen('Error Logged: ' + error);
    };
    connection.onmessage = function (e) {
      writeToScreen('Received From Server: ' + e.data);
    };
  }

  function writeToScreen(message) { 
    var pre = document.createElement("p"); 
    var log = document.getElementById("log");
    pre.innerHTML = message; 
    log.appendChild(pre); 
  }
</script>
</head>
<body>
<div id="sse">
   <a href="javascript:WebSocketTest()">Run WebSocket</a>
</div>
<div id="log" style="background-color:#ff0;">
<p>Server output:</p>
</div>
</body>
</html>
Let me know how it goes...

Re: NEW frontpage.html - request comments

Posted: Monday 23 March 2015 23:08
by G3rard
Here is the link were youy can download my frontpage.

http://www.filedropper.com/frontpagegz

The frontpage has a.o. the following changes compared to earlier versions posted in this topic.
- text with cell description changes according to the state (eg alarm on/off, sunrise/set)
- removed bounce effect (no vertical scrolling) on iPad
- use extra div's in the cells above (see also the post from zicht) to show 2 values in one cell
- various layout changes

Let me know if you have any questions regarding the configuration.
frontpage-day.jpg
frontpage-day.jpg (231.63 KiB) Viewed 5000 times
frontpage-night.jpg
frontpage-night.jpg (152.55 KiB) Viewed 5000 times

Re: NEW frontpage.html - request comments

Posted: Wednesday 25 March 2015 21:53
by dbfan
G3rard wrote:Here is the link were youy can download my frontpage.

http://www.filedropper.com/frontpagegz

The frontpage has a.o. the following changes compared to earlier versions posted in this topic.
- text with cell description changes according to the state (eg alarm on/off, sunrise/set)
- removed bounce effect (no vertical scrolling) on iPad
- use extra div's in the cells above (see also the post from zicht) to show 2 values in one cell
- various layout changes

Let me know if you have any questions regarding the configuration.
Hi G3rard, very nice frontpage-design.
I like to download it, but link is broken. Can you fix this please ? Or sent me via pm ? thanks ! DBfan

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 0:03
by G3rard
dbfan wrote:
G3rard wrote:Here is the link were youy can download my frontpage.

http://www.filedropper.com/frontpagegz

The frontpage has a.o. the following changes compared to earlier versions posted in this topic.
- text with cell description changes according to the state (eg alarm on/off, sunrise/set)
- removed bounce effect (no vertical scrolling) on iPad
- use extra div's in the cells above (see also the post from zicht) to show 2 values in one cell
- various layout changes

Let me know if you have any questions regarding the configuration.
Hi G3rard, very nice frontpage-design.
I like to download it, but link is broken. Can you fix this please ? Or sent me via pm ? thanks ! DBfan
I just tried to download the file via the link and it's still working.
Did you press the Download this file button on FileDropper and entered the Captcha?

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 16:58
by Jochie78
G3rard wrote:Here is the link were youy can download my frontpage.

http://www.filedropper.com/frontpagegz

The frontpage has a.o. the following changes compared to earlier versions posted in this topic.
- text with cell description changes according to the state (eg alarm on/off, sunrise/set)
- removed bounce effect (no vertical scrolling) on iPad
- use extra div's in the cells above (see also the post from zicht) to show 2 values in one cell
- various layout changes

Let me know if you have any questions regarding the configuration.
Hi G3rard / all,

I am a newbee to Domoticz.
I really like the customized frontpage that G3rard uploaded.

I installed it to a webserver (not on the Pi, but on my NAS) and it is accessible and i can see the status of my lights.
($.domoticzurl is filled in right in the frontpage_settings.js)

My problem is that I can not turn ON or OFF a light from the frontpage.
When I push on the status of a light that is turned OFF, I get a popup with 'inschakelen' (turn on) but the light is nog turning ON.
The same happens with a light that is turned ON, that I can't turn OFF.

Is there a setting that I forgot or have to do?

Can anyone point me in the right direction?

Thanks

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 18:04
by G3rard
Jochie78 wrote: Hi G3rard / all,

I am a newbee to Domoticz.
I really like the customized frontpage that G3rard uploaded.

I installed it to a webserver (not on the Pi, but on my NAS) and it is accessible and i can see the status of my lights.
($.domoticzurl is filled in right in the frontpage_settings.js)

My problem is that I can not turn ON or OFF a light from the frontpage.
When I push on the status of a light that is turned OFF, I get a popup with 'inschakelen' (turn on) but the light is nog turning ON.
The same happens with a light that is turned ON, that I can't turn OFF.

Is there a setting that I forgot or have to do?

Can anyone point me in the right direction?

Thanks
You have to place the files in the www folder on your Rasberry Pi otherwise the switches won't work.

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 18:38
by Jochie78
G3rard wrote: You have to place the files in the www folder on your Rasberry Pi otherwise the switches won't work.
Hi G3rard,

Thanks for your quick reply.
I put the files in the www folder of my raspberry, but still no difference.
The light shows the staus, but when I click on it, the light won't turn ON or OFF.

Any other advise?

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 19:36
by dbfan
thanks G3rard, downloaded the files :)

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 20:21
by Jochie78
Jochie78 wrote:
G3rard wrote: You have to place the files in the www folder on your Rasberry Pi otherwise the switches won't work.
Hi G3rard,

Thanks for your quick reply.
I put the files in the www folder of my raspberry, but still no difference.
The light shows the staus, but when I click on it, the light won't turn ON or OFF.

Any other advise?
Found it!

I put the files under a subfolder (called frontpage) and that was the problem!
Now that I put the files directly in the 'root' of the www folder it works!

Thanks

Re: NEW frontpage.html - request comments

Posted: Thursday 26 March 2015 23:04
by dbfan
Hi G3rard,
I have it running. Very nice frontpage :)
One question: how do I get the alarm-icon ( house-icon ) running ?
I can enable the alarm via the security-panel. I made a blocky where I set a virtual switch to ON when one of my kaku doorcontacts opens.
But, I when I use the IDX of that virtual switch in cell23, it just shows OPEN or CLOSED. Not your icon...
What do I do wrong ?

thnx, DBfan

Re: NEW frontpage.html - request comments

Posted: Friday 27 March 2015 0:27
by G3rard
dbfan wrote:Hi G3rard,
I have it running. Very nice frontpage :)
One question: how do I get the alarm-icon ( house-icon ) running ?
I can enable the alarm via the security-panel. I made a blocky where I set a virtual switch to ON when one of my kaku doorcontacts opens.
But, I when I use the IDX of that virtual switch in cell23, it just shows OPEN or CLOSED. Not your icon...
What do I do wrong ?

thnx, DBfan
There are 2 options for the alarm.
1.You can use the security panel from Domoticz, then you have 3 values (Normal, Armed Home, Armed Away).
When you want to use this option, you have to set the floorplan to 0 in the settings file (because the security panel of Domoticz can not be added to a floorplan).
You also have to set the right idx for idx_Alarm (in this case the idx of the security panel) and the right text for desc_alarm_away, desc_alarm_home and desc_alarm_off in the frontpage_settings.js file.

In the frontpage.js file this option uses the following code (starts at line 249)

Code: Select all

// set alarm icons
	if(item.idx == idx_Alarm && vdata == 'Arm Away'){
	vdata=new String(vdata).replace( "Arm Away","<a class=iframe href=secpanel/index.html><img src=icons/alarm_away.png vspace=6></a>");
        vdesc=desc_alarm_away;
        }
	if(item.idx == idx_Alarm && vdata == 'Arm Home'){
	vdata=new String(vdata).replace( "Arm Home","<a class=iframe href=secpanel/index.html><img src=icons/alarm_home.png vspace=6></a>");
	vdesc=desc_alarm_home;
        }
	if(item.idx == idx_Alarm && vdata == 'Normal'){
	vdata=new String(vdata).replace( "Normal","<a class=iframe href=secpanel/index.html><img src=icons/alarm_off.png vspace=6></a>");		// day
        vdesc=desc_alarm_off;
        }
This code is active in my version of the frontpage.

2. You can use a virtual switch. Make sure that's an On/Off switch and that you use the right blockly, see my explanation below.
You have to set the right idx for idx_Alarm (in this case the virtual switch) and the right text for desc_alarm_on and desc_alarm_off in the frontpage_settings.js file.

If you want to use this option, then you have to enable to following code in frontpage.js (starts at line 263) by removing the //. This means you have to disable the other alarm code which starts at line 249.

Code: Select all

	
	//if(item.idx == idx_Alarm && vdata == 'Off'){
	//vdata=new String(vdata).replace( "Off","<a class=iframe href=secpanel/index.html><img src=icons/alarm_off.png vspace=6></a>");
	//vdesc=desc_alarm_off; // Replace text from bottom with text from settings file
	//}
	//if(item.idx == idx_Alarm && vdata == 'On'){
	//vdata=new String(vdata).replace( "On","<a class=iframe href=secpanel/index.html><img src=icons/alarm_on.png vspace=6></a>");
	//vdesc=desc_alarm_on; // Replace text at bottom with text from settings file
	//}
Option 2 only shows if the alarm is on or off, where option 1 shows the same status as Domoticz.

Furthermore you also must change your blockly so it uses the security status of Domoticz and not the status of the door contact.
The virtual alarm switch must be managed by the security status like in the blockly below.
security-panel.jpg
security-panel.jpg (45.1 KiB) Viewed 4754 times
Then you can make another blockly which starts an action if the alarm is set and the door contact opens.

Re: NEW frontpage.html - request comments

Posted: Friday 27 March 2015 21:39
by dbfan
thanks G3rard, option1 works great ! :)

Re: NEW frontpage.html - request comments

Posted: Saturday 28 March 2015 12:39
by jannl
hm, seems my 'buienradar' is not working in frontpage anymore.
Anyone else has the same problem or is it just me?

Re: NEW frontpage.html - request comments

Posted: Saturday 28 March 2015 13:00
by Heisenberg
Me too. Seems api of buienradar doesn't work anymore

Re: NEW frontpage.html - request comments

Posted: Saturday 28 March 2015 13:10
by Siewert308SW
Same here,
Buienrader change their API so i used G3rard his url found in his frontpage.html

Re: NEW frontpage.html - request comments

Posted: Saturday 28 March 2015 13:46
by jannl
thx, that worked