Sorry for the very dummy question but how it's possible to fill a local variable with the day of the week?
I'm building a basic script that remind me to put out the garbage based on the week of the day but i'm stuck to define the variable:
local today = (day of the week)
if today = mon then
.... notify....
else if today = tue then
... notify ...
....
...
local = (day of the week)
Moderator: leecollings
-
alanlsmith
- Posts: 132
- Joined: Monday 07 August 2017 17:17
- Target OS: Linux
- Domoticz version: Latest β
- Location: Near London (Saaarf!)
- Contact:
Re: local = (day of the week)
See: https://www.domoticz.com/wiki/User_variables
local day = tonumber(os.date("%w")) 0 is Sunday, 1 is Monday. ...
local day = tonumber(os.date("%w")) 0 is Sunday, 1 is Monday. ...
Domoticz Latest β, RPi 4B with 110Gb SSD for Domoticz, RPi 4B with 110Gb SSD for Node-Red & a RPi 2B for logging / IP addressing. RFXCOM, PiZiGate, Z-Wave, Harmony, Hue lamps and a bit of Broadlink.
Re: local = (day of the week)
thanks, it works!
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: local = (day of the week)
Why not something like this?
Code: Select all
return {
on = {
timer = { 'at 18:00 on mon', 'at 09:00 on tue' }
},
execute = function(domoticz, timer)
if (timer.trigger == 'at 18:00 on mon') then
-- it is monday
domoticz.notify(' ..... ')
end
-- etc
end
}
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Who is online
Users browsing this forum: No registered users and 1 guest