Washing Machine Door Signal
Posted: Saturday 19 October 2019 18:23
I have one of those 433 Mhz Kerui door switches connected up to a relay which indicates when volts are no longer going through the door switch heater. Everything is working ok except my code. Instead of getting a delayed message that the door is "unlocked" I get the message immediately.
If I remove the "and washmachinedoor.lastUpdate.minutesAgo >= 5" delay then it all works fine without a delay.
Can anyone tell me where I am going wrong...
If I remove the "and washmachinedoor.lastUpdate.minutesAgo >= 5" delay then it all works fine without a delay.
Can anyone tell me where I am going wrong...
Code: Select all
return {
on = {
devices = {
'WashMachine-D3'
}
},
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed ' .. device.state, domoticz.LOG_INFO)
local washmachinedoor = domoticz.devices('WashMachine-D3')
if (washmachinedoor.state == 'Alarm' and washmachinedoor.lastUpdate.minutesAgo >= 5) then
domoticz.log('washmachine door is unlocked')
msg="Wash Machine Door Unlocked"
domoticz.openURL('https://api.telegram.org/256900994&text=' .. msg)
end
end
}