Hi, I would like to create an action that allows me to turn on a xiaomi switch from 17 to 23 in a period from December 7th to January 7th of the following year. For periods not included, the switch remains off. Can someone help me?
thank you. The name of the switch is "SMart Christmas". Thank you
Smart in a Month
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Smart in a Month
In dzVents it would look likematteos1 wrote: ↑Sunday 23 December 2018 16:36 Hi, I would like to create an action that allows me to turn on a xiaomi switch from 17 to 23 in a period from December 7th to January 7th of the following year. For periods not included, the switch remains off. Can someone help me?
thank you. The name of the switch is "SMart Christmas". Thank you
Code: Select all
local XiaomiOff = "at 23:00"
local XiaomiOn = "at 17:00"
return {
on = { timer = {XiaomiOn .. " on 7/12-31/12",XiaomiOn .. " on 1/1-7/1",XiaomiOff .. " on 7/12-31/12",XiaomiOff .. " on 1/1-7/1"}},
execute = function(dz)
smartCristmas = dz.devices("SMart Christmas")
if dz.time.matchesRule(XiaomiOn) then
smartCristmas.switchOn()
else
smartCristmas.switchOff()
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: Smart in a Month
ok now i check.
Re: Smart in a Month
thre is an error here?waaren wrote: ↑Sunday 23 December 2018 17:36In dzVents it would look likematteos1 wrote: ↑Sunday 23 December 2018 16:36 Hi, I would like to create an action that allows me to turn on a xiaomi switch from 17 to 23 in a period from December 7th to January 7th of the following year. For periods not included, the switch remains off. Can someone help me?
thank you. The name of the switch is "SMart Christmas". Thank youCode: Select all
local XiaomiOff = "at 23:00" local XiaomiOn = "at 17:00" return { on = { timer = {XiaomiOn .. " on 7/12-31/12",XiaomiOn .. " on 1/1-7/1",XiaomiOff .. " on 7/12-31/12",XiaomiOff .. " on 1/1-7/1"}}, execute = function(dz) smartCristmas = dz.devices("SMart Christmas") if dz.time.matchesRule(XiaomiOn) then smartCristmas.switchOn() else smartCristmas.switchOff() end end }
on = { timer = {XiaomiOn .. " on 7/12-31/12",XiaomiOn .. " on 1/1-7/1",XiaomiOff .. " on 7/12-31/12",XiaomiOff .. " on 1/1-7/1"}},
Who is online
Users browsing this forum: No registered users and 1 guest