Combine script
Posted: Saturday 10 February 2018 11:50
Hi ALl,
I read dzvent wiki but im to noob to solve it haha. I want combine 2 scripts so i have less different scripts.
When i combine those and turn off iPhone Peter. It will always do action of the first IF statement. Because it looks also to the first one. If the device is on then execute that part. It will never goto the other else if statement.
I read dzvent wiki but im to noob to solve it haha. I want combine 2 scripts so i have less different scripts.
Code: Select all
local Version = '17.12.16'
local iPhoneKay = 86
local iPhonePeter = 85
return {
active = true,
on = {
devices = {iPhoneKay},
},
logging = {marker = 'SENSOR iPhone Kay ' ..Version..'......'},
execute = function(domoticz, device)
if
(domoticz.devices(iPhoneKay).state == 'On')
then
domoticz.notify('Sensor Kay aangezet','dzVents Sensor Kay is aangezet', domoticz.PRIORITY_NORMAL)
domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
domoticz.log('--------------------==<[ IPHONE KAY AANGEZET] >==--------------------', domoticz.LOG_FORCE)
domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
elseif
(domoticz.devices(iPhoneKay).state == 'Off')
then
domoticz.notify('Sensor Kay uitgezet','dzVents Sensor Kay is uitgezet', domoticz.PRIORITY_NORMAL)
domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
domoticz.log('--------------------==<[ IPHONE KAY UITGEZET ]>==--------------------', domoticz.LOG_FORCE)
domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
elseif
(domoticz.devices(iPhonePeter).state == 'On')
then
domoticz.notify('Sensor Peter aangezet','dzVents Sensor Peter is aangezet', domoticz.PRIORITY_NORMAL)
domoticz.log('-----------------------------------------------------------------------', domoticz.LOG_FORCE)
domoticz.log('--------------------==<[ IPHONE PETER AANGEZET ]>==--------------------', domoticz.LOG_FORCE)
domoticz.log('-----------------------------------------------------------------------', domoticz.LOG_FORCE)
elseif
(domoticz.devices(iPhonePeter).state == 'Off')
then
domoticz.notify('Sensor Peter uitgezet','dzVents Sensor Peter is uitgezet', domoticz.PRIORITY_NORMAL)
domoticz.log('-----------------------------------------------------------------------', domoticz.LOG_FORCE)
domoticz.log('--------------------==<[ IPHONE PETER UITGEZET ]>==--------------------', domoticz.LOG_FORCE)
domoticz.log('-----------------------------------------------------------------------', domoticz.LOG_FORCE)
end
end
}