Page 18 of 66

[obsolete] Re: NEW frontpage.html - request comments

Posted: Sunday 08 February 2015 15:14
by jkimmel
With the help of danpep this code controls one of my heating systems

Code: Select all

-- script_time_HeizungSchlafzimmer.lua

function TimeElapsed(s)
   year = string.sub(s, 1, 4)
   month = string.sub(s, 6, 7)
   day = string.sub(s, 9, 10)
   hour = string.sub(s, 12, 13)
   minutes = string.sub(s, 15, 16)
   seconds = string.sub(s, 18, 19)
   t1 = os.time()
   t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
   difference = os.difftime (t1, t2)
   return difference
end

debug_option = 1
TemperatureUpdateElapsed = TimeElapsed(otherdevices_lastupdate['Schlafzimmer'])
sTemp = tonumber(otherdevices_svalues['Schlafzimmer'])
if debug_option == 2 then print( "script_time_HeizungSchlafzimmer.lua: Starting..." ) end
if debug_option == 2 then print("script_time_HeizungSchlafzimmer.lua: TemperatureUpdateElapsed is " .. TemperatureUpdateElapsed) end
if debug_option == 2 then print("otherdevices_svalues['Schlafzimmer'] = " .. sTemp .. " degrees.") end
if debug_option == 2 then print("otherdevices['Heizkreis Schlafzimmer'] = " .. otherdevices['Heizkreis Salon']) end

commandArray = {}

if (TemperatureUpdateElapsed > 600 and TemperatureUpdateElapsed < 700) then
   -- this will allow the room thermostat (set at 22 degrees) to control the max temperature.
   commandArray['SendNotification'] ='Schlafzimmer Temp sensor has not sent an update in 10 minutes. Disabling Domoticz temperature control.'
   commandArray['Heizkreis Schlafzimmer'] ='On'
end

if otherdevices_svalues['Thermostat Schlafzimmer'] == "Off" and otherdevices['Heizkreis Schlafzimmer'] == 'On' then
   if debug_option == 1 then print("Thermostat Schlafzimmer off. Turning central heating OFF." ) end
   commandArray['Heizkreis Schlafzimmer'] = 'Off'
else
   setpoint = tonumber(math.floor( otherdevices_svalues['Thermostat Schlafzimmer'] ) + 13 )
   if debug_option == 2 then print("otherdevices_svalues['Thermostat Schlafzimmer'] = " .. setpoint .. " degrees.") end

   if sTemp < setpoint then
      if otherdevices['Heizkreis Schlafzimmer'] == 'Off' then
         if debug_option == 1 then print("Temperature Schlafzimmer below thermostat set point. Calling for heat." ) end
         commandArray['Heizkreis Schlafzimmer'] = 'On'

      end
   else
       if otherdevices['Heizkreis Schlafzimmer'] == 'On' then
      		 if debug_option == 1 then print("Schlafzimmer Thermostat set point reached. Call for heat stopped." ) end
       	 commandArray['Heizkreis Schlafzimmer'] = 'Off'
      end
   end
end

return commandArray
As you can see dimmers are used to set usable setpoints. As to convert the dimmer steps of 1/16 into usable temp values there is some math done, which gives me a variable " setpoint"

So I would like to have a dimmer cell where dimmer value is exchanged by setpoint.


I don't need this anymore because use Setpoint instead.

Re: NEW frontpage.html - request comments

Posted: Sunday 08 February 2015 22:41
by vanputten80
mvveelen wrote:I've made some small changes:

- Button up, the icon that is, wasn't OK (thanks for pointing that one out for me, ThinkPad)
- The % is now shown on a similar button

Downloadlink: LINK


[/code]
Thanks for this.
Maybe a stupid question but I want to have the camera, located in mine sons room, in Cell2_3. How can I do that? I copied some code from the first Frontpage but it isn`t working.

EDIT
Found it. Add a line in CSS and now it works :)

Re: NEW frontpage.html - request comments

Posted: Monday 09 February 2015 16:07
by Siewert308SW
Wanna thank those who started this.
Had a old Samsung Galaxy Tab 7" eating dusk.
Last night i prepared it to run 24/7 with additional apps to beable to use Voice commands which is my next project to kill some time.
Today i made a wooden frame which only need some paint. ;-)
But here is my test setup...

Re: NEW frontpage.html - request comments

Posted: Monday 09 February 2015 16:43
by jesper
Hi
What is the cheapest monitor solution that will work and what is the best solution ...
is it Raspberry Pi + WIFI and monitor or ?

Re: NEW frontpage.html - request comments

Posted: Monday 09 February 2015 16:51
by Siewert308SW
jesper wrote:Hi
What is the cheapest monitor solution that will work and what is the best solution ...
is it Raspberry Pi + WIFI and monitor or ?
You mean "monitor" as in Display?
No need to have a display, Domoticz is controled by browser and when setup walk away and never look back unless you fiddle with it every day.
Raspi is the cheapest way, i bought mine from the dutch E-bay (marktplaats) for €30 and a new RFXtrx433E for €100

Re: NEW frontpage.html - request comments

Posted: Tuesday 10 February 2015 1:13
by maluko
Siewert308SW wrote:Wanna thank those who started this.
Had a old Samsung Galaxy Tab 7" eating dusk.
Last night i prepared it to run 24/7 with additional apps to beable to use Voice commands which is my next project to kill some time.
Today i made a wooden frame which only need some paint. ;-)
But here is my test setup...

this are my project too when pieces arrive from china....am waiting.....hehheh

Re: NEW frontpage.html - request comments

Posted: Tuesday 10 February 2015 9:33
by Siewert308SW
Have a question to those who know more about html in general.

In frontpage.html (dutch users) i/we have a cell with a Buienradar image.

Code: Select all

<img src="http://www3.buienradar.nl/images.aspx?jaar=-3&soort=sb&t="  onClick="lightbox_open('camera2', 15400);" width="200px" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 15000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' class='camera' />
When ticked it will open a popup with the realtime rain prediction.
Normally when you alter it you are able to open a other popup with a different content.
Well, this doesn't work.

For example i modified the line to be able to open the secpanel in a popup to arm or disarm the alarm instead of surfing to the desired page.
I have tried several modifications but non of them produces the desired popup.
Either it is opening nothing or it opens the "buienradar" popup.

I tried the following:

Code: Select all

<a href="http://192.168.1.11:8080/secpanel/index.html"  onClick="lightbox_open('secpanel', 15400);" width="200px" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 15000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' class='camera' />

Code: Select all

<a href="http://192.168.1.11:8080/secpanel/index.html"  onClick="lightbox_open('camera2', 15400);" width="200px" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 15000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' class='camera' />

Code: Select all

<a href="http://192.168.1.11:8080/secpanel/index.html"  onClick="lightbox_open('camera2', 15400);" width="200px" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 15000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' class='camera' /><img src="http://192.168.1.11:8080/images/security48.png"></a>

Code: Select all

<a href="javascript:lightbox_open('http://192.168.1.11:8080/secpanel/index.html');"><img src="http://192.168.1.11:8080/images/security48.png"></a>
Can write anything down which i tried.
But can anybody point me in de right direction to be able to open a popup in the same style/layout but with the secpanel in it's place.

Re: NEW frontpage.html - request comments

Posted: Tuesday 10 February 2015 10:07
by mvveelen
Interesting question, and I would love this implemented too. But first I have to understand how this sec. panel works and what it exactly does. I too want to expand the possibilities I now have to use an alarm system. I already have some doorsensors, but haven't gotten around to find out how this could be used for an alarm. If you or someone else finds the solution for the code, please post it here :) ? This would be an extra push for me to finally (...) find out about the alarm :)

Re: NEW frontpage.html - request comments

Posted: Tuesday 10 February 2015 10:21
by Siewert308SW
mvveelen wrote:Interesting question, and I would love this implemented too. But first I have to understand how this sec. panel works and what it exactly does. I too want to expand the possibilities I now have to use an alarm system. I already have some doorsensors, but haven't gotten around to find out how this could be used for an alarm. If you or someone else finds the solution for the code, please post it here :) ? This would be an extra push for me to finally (...) find out about the alarm :)
Basic is simple,
with the secpanel you can set the internal domo alarm variable with a pincode to arm or disarm.
With this variable you can obviously build a blocky.
I don't own a expensive alarm system.
And there for i use my 4 smoke-detectors.

Example:
When the alarm is armed and someone opens a door, window or motion is detected with one of my kaku switches then you have a 30seconds delay and be able to enter the pincode.
Other wise all four smoke-detectors will start to panic and i'll receive a message of a possible burglary.

The way it's setup now is that someone had to take his/her phone and disable the alarm.
This is something i want to prevent and want to be able to use the frontpage.html and assign a cell with lock image.
When pressed it should open a popup in the same style of the frontpage with the secpanel keypad.

Unfortunately the code as we know it now in the frontpage doesn't allow to open the secpanel html as popup.
Old style popup scripts do work on windows but android browsers don't and either open a new window or nothing at all.
I do find it weird why the current popup script is refusing this or if the secpanel is having a hardtime.

I just hoped some else already done this and there for asked for help.

Re: NEW frontpage.html - request comments

Posted: Tuesday 10 February 2015 21:12
by jesper
Hi
Have a few questions / big wish.
1. Is it possible to make a frontpage so the image if yes how?.
2. What does it take to it can also be displayed on an iphone?.

I just hoped some can help me

Re: NEW frontpage.html - request comments

Posted: Wednesday 11 February 2015 8:53
by jkimmel
jkimmel wrote:With the help of danpep this code controls one of my heating systems

Code: Select all

-- script_time_HeizungSchlafzimmer.lua

function TimeElapsed(s)
   year = string.sub(s, 1, 4)
   month = string.sub(s, 6, 7)
   day = string.sub(s, 9, 10)
   hour = string.sub(s, 12, 13)
   minutes = string.sub(s, 15, 16)
   seconds = string.sub(s, 18, 19)
   t1 = os.time()
   t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
   difference = os.difftime (t1, t2)
   return difference
end

debug_option = 1
TemperatureUpdateElapsed = TimeElapsed(otherdevices_lastupdate['Schlafzimmer'])
sTemp = tonumber(otherdevices_svalues['Schlafzimmer'])
if debug_option == 2 then print( "script_time_HeizungSchlafzimmer.lua: Starting..." ) end
if debug_option == 2 then print("script_time_HeizungSchlafzimmer.lua: TemperatureUpdateElapsed is " .. TemperatureUpdateElapsed) end
if debug_option == 2 then print("otherdevices_svalues['Schlafzimmer'] = " .. sTemp .. " degrees.") end
if debug_option == 2 then print("otherdevices['Heizkreis Schlafzimmer'] = " .. otherdevices['Heizkreis Salon']) end

commandArray = {}

if (TemperatureUpdateElapsed > 600 and TemperatureUpdateElapsed < 700) then
   -- this will allow the room thermostat (set at 22 degrees) to control the max temperature.
   commandArray['SendNotification'] ='Schlafzimmer Temp sensor has not sent an update in 10 minutes. Disabling Domoticz temperature control.'
   commandArray['Heizkreis Schlafzimmer'] ='On'
end
[code]
if otherdevices_svalues['Thermostat Schlafzimmer'] == "Off" and otherdevices['Heizkreis Schlafzimmer'] == 'On' then
   if debug_option == 1 then print("Thermostat Schlafzimmer off. Turning central heating OFF." ) end
   commandArray['Heizkreis Schlafzimmer'] = 'Off'
else
   setpoint = tonumber(math.floor( otherdevices_svalues['Thermostat Schlafzimmer'] ) + 13 )
   if debug_option == 2 then print("otherdevices_svalues['Thermostat Schlafzimmer'] = " .. setpoint .. " degrees.") end

   if sTemp < setpoint then
      if otherdevices['Heizkreis Schlafzimmer'] == 'Off' then
         if debug_option == 1 then print("Temperature Schlafzimmer below thermostat set point. Calling for heat." ) end
         commandArray['Heizkreis Schlafzimmer'] = 'On'

      end
   else
       if otherdevices['Heizkreis Schlafzimmer'] == 'On' then
      		 if debug_option == 1 then print("Schlafzimmer Thermostat set point reached. Call for heat stopped." ) end
       	 commandArray['Heizkreis Schlafzimmer'] = 'Off'
      end
end
end

return commandArray[/code]

As you can see dimmers are used to set usable setpoints. As to convert the dimmer steps of 1/16 into usable temp values there is some math done, which gives me a variable " setpoint"

So I would like to have a dimmer cell where dimmer value is exchanged by setpoint.

In the meantime I replaced dimmers by setpoints (which I thought would not work) and here is my code

Code: Select all

-- script_time_HeizungGaestebad.lua


function TimeElapsed(s)
   year = string.sub(s, 1, 4)
   month = string.sub(s, 6, 7)
   day = string.sub(s, 9, 10)
   hour = string.sub(s, 12, 13)
   minutes = string.sub(s, 15, 16)
   seconds = string.sub(s, 18, 19)
   t1 = os.time()
   t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
   difference = os.difftime (t1, t2)
   return difference
end

debug_option = 2
TemperatureUpdateElapsed = TimeElapsed(otherdevices_lastupdate['Gaestebad'])
sTemp, sHumidity = otherdevices_svalues['Gaestebad']:match("([^;]+);([^;]+)")
sTemp = tonumber(sTemp);
setpoint = tonumber( otherdevices_svalues['Setpoint Gaestebad'] )

if 
		debug_option == 2 then
    		print("Gaestebad script Starting..." )
		print("Gaestebad TemperatureUpdateElapsed is " .. TemperatureUpdateElapsed)
		print("Gaestebad = " .. sTemp .. " degrees.")
		print("Heizkreis Gaestebad " .. otherdevices['Heizkreis Gaestebad'])
		print("Setpoint Gaestebad = " .. setpoint .. " degrees.")
		

end

commandArray = {}

if 
		(TemperatureUpdateElapsed > 600 and TemperatureUpdateElapsed < 700) then
		commandArray['SendNotification'] ='Gaestebad Temp sensor has not sent an update in 10 minutes. Disabling Domoticz temperature control.'
    		commandArray['Heizkreis Gaestebad'] ='On'
end

     
if 		sTemp < setpoint and  otherdevices['Heizkreis Gaestebad'] == 'Off' then
     if 	debug_option == 1 then print("Temperature Gaestebad below thermostat set point. Calling for heat." ) end
        	commandArray['Heizkreis Gaestebad'] = 'On' 
else
if	 	otherdevices['Heizkreis Gaestebad'] == 'On'and sTemp > setpoint then
     if	debug_option == 1 then print("Gaestebad Thermostat set point reached. Call for heat stopped." ) end
        	commandArray['Heizkreis Gaestebad'] = 'Off'



      end
   end

return commandArray
These setpoints are set by their timers but I would like to manipulate them via frontpage.
I have seen that's possible but I'm mixed up with the different versions.
Who can me help out with a code?



Eventually I arrived here:

fp1.JPG
fp1.JPG (69.7 KiB) Viewed 3486 times

So I got my setpoints ( cells 11 - 15) visible but can not change them

I got my scenes ( cells 16 - 20) visible but can not switch them.


Where is help?

Re: NEW frontpage.html - request comments

Posted: Wednesday 11 February 2015 9:32
by mvveelen
Siewert308SW wrote: Can write anything down which i tried.
But can anybody point me in de right direction to be able to open a popup in the same style/layout but with the secpanel in it's place.
I think you have to use a different approach, because with these pop-ups: when you click (the image), the pop-up will close. So when you want to enter the code in the security panel, the window will close as soon as you type the first digit.
So you have to close another pop-up and don't use the 'OnClick'/Close, you see what I mean? If this can be made? Yes, for sure. I'll give it a try.

Re: NEW frontpage.html - request comments

Posted: Thursday 12 February 2015 9:20
by jkimmel
I suggest to split this thread, so every developer has his own frontpage thread because I got mixed up with the different quite similar files

Re: NEW frontpage.html - request comments

Posted: Thursday 12 February 2015 9:38
by jannl
hm, not sure if splitting the thread is good.

I tend to take the things I like from different sources, because the layout is rather personal.

Since the css/code/html is split, it is much easier to adapt changes I think.

Re: NEW frontpage.html - request comments

Posted: Thursday 12 February 2015 12:33
by Siewert308SW
mvveelen wrote:
Siewert308SW wrote: Can write anything down which i tried.
But can anybody point me in de right direction to be able to open a popup in the same style/layout but with the secpanel in it's place.
I think you have to use a different approach, because with these pop-ups: when you click (the image), the pop-up will close. So when you want to enter the code in the security panel, the window will close as soon as you type the first digit.
So you have to close another pop-up and don't use the 'OnClick'/Close, you see what I mean? If this can be made? Yes, for sure. I'll give it a try.
Yep...
Working on a way with separated Javascript which will open the Secpanel on my tablet screen when alarm is armed.
And showing the Frontpage when disarmed.
Downside is me and Java aren't very good friends so will take a while to figure this out.

Re: NEW frontpage.html - request comments

Posted: Thursday 12 February 2015 17:27
by mvveelen
Yesterday I made a setup in which I had one cell with an alarm button. When you clicked on it, it would open a pop-up with the security panel in which you could enter the code. After you clicked near the pop-up, it would close the pop-up. Few downsides: the pop-up was missing the top of the security panel. Strange, but I couldn't get it the way I wanted it. Second downside: clicking on the background wasn't the way I wanted it. And third thing: when the pop-up opened, it firstly flashed a whitish pop-up and after that, the security panel showed. So I wasn't glad with the way it looked and deleted it again. Maybe I'll try again tomorrow....

Re: NEW frontpage.html - request comments

Posted: Friday 13 February 2015 11:56
by mvveelen
Unfortunately I wasn't able to edit my last post ?!

I now have a button for setting the Alarm. When I push the button, a pop-up appears and I can set the alarm. Haven't tested it yet on a tablet, but this is what it looks like in my browser (see attachment).

Things I still haven't figured out:

- how to add a description to this cell ?
- what idx could I use to show that the alarm is 'set' ? Because I would like to have a button that changes when it's 'set' or isn't.

(other tiny improvement: when the lights are OFF, the UP and DOWN buttons for the dim levels are also 'off' (=grey). Thanks ThinkPad for mentioning this to me.

Re: NEW frontpage.html - request comments

Posted: Friday 13 February 2015 12:45
by Siewert308SW
mvveelen wrote:Unfortunately I wasn't able to edit my last post ?!

I now have a button for setting the Alarm. When I push the button, a pop-up appears and I can set the alarm. Haven't tested it yet on a tablet, but this is what it looks like in my browser (see attachment).

Things I still haven't figured out:

- how to add a description to this cell ?
- what idx could I use to show that the alarm is 'set' ? Because I would like to have a button that changes when it's 'set' or isn't.

(other tiny improvement: when the lights are OFF, the UP and DOWN buttons for the dim levels are also 'off' (=grey). Thanks ThinkPad for mentioning this to me.
Look great,
You could add the secpanel widget and see what idx it has.
Your approach is different from mine or what i have in mind.
I'm trying to let the tablet screen show secpanel screen if armed and frontpage if disarmed.
But would love to take a sniff at your code.

Re: NEW frontpage.html - request comments

Posted: Friday 13 February 2015 13:18
by mvveelen
How / where do you set the secpanel widget...?!

Re: NEW frontpage.html - request comments

Posted: Friday 13 February 2015 13:23
by Siewert308SW
mvveelen wrote:How / where do you set the secpanel widget...?!
After is used the Secpanel it appeared in the unused devices Tab

Unknown? 148702 0 Security Panel Security Security Panel Normal