NEW frontpage.html - request comments

Moderator: leecollings

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 »

Ah ok. No unfortunately i cannot help you any further then :(
I am not active on this forum anymore.
User avatar
Iron Man
Posts: 17
Joined: Wednesday 05 March 2014 21:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherland
Contact:

Re: NEW frontpage.html - request comments

Post by Iron Man »

No problem, still thanks for the fast reply’s and your input ;)
mvdl
Posts: 16
Joined: Friday 13 June 2014 16:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post 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.
User avatar
Iron Man
Posts: 17
Joined: Wednesday 05 March 2014 21:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherland
Contact:

Re: NEW frontpage.html - request comments

Post 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
mvdl
Posts: 16
Joined: Friday 13 June 2014 16:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

NEW frontpage.html - request comments

Post 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...
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 »

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 4986 times
frontpage-night.jpg
frontpage-night.jpg (152.55 KiB) Viewed 4986 times
Not using Domoticz anymore
dbfan
Posts: 10
Joined: Wednesday 25 March 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post 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
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 »

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?
Not using Domoticz anymore
Jochie78
Posts: 3
Joined: Thursday 26 March 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2284
Contact:

Re: NEW frontpage.html - request comments

Post 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
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 »

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.
Not using Domoticz anymore
Jochie78
Posts: 3
Joined: Thursday 26 March 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2284
Contact:

Re: NEW frontpage.html - request comments

Post 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?
dbfan
Posts: 10
Joined: Wednesday 25 March 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by dbfan »

thanks G3rard, downloaded the files :)
Jochie78
Posts: 3
Joined: Thursday 26 March 2015 16:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2284
Contact:

Re: NEW frontpage.html - request comments

Post 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
dbfan
Posts: 10
Joined: Wednesday 25 March 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post 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
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 »

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 4740 times
Then you can make another blockly which starts an action if the alarm is set and the door contact opens.
Not using Domoticz anymore
dbfan
Posts: 10
Joined: Wednesday 25 March 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NEW frontpage.html - request comments

Post by dbfan »

thanks G3rard, option1 works great ! :)
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 »

hm, seems my 'buienradar' is not working in frontpage anymore.
Anyone else has the same problem or is it just me?
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 »

Me too. Seems api of buienradar doesn't work anymore
Raspberry Pi Type B
Raspberry Pi Type B2
RFXCOMtrx433e
User avatar
Siewert308SW
Posts: 288
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: NEW frontpage.html - request comments

Post by Siewert308SW »

Same here,
Buienrader change their API so i used G3rard his url found in his frontpage.html
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
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 »

thx, that worked
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest