timer device and helpers  [Solved]

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

Moderator: leecollings

Post Reply
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

timer device and helpers

Post by poudenes »

Hi All,

Is it possible to have a timer that get his value from a helper of value stored in global_data?

Code: Select all

devices = {[SwitchTEST]    = { 'at daytime'}},
timer = {'at daytime'},
global_data

Code: Select all

Dag                     = { 'at daytime'}
Nacht                   = { 'at nighttime'}
I want change this. When I need to test some script that are activate only on day or night. I can switch the values in global_data and then everything is reverse from day to night and vs.
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: timer device and helpers  [Solved]

Post by waaren »

poudenes wrote: Thursday 06 June 2019 12:40 Is it possible to have a timer that get his value from a helper of value stored in global_data?
Not directly because domoticz.helpers is not there yet when time is evaluated. Indirect you can get true or false but that will still not enable you to switch around day- and nighttime. Quickest working option I can think of is (in <domoticz dir>/dzVents.runtime/Time.lua) switch lines

Code: Select all

747       if (string.find(rule, 'at nighttime')) then
and

Code: Select all

755        if (string.find(rule, 'at daytime')) then
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: timer device and helpers

Post by poudenes »

Thanks. I will try that solution!
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest