timer trigger

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

timer trigger

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: timer trigger

Post by waaren »

State returns the string On or Off (case matters)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

Re: timer trigger

Post by devros »

waaren wrote: Thursday 22 March 2018 23:37 State returns the string On or Off (case matters)
Thanks :) that was sooo simple
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: timer trigger

Post by dannybloe »

You can also do: if (domoticz.devices(472).active) then ...
That will internally check for On/Off, Open/Close etc.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest