Page 1 of 1

timer trigger

Posted: Thursday 22 March 2018 23:24
by devros
hello i did simple script that shoud write to log, when is some device on or off at specific time
but only START TEST is displayed on log
tried few things but cant figure out what could be wrong

thanks

Code: Select all

return {
    active = true,
    on = {
        timer = {'at 23:09'}
    },

    execute = function(domoticz)
        domoticz.log('START_TEST', domoticz.LOG_FORCE)
        if (domoticz.devices(472).state == 'on') then
			domoticz.log('on', domoticz.LOG_FORCE)
        elseif (domoticz.devices(472).state == 'off') then
            domoticz.log('off', domoticz.LOG_FORCE)
        end
    end
}
when i add code to report state

Code: Select all

domoticz.log(domoticz.devices(472).state, domoticz.LOG_FORCE)
in log is: dzVents: !Info: On

Re: timer trigger

Posted: Thursday 22 March 2018 23:37
by waaren
State returns the string On or Off (case matters)

Re: timer trigger

Posted: Friday 23 March 2018 15:31
by devros
waaren wrote: Thursday 22 March 2018 23:37 State returns the string On or Off (case matters)
Thanks :) that was sooo simple

Re: timer trigger

Posted: Friday 23 March 2018 15:36
by dannybloe
You can also do: if (domoticz.devices(472).active) then ...
That will internally check for On/Off, Open/Close etc.