Trying to automate in Domoticz
-
Hello everyone, I just started with mysensors, I have successfully connected a serial gateway and a node that measures temperature. I'm now trying to automate on domoticz so that I can get notifications and other things of my node. I am trying to learn dzVents in the domoticz wiki:(https://www.domoticz.com/wiki/DzVents:_next_generation_Lua_scripting)
The problem is that When I save and run the Quickstart code with the name of my switch the log only shows that it has been turn on and doesnt show my log message.
return {
on = {
devices = {
'switch'
}
},
execute = function(domoticz, switch)
if (switch.state == 'On') then
domoticz.log('Hey! I am on!')
else
domoticz.log('Hey! I am off!')
end
end
}
}I have already set the local network to 127.0.0.1 and enabled dzVents.
Does anyone now what is happening? -
First, make sure your switch is really named 'switch', the scripts are case sensitive, so neither 'Switch' nor 'SWITCH' will work. Also, verify you don't have a trailing space in the name ('switch ').
To check your script is run when the device is changed, add a domoticz.log first line in the execute function.
Hope this helps. -
the problem is "if (switch.state == 'On') then" that not works, write:
if (switch.active) thenor
if (switch.inActive) then
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login