Page 1 of 1

Timer does not function

Posted: Tuesday 04 August 2020 13:36
by PeterB1
I have made a testscript in DzVents. The script runs Oke, but the timer does not work. Looking at the logfile it gives almost every minute a result. Also changing the timer in a fixed time does not work. What do I wrong.

Code: Select all

return {

        on =
        {
            timer = {' every 5 minutes '},
            devices = {'Windmeter','Kl Slaapkamer Barometer'}
        },
        execute = function(domoticz)
            local windrichting = domoticz.devices('Windmeter').directionString
            local temperatuur = domoticz.devices('Windmeter').temperature
            local luchtdruk = domoticz.devices('Kl Slaapkamer Barometer').barometer
            domoticz.log('windrichting = ' .. tostring(windrichting))
            domoticz.log('luchtdruk = ' .. tostring(luchtdruk))
            domoticz.log('temperatuur = ' .. tostring(temperatuur))
        end
}

Re: Timer does not function  [Solved]

Posted: Tuesday 04 August 2020 13:52
by waaren
PeterB1 wrote: Tuesday 04 August 2020 13:36 I have made a testscript in DzVents. The script runs Oke, but the timer does not work. Looking at the logfile it gives almost every minute a result. Also changing the timer in a fixed time does not work. What do I wrong.
Just tested your script and it executes every 5 minutes. Tested on domoticz build 12230 / dzVents 3.0.11
What is your domoticz/dzVents version and what do you see in the log? (added debug logging)

Code: Select all

return {

        on =
        {
            timer = {' every 5 minutes '},
            devices = {'Windmeter','Kl Slaapkamer Barometer'}
        },
    
    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'timer 5 minutes',
    },

    execute = function(domoticz)
        local windrichting = domoticz.devices('Windmeter').directionString
        local temperatuur = domoticz.devices('Windmeter').temperature
        local luchtdruk = domoticz.devices('Kl Slaapkamer Barometer').barometer
        domoticz.log('windrichting = ' .. tostring(windrichting))
        domoticz.log('luchtdruk = ' .. tostring(luchtdruk))
        domoticz.log('temperatuur = ' .. tostring(temperatuur))
    end
}

Re: Timer does not function

Posted: Tuesday 04 August 2020 14:14
by PeterB1
Versions:

Version: 2020.2
Build Hash: b63341bc0
Compile Date: 2020-04-26 13:47:55
dzVents Version: 3.0.2

log from Domoticz (you can see that it logs within a minute):

Code: Select all

 2020-08-04 14:12:23.027 Status: EventSystem: reset all events...
2020-08-04 14:12:23.029 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/test.lua
2020-08-04 14:12:24.034 (RFXcom) Wind (Windmeter)
2020-08-04 14:12:24.202 Status: dzVents: Info: Handling events for: "Windmeter", value: "236.00;SW;9;12;26.7;26.7"
2020-08-04 14:12:24.202 Status: dzVents: Info: ------ Start internal script: test: Device: "Windmeter (RFXcom)", Index: 75
2020-08-04 14:12:24.203 Status: dzVents: Info: windrichting = SW
2020-08-04 14:12:24.203 Status: dzVents: Info: luchtdruk = 1022
2020-08-04 14:12:24.203 Status: dzVents: Info: temperatuur = 26.7
2020-08-04 14:12:24.203 Status: dzVents: Info: ------ Finished test
2020-08-04 14:12:25.535 (RFXcom) Temp (Unknown)
2020-08-04 14:12:27.716 (RFXcom) Temp + Humidity (Temp Buiten)
2020-08-04 14:12:33.623 (RFXcom) Temp + Humidity (Temp Tuinkamer)
2020-08-04 14:12:36.794 (RFXcom) Rain (Regenmeter)
2020-08-04 14:12:38.169 (RFXcom) Temp + Humidity (Temp Woonkamer)
2020-08-04 14:12:46.606 (RFXcom) Temp + Humidity (Temp Badkamer)
2020-08-04 14:12:57.025 (RFXcom) Wind (Windmeter)
2020-08-04 14:12:57.130 Status: dzVents: Info: Handling events for: "Windmeter", value: "259.00;WSW;9;11;26.7;26.7"
2020-08-04 14:12:57.130 Status: dzVents: Info: ------ Start internal script: test: Device: "Windmeter (RFXcom)", Index: 75
2020-08-04 14:12:57.131 Status: dzVents: Info: windrichting = WSW
2020-08-04 14:12:57.131 Status: dzVents: Info: luchtdruk = 1022
2020-08-04 14:12:57.131 Status: dzVents: Info: temperatuur = 26.7
2020-08-04 14:12:57.131 Status: dzVents: Info: ------ Finished test 

Re: Timer does not function

Posted: Tuesday 04 August 2020 15:14
by waaren
PeterB1 wrote: Tuesday 04 August 2020 14:14 log from Domoticz (you can see that it logs within a minute):

2020-08-04 14:12:24.202 Status: dzVents: Info: ------ Start internal script: test: Device: "Windmeter (RFXcom)", Index: 75
What you see here is that the script was triggered because of an update to the Windmeter device.

If the script is triggered by the timer you will see

----- Start internal script: Script #5:, trigger: " every 5 minutes "

You setup the script to trigger on both a timer ('every 5 minutes') as well as on the devices 'Windmeter' and 'Kl Slaapkamer Barometer'
so if the Windmeter receives an update once a minute and the Barometer once every 2 minutes your script will be triggered 17 times in 10 minutes.

2 times because of the timer
5 times because of an update to the Barometer device
10 times because of an update to the WindMeter device