Code: Select all
return {
on = {
devices = { 'IsDonker', 'IemandThuis', 'JBElgtv' },
},
execute = function(domoticz, device)
--Donker, Iemand thuis, TV uit = alle verlichting AAN
if
domoticz.devices('IsDonker').state == 'On' and
domoticz.devices('VerlichtingBeneden_IemandThuis').state == 'Off' and
domoticz.devices('IemandThuis').state == 'On' and
domoticz.devices('JBElgtv').state == 'Off' and
--domoticz.time == 'Between sunset and 21:59'
domoticz.time.matchesRule('between sunset and 22:15')
then
domoticz.scenes('VerlichtingBeneden_AllOn').switchOn()
domoticz.log('Verlichting beneden aan', domoticz.LOG_INFO)
--Donker, Iemand thuis, TV aan = TV verlichting AAN
elseif
domoticz.devices('IsDonker').state == 'On' and
domoticz.devices('VerlichtingBeneden_WatchTV').state == 'Off' and
domoticz.devices('IemandThuis').state == 'On' and
domoticz.devices('JBElgtv').state == 'On' and
domoticz.time == 'Between sunset and 22:15'
then
domoticz.scenes('VerlichtingBenedenTVOn').switchOn()
domoticz.log('TV Verlichting beneden aan', domoticz.LOG_INFO)
--Donker, Niemand thuis = Sommige verlichting AAN
elseif
domoticz.devices('IsDonker').state == 'On' and
domoticz.devices('VerlichtingBeneden_NiemandThuis').state == 'Off' and
domoticz.devices('IemandThuis').state == 'Off' and
domoticz.time == 'Between sunset and 22:15'
then
domoticz.scenes('VerlichtingBeneden_SomeOn').switchOn()
domoticz.log('Sommige Verlichting beneden aan', domoticz.LOG_INFO)
--Donker, Iemand thuis, Na 22:15 = Keuken verlichting tijdelijk AAN
elseif
domoticz.devices('IsDonker').state == 'On' and
domoticz.devices('VerlichtingBeneden_Tijdelijk').state == 'Off' and
domoticz.devices('IemandThuis').state == 'On' and
domoticz.time == 'Between 22:15 and sunrise'
then
domoticz.devices(DimmerKeukenTafel).dimTo(30)
domoticz.devices(VerlichtingBeneden_Tijdelijk).switchOn()
domoticz.log('Keuken Verlichting tijdelijk aan', domoticz.LOG_INFO)
end
end
}
- IsDonker is a switch that turns ON when the sun is set
- IemandThuis is a switch that turns ON when someone is home
- JBElgtv is a switch that turns ON when the TV is on
- VerlichtingBeneden_IemandThuis, VerlichtingBeneden_WatchTV, VerlichtingBeneden_NiemandThuis, VerlichtingBeneden_Tijdelijk are switches that are used to control what "state" the lights are in
- After 22:15 only the kitchen light has to be turned on (last logic)
- As you can see I have been playing around with domoticz.time == and domoticz.time.matchesRule but both aren't working for me
Thanks in advanced!