12.07.2018, 09:56
I'm trying to use NodOn flushmounted switch. I'm impressed with its range also through the walls and doors. I can switch it on/off via LM and I can receive some trigger when local button is clicked. I've prepared a script which calculates its state.
But I noticed that this script is triggered 2 times every time i push the button. Without this issue all would be great
Very nice thing is when there is a power lack and then return of power the wallplug starts in the last state.
Code:
value = event.getvalue()
alias = grp.alias(event.dst)
zone, mode = alias:match('(.*)_(.*)')
log(mode, value)
statusAlias = zone .. '_status'
status = grp.getvalue(statusAlias)
if mode == 'toggle' and not value then
grp.write(statusAlias, not status)
elseif mode == 'on/off' then
grp.write(statusAlias, value)
end
Very nice thing is when there is a power lack and then return of power the wallplug starts in the last state.
Done is better than perfect