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.



  • @boum sadly it didnt work 😞 I made sure that the name of the switch was well written and I added a domoticz.log with a message inside the function and it didnt work.



  • the problem is "if (switch.state == 'On') then" that not works, write:

    if (switch.active) then
    

    or

    if (switch.inActive) then
    

    Device attributes and methods for all devices


Log in to reply
 

Suggested Topics

  • 5
  • 4
  • 3
  • 2
  • 8
  • 1

66
Online

11.4k
Users

11.1k
Topics

112.6k
Posts