Who can help me I am just a beginner in programming in dzVents
I try to switch on two groups if they are not switched in yet with an extra switch.
Added some log rules to show if the script passes these phrases but there is nothing in the logging and the lamps are not switched on.
See code and logging below.
Thanks in advance for any help.
Marc
return {
on = {
devices = { 'Laat-Thuis' }
},
execute = function(domoticz, switch)
if (switch.state == 'On' and (domoticz.groups('Binnen-Lampen') == 'Off' or domoticz.groups('Buiten-Lampen') == 'Off' )) then
domoticz.log('Welkom Thuis')
domoticz.groups('Binnen-Lampen').switchOn().forSec('60')
domoticz.groups('Buiten-Lampen').switchOn().forSec('60')
domoticz.devices('Laat-Thuis').switchOff().afterSec('10')
elseif (switch.state == 'On' and (domoticz.groups('Binnen-Lampen') == 'On' or domoticz.groups('Buiten-Lampen') == 'On' )) then
domoticz.log('Lampen zijn aan')
domoticz.devices('Laat-Thuis').switchOff().afterSec('10')
end
end
}
2018-02-09 09:44:57.082 (RFXCOM) Lighting 2 (Laat-Thuis)
2018-02-09 09:44:57.208 dzVents: Info: Handling events for: "Laat-Thuis", value: "Off"
2018-02-09 09:44:57.208 dzVents: Info: ------ Start internal script: LaatThuis: Device: "Laat-Thuis (RFXCOM)", Index: 28
2018-02-09 09:44:57.208 dzVents: Info: ------ Finished LaatThuis
2018-02-09 09:45:01.583 User: Admin initiated a switch command (28/Laat-Thuis/On)
2018-02-09 09:45:01.973 (RFXCOM) Lighting 2 (Laat-Thuis)
2018-02-09 09:45:02.161 dzVents: Info: Handling events for: "Laat-Thuis", value: "On"
2018-02-09 09:45:02.161 dzVents: Info: ------ Start internal script: LaatThuis: Device: "Laat-Thuis (RFXCOM)", Index: 28
2018-02-09 09:45:02.161 dzVents: Info: ------ Finished LaatThuis
dzVents if and elseif not working.
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: dVents if and elseif not working.
Try to change (domoticz.groups('Binnen-Lampen') == 'On' to (domoticz.groups('Binnen-Lampen').state == 'On'
and
domoticz.groups('Buiten-Lampen') == 'On' to domoticz.groups('Buiten-Lampen').state == 'On'
and see what happens..
and
domoticz.groups('Buiten-Lampen') == 'On' to domoticz.groups('Buiten-Lampen').state == 'On'
and see what happens..
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
-
- Posts: 19
- Joined: Monday 15 January 2018 10:06
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: dVents if and elseif not working.
Thanks that solved the problem!
Who is online
Users browsing this forum: Google [Bot] and 1 guest