LUA: Summer / Winter from timeofday or other...

Moderator: leecollings

User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by sincze »

The wiki is always available for help :D
https://www.domoticz.com/wiki/User_variables

It has a nice description on how to fill user variables that you can use in domoticz.

And it uses this nice function:

Code: Select all

function WhichSeason()
     local tNow = os.date("*t")
     local dayofyear = tNow.yday
     local season
     if (dayofyear >= 79) and (dayofyear < 172) then season = "Spring"
     elseif (dayofyear >= 172) and (dayofyear < 266) then season = "Summer"
     elseif (dayofyear >= 266) and (dayofyear < 355) then season = "Autumn"
     else season = "Winter"
     end
     return season
end
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Derik »

jvdz wrote:
Derik wrote:The option from Jos, is without any hard to get stuff...... I got him working in a few minutes....
Without cron is better for my backup...
Did you see my post above your's since we posted around the same time?

Jos
Yes i am happy with your code works perfect....
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Jan Jansen »

Today I made ​​a beginning with user variables and LUA.
Knipsel 1.PNG
Knipsel 1.PNG (73.06 KiB) Viewed 3978 times


I would like to connect a switch to the user variable dark but I did not succeed, using blockly.
Knipsel 2.PNG
Knipsel 2.PNG (21.07 KiB) Viewed 3978 times
I hope somebody can help.

I can not write LUA programs, I only use blockly. But today, and foor the first time, I managed to copy a program from the WIKI into Domoticz.

Thanks in advance.
Martijn85
Posts: 53
Joined: Wednesday 20 January 2016 20:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Martijn85 »

Thanks for the script @jvdz I have changed it a little so there`s only one selector switch.
2017_01_08_23_33_47_Domoticz.png
2017_01_08_23_33_47_Domoticz.png (63.94 KiB) Viewed 3759 times
This is the (changed) LUA script:

Code: Select all

-- script_time_season.lua
-- The change of state is a fixed date:
-- Lente: 21 maart t/m 20 juni
-- Zomer: 21 juni t/m 20 september
-- Herfst: 21 september t/m 20 december
-- Winter: 21 december t/m 20 maart

commandArray = {}

time = os.date("*t")

-- check once a minute for the season to change
if (time.month == 12 and time.day >= 21)
or (time.month == 1)
or (time.month == 2)
or (time.month == 3 and time.day < 21) then
   Seizoen = 'Winter'
elseif (time.month == 3)
or (time.month == 4)
or (time.month == 5)
or (time.month == 6 and time.day < 21) then
   Seizoen = 'Voorjaar'
elseif (time.month == 6)
or (time.month == 7)
or (time.month == 8)
or (time.month == 9 and time.day < 21) then
   Seizoen = 'Zomer'
elseif (time.month == 9)
or (time.month == 10)
or (time.month == 11)
or (time.month == 12 and time.day < 21) then
   Seizoen = 'Herfst'
else
   print('Something wrong in the season logic :)')
end

if Seizoen == 'Voorjaar' then
   commandArray['Seizoen'] = 'Set Level: 10'
elseif Seizoen == 'Zomer' then
   commandArray['Seizoen'] = 'Set Level: 20'
elseif Seizoen == 'Herfst' then
   commandArray['Seizoen'] = 'Set Level: 30'
elseif Seizoen == 'Winter' then
   commandArray['Seizoen'] = 'Set Level: 40'
else
   print('Het seizoen is veranderd, het is nu '..Seizoen)
end

return commandArray
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by mikeoo »

Martijn85 wrote:Thanks for the script @jvdz I have changed it a little so there`s only one selector switch.

2017_01_08_23_33_47_Domoticz.png

This is the (changed) LUA script:

Code: Select all

-- script_time_season.lua
-- The change of state is a fixed date:
-- Lente: 21 maart t/m 20 juni
-- Zomer: 21 juni t/m 20 september
-- Herfst: 21 september t/m 20 december
-- Winter: 21 december t/m 20 maart

commandArray = {}

time = os.date("*t")

-- check once a minute for the season to change
if (time.month == 12 and time.day >= 21)
or (time.month == 1)
or (time.month == 2)
or (time.month == 3 and time.day < 21) then
   Seizoen = 'Winter'
elseif (time.month == 3)
or (time.month == 4)
or (time.month == 5)
or (time.month == 6 and time.day < 21) then
   Seizoen = 'Voorjaar'
elseif (time.month == 6)
or (time.month == 7)
or (time.month == 8)
or (time.month == 9 and time.day < 21) then
   Seizoen = 'Zomer'
elseif (time.month == 9)
or (time.month == 10)
or (time.month == 11)
or (time.month == 12 and time.day < 21) then
   Seizoen = 'Herfst'
else
   print('Something wrong in the season logic :)')
end

if Seizoen == 'Voorjaar' then
   commandArray['Seizoen'] = 'Set Level: 10'
elseif Seizoen == 'Zomer' then
   commandArray['Seizoen'] = 'Set Level: 20'
elseif Seizoen == 'Herfst' then
   commandArray['Seizoen'] = 'Set Level: 30'
elseif Seizoen == 'Winter' then
   commandArray['Seizoen'] = 'Set Level: 40'
else
   print('Het seizoen is veranderd, het is nu '..Seizoen)
end

return commandArray
Nice one thanks for the script. Only the Print commands are not working because the IF is always true for 1 of the 4 so it will never gets to the else.

Your seasons picture (switch) is not correct . Lente needs to be Zomer :D

Tweaked your scripts a bit and added colors to the print commands.Only the PRINT command is now logged every minute. Still looking for a way to adjust it to only once.

Code: Select all

-- script_time_season.lua
-- The change of state is a fixed date:
-- Lente: 21 maart t/m 20 juni
-- Zomer: 21 juni t/m 20 september
-- Herfst: 21 september t/m 20 december
-- Winter: 21 december t/m 20 maart

commandArray = {}

time = os.date("*t")

-- check once a minute for the season to change
if (time.month == 12 and time.day >= 21)
or (time.month == 1)
or (time.month == 2)
or (time.month == 3 and time.day < 21) then
   Seizoen = 'Winter'
elseif (time.month == 3)
or (time.month == 4)
or (time.month == 5)
or (time.month == 6 and time.day < 21) then
   Seizoen = 'Lente'
elseif (time.month == 6)
or (time.month == 7)
or (time.month == 8)
or (time.month == 9 and time.day < 21) then
   Seizoen = 'Zomer'
elseif (time.month == 9)
or (time.month == 10)
or (time.month == 11)
or (time.month == 12 and time.day < 21) then
   Seizoen = 'Herfst'
else
   print('<font color="red">Logica van de seizoenen kloppen niet!!!</font>')
   
end

if Seizoen == 'Lente' then
   commandArray['Seizoen'] = 'Set Level: 10'
   print('<font color="blue">Seizoen aangepast naar Lente</font>')
 elseif Seizoen == 'Zomer' then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="blue">Seizoen aangepast naar Zomer</font>')
elseif Seizoen == 'Herfst' then
   commandArray['Seizoen'] = 'Set Level: 30'
   print('<font color="blue">Seizoen aangepast naar Herfst</font>')
elseif Seizoen == 'Winter' then
   commandArray['Seizoen'] = 'Set Level: 40'
   print('<font color="blue">Seizoen aangepast naar Winter</font>')
else
	print('<font color="blue">Geen actie nodig voor het aanpassen van de seizoenen</font>')
end

return commandArray
Martijn85
Posts: 53
Joined: Wednesday 20 January 2016 20:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Martijn85 »

Thanks for the update/tweak!
mikeoo wrote:Only the PRINT command is now logged every minute. Still looking for a way to adjust it to only once.
That would be nice indeed! For now i have added this:

Code: Select all

-- check every 720 minutes for the season to change
if((time.min % 720)==0) then
end
Now it's running every 12 hours, not every minute.

The complete script:

Code: Select all

-- script_time_season.lua
-- The change of state is a fixed date:
-- Lente: 21 maart t/m 20 juni
-- Zomer: 21 juni t/m 20 september
-- Herfst: 21 september t/m 20 december
-- Winter: 21 december t/m 20 maart

commandArray = {}

time = os.date("*t")

-- check every 720 minutes for the season to change
if((time.min % 720)==0) then

-- check once a minute for the season to change
if (time.month == 12 and time.day >= 21)
or (time.month == 1)
or (time.month == 2)
or (time.month == 3 and time.day < 21) then
   Seizoen = 'Winter'
elseif (time.month == 3)
or (time.month == 4)
or (time.month == 5)
or (time.month == 6 and time.day < 21) then
   Seizoen = 'Lente'
elseif (time.month == 6)
or (time.month == 7)
or (time.month == 8)
or (time.month == 9 and time.day < 21) then
   Seizoen = 'Zomer'
elseif (time.month == 9)
or (time.month == 10)
or (time.month == 11)
or (time.month == 12 and time.day < 21) then
   Seizoen = 'Herfst'
else
   print('<font color="red">Logica van de seizoenen kloppen niet!!!</font>')
   
end

if Seizoen == 'Lente' then
   commandArray['Seizoen'] = 'Set Level: 10'
   print('<font color="blue">Seizoen aangepast naar Lente</font>')
 elseif Seizoen == 'Zomer' then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="blue">Seizoen aangepast naar Zomer</font>')
elseif Seizoen == 'Herfst' then
   commandArray['Seizoen'] = 'Set Level: 30'
   print('<font color="blue">Seizoen aangepast naar Herfst</font>')
elseif Seizoen == 'Winter' then
   commandArray['Seizoen'] = 'Set Level: 40'
   print('<font color="blue">Seizoen aangepast naar Winter</font>')
else
   print('<font color="blue">Geen actie nodig voor het aanpassen van de seizoenen</font>')
end
end

return commandArray
User avatar
mlamie
Posts: 122
Joined: Friday 25 October 2013 17:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: The Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by mlamie »

Thanks for the nice lua script. Now I have to find a good use case ;)
Raspberry Pi 3, RaZberry, RFXtrx433
Various Z-Wave devices, KlikAanKlikUit devices, ESP8266 NodeMCU, Sonoff POW and a Essent E-thermostaat
IP camera: Dahua 4MP IPC-HDBW4421R-AS, Vivotek FD8134V
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Derik »

mlamie wrote:Thanks for the nice lua script. Now I have to find a good use case ;)
Same switch for other stuff in winter and summer
lights longer or shorter
etc
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Jan Jansen »

Martijn85 wrote:Thanks for the update/tweak!
mikeoo wrote:Only the PRINT command is now logged every minute. Still looking for a way to adjust it to only once.
That would be nice indeed! For now i have added this:

Code: Select all

-- check every 720 minutes for the season to change
if((time.min % 720)==0) then
end
Now it's running every 12 hours, not every minute.

The complete script:

Code: Select all

-- script_time_season.lua
-- The change of state is a fixed date:
-- Lente: 21 maart t/m 20 juni
-- Zomer: 21 juni t/m 20 september
-- Herfst: 21 september t/m 20 december
-- Winter: 21 december t/m 20 maart

commandArray = {}

time = os.date("*t")

-- check every 720 minutes for the season to change
if((time.min % 720)==0) then

-- check once a minute for the season to change
if (time.month == 12 and time.day >= 21)
or (time.month == 1)
or (time.month == 2)
or (time.month == 3 and time.day < 21) then
   Seizoen = 'Winter'
elseif (time.month == 3)
or (time.month == 4)
or (time.month == 5)
or (time.month == 6 and time.day < 21) then
   Seizoen = 'Lente'
elseif (time.month == 6)
or (time.month == 7)
or (time.month == 8)
or (time.month == 9 and time.day < 21) then
   Seizoen = 'Zomer'
elseif (time.month == 9)
or (time.month == 10)
or (time.month == 11)
or (time.month == 12 and time.day < 21) then
   Seizoen = 'Herfst'
else
   print('<font color="red">Logica van de seizoenen kloppen niet!!!</font>')
   
end

if Seizoen == 'Lente' then
   commandArray['Seizoen'] = 'Set Level: 10'
   print('<font color="blue">Seizoen aangepast naar Lente</font>')
 elseif Seizoen == 'Zomer' then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="blue">Seizoen aangepast naar Zomer</font>')
elseif Seizoen == 'Herfst' then
   commandArray['Seizoen'] = 'Set Level: 30'
   print('<font color="blue">Seizoen aangepast naar Herfst</font>')
elseif Seizoen == 'Winter' then
   commandArray['Seizoen'] = 'Set Level: 40'
   print('<font color="blue">Seizoen aangepast naar Winter</font>')
else
   print('<font color="blue">Geen actie nodig voor het aanpassen van de seizoenen</font>')
end
end

return commandArray
I tried the customized script but the relevant selector is updated every hour . I don't know what's wrong.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by jvdz »

Jan Jansen wrote: I tried the customized script but the relevant selector is updated every hour . I don't know what's wrong.
Makes sense i think, as the variable time.min will contain a value between 0 and 59 so the below statement is true when it is 0:

Code: Select all

if ((time.min % 720) == 0) then
Right?
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Jan Jansen »

I only see that it does not work as desired. Lua is still a challenge for me. This certainly applies to the variable time.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by jvdz »

Without testing I guess that statement should be

Code: Select all

if (((time.hour*60+time.min) % 720) == 0) then
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Jan Jansen »

@ Jos

Your statement is ok.
zicht
Posts: 251
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by zicht »

Jan Jansen wrote:Today I made ​​a beginning with user variables and LUA.

Knipsel 1.PNG

I would like to connect a switch to the user variable dark but I did not succeed, using blockly.

Knipsel 2.PNG

I hope somebody can help.

I can not write LUA programs, I only use blockly. But today, and foor the first time, I managed to copy a program from the WIKI into Domoticz.

Thanks in advance.

Hi !

Since you do not know lua :
I dont use blocky, but i see you have a string variable ?
Are you i Blockey also using string compaire and not boolean values ?
mixing things can mess things up.

Try using some text like "ok" and "nok" instead of true an false just to test --> but on both so in the user var and in the blocky both the same of course.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
niki_lauda
Posts: 115
Joined: Saturday 31 August 2013 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Eindhoven (NL)
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by niki_lauda »

Martijn85 wrote:Thanks for the update/tweak!
mikeoo wrote:Only the PRINT command is now logged every minute. Still looking for a way to adjust it to only once.
That would be nice indeed! For now i have added this:

Code: Select all

-- check every 720 minutes for the season to change
if((time.min % 720)==0) then
end
Now it's running every 12 hours, not every minute.

The complete script:

Code: Select all

-- script_time_season.lua
-- The change of state is a fixed date:
-- Lente: 21 maart t/m 20 juni
-- Zomer: 21 juni t/m 20 september
-- Herfst: 21 september t/m 20 december
-- Winter: 21 december t/m 20 maart

commandArray = {}

time = os.date("*t")

-- check every 720 minutes for the season to change
if((time.min % 720)==0) then

-- check once a minute for the season to change
if (time.month == 12 and time.day >= 21)
or (time.month == 1)
or (time.month == 2)
or (time.month == 3 and time.day < 21) then
   Seizoen = 'Winter'
elseif (time.month == 3)
or (time.month == 4)
or (time.month == 5)
or (time.month == 6 and time.day < 21) then
   Seizoen = 'Lente'
elseif (time.month == 6)
or (time.month == 7)
or (time.month == 8)
or (time.month == 9 and time.day < 21) then
   Seizoen = 'Zomer'
elseif (time.month == 9)
or (time.month == 10)
or (time.month == 11)
or (time.month == 12 and time.day < 21) then
   Seizoen = 'Herfst'
else
   print('<font color="red">Logica van de seizoenen kloppen niet!!!</font>')
   
end

if Seizoen == 'Lente' then
   commandArray['Seizoen'] = 'Set Level: 10'
   print('<font color="blue">Seizoen aangepast naar Lente</font>')
 elseif Seizoen == 'Zomer' then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="blue">Seizoen aangepast naar Zomer</font>')
elseif Seizoen == 'Herfst' then
   commandArray['Seizoen'] = 'Set Level: 30'
   print('<font color="blue">Seizoen aangepast naar Herfst</font>')
elseif Seizoen == 'Winter' then
   commandArray['Seizoen'] = 'Set Level: 40'
   print('<font color="blue">Seizoen aangepast naar Winter</font>')
else
   print('<font color="blue">Geen actie nodig voor het aanpassen van de seizoenen</font>')
end
end

return commandArray
How do I get, in lua, the content 'Seizoen'. One thing what I would like to do is not to set the level to 20 when its already set to 20.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by jvdz »

Just add an and relation to the If like: (untested)

Code: Select all

if Seizoen == 'Lente' and otherdevices['Seizoen'] ~= 10 then
   commandArray['Seizoen'] = 'Set Level: 10'
   print('<font color="blue">Seizoen aangepast naar Lente</font>')
 elseif Seizoen == 'Zomer'  and otherdevices['Seizoen'] ~= 20 then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="blue">Seizoen aangepast naar Zomer</font>')
elseif Seizoen == 'Herfst'  and otherdevices['Seizoen'] ~= 30 then
   commandArray['Seizoen'] = 'Set Level: 30'
   print('<font color="blue">Seizoen aangepast naar Herfst</font>')
elseif Seizoen == 'Winter' and otherdevices['Seizoen'] ~= 40  then
   commandArray['Seizoen'] = 'Set Level: 40'
   print('<font color="blue">Seizoen aangepast naar Winter</font>')
else
   print('<font color="blue">Geen actie nodig voor het aanpassen van de seizoenen</font>')
end
 
Could be that you need to test for otherdevices_svalues['Seizoen'] to get the current value and I can't check that now.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
niki_lauda
Posts: 115
Joined: Saturday 31 August 2013 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Eindhoven (NL)
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by niki_lauda »

jvdz wrote:Just add an and relation to the If like: (untested)

Code: Select all

if Seizoen == 'Lente' and otherdevices['Seizoen'] ~= 10 then
   commandArray['Seizoen'] = 'Set Level: 10'
   print('<font color="blue">Seizoen aangepast naar Lente</font>')
 elseif Seizoen == 'Zomer'  and otherdevices['Seizoen'] ~= 20 then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="blue">Seizoen aangepast naar Zomer</font>')
elseif Seizoen == 'Herfst'  and otherdevices['Seizoen'] ~= 30 then
   commandArray['Seizoen'] = 'Set Level: 30'
   print('<font color="blue">Seizoen aangepast naar Herfst</font>')
elseif Seizoen == 'Winter' and otherdevices['Seizoen'] ~= 40  then
   commandArray['Seizoen'] = 'Set Level: 40'
   print('<font color="blue">Seizoen aangepast naar Winter</font>')
else
   print('<font color="blue">Geen actie nodig voor het aanpassen van de seizoenen</font>')
end
 
Could be that you need to test for otherdevices_svalues['Seizoen'] to get the current value and I can't check that now.

Jos
Tested. Doesn't work.

Code: Select all

elseif Seizoen == 'Zomer' and otherdevices['Seizoen'] ~=20  then
   commandArray['Seizoen'] = 'Set Level: 20'
   print('<font color="red"> de zomer is begonnen!!!</font>')
 
swiches every minute 2017-06-26 20:14:06.915 LUA: Open
2017-06-26 20:14:07.292 LUA: de zomer is begonnen!!!
2017-06-26 20:14:07.296 EventSystem: Script event triggered: seizoen
niki_lauda
Posts: 115
Joined: Saturday 31 August 2013 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Eindhoven (NL)
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by niki_lauda »

Found it!
elseif Seizoen == 'Zomer' and otherdevices['Seizoen'] ~= 'Zomer' then
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by jvdz »

Good you sorted it. This is why I mentioned it could also be otherdevices_svalues['Seizoen'] which I believe should be set to the level of the Selector switch. I can't test it to verify at the moment.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: LUA: Summer / Winter from timeofday or other...

Post by Derik »

Old topic..
Only....

Dear all..
I will try to hav this script [ seizoenen with 4 dummys ] in the intern lua option from Domoticz..
Only that is not working, with this script
Is there perhaps someone that have this working?
Now i do it with a cron, only need to backup this all.
When i got this into the intern it it is much easier...
Perhaps someone can make this work??

En is there anyone that have a script for all the months of a year?
Like to have every month in domoticz, with some dummy
So i can make my dragon happy
in some months he needs more uvb the others:-)
I did try this with google calendar... only i get that option not working..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest