Page 1 of 1

timer: 'between aa and bb' not working

Posted: Monday 05 February 2018 19:31
by Aad3229
I am on beta 3.8873. I have this script:

Code: Select all

local ESP1_Lux = 111

return {
    on = {
          devices = {[ESP1_Lux] = {'between 06:00 and 16:00', 'every 3 minutes'}}
         },
    execute = function(domoticz)
        --domoticz.devices(ESP1_Lux).dump()
        domoticz.log(domoticz.devices(ESP1_Lux).lux)
        if domoticz.devices(ESP1_Lux).lux < 160 and
        (domoticz.time.hour >= 16 and domoticz.time.hour <= 23) and
        domoticz.variables('IsDarkLux').value == 0 then
            domoticz.devices(IsDonkerS).switchOn()
            domoticz.variables('IsDarkLux').set(1)
        end
        if domoticz.devices(ESP1_Lux).lux > 170 and
        (domoticz.time.hour >= 16 and domoticz.time.hour <= 23) and
            domoticz.variables('IsDarkLux').value == 1 then
            domoticz.devices(IsDonkerS).switchOff()
            domoticz.variables('IsDarkLux').set(0)
        end
        if domoticz.devices(ESP1_Lux).lux < 120 and
        (domoticz.time.hour >= 4 and domoticz.time.hour < 16) and
        domoticz.variables('IsDarkLux').value == 0 then
            domoticz.devices(IsDonkerS).switchOn()
            domoticz.variables('IsDarkLux').set(1)
        end
        if domoticz.devices(ESP1_Lux).lux > 130 and
        (domoticz.time.hour >= 4 and domoticz.time.hour < 16) and
        domoticz.variables('IsDarkLux').value == 1 then
            domoticz.devices(IsDonkerS).switchOff()
            domoticz.variables('IsDarkLux').set(0)
        end
    end
}
This cript is running every 3 minutes, still even now (it is 19:25 and way past 16:00) with this output:

Code: Select all

2018-02-05 19:21:21.975 dzVents: Info: Handling events for: "Lux sensor Esp", value: "0.00"
2018-02-05 19:21:21.976 dzVents: Info: ------ Start internal script: dzV_Check_Lux: Device: "Lux sensor Esp (Dummy)", Index: 111
2018-02-05 19:21:21.976 dzVents: Info: 0
2018-02-05 19:21:21.976 dzVents: Info: ------ Finished dzV_Check_Lux
2018-02-05 19:24:22.134 dzVents: Info: Handling events for: "Lux sensor Esp", value: "0.00"
2018-02-05 19:24:22.134 dzVents: Info: ------ Start internal script: dzV_Check_Lux: Device: "Lux sensor Esp (Dummy)", Index: 111
2018-02-05 19:24:22.134 dzVents: Info: 0
2018-02-05 19:24:22.135 dzVents: Info: ------ Finished dzV_Check_Lux
2018-02-05 19:27:22.306 dzVents: Info: Handling events for: "Lux sensor Esp", value: "0.00"
2018-02-05 19:27:22.306 dzVents: Info: ------ Start internal script: dzV_Check_Lux: Device: "Lux sensor Esp (Dummy)", Index: 111
2018-02-05 19:27:22.306 dzVents: Info: 0
2018-02-05 19:27:22.307 dzVents: Info: ------ Finished dzV_Check_Lux
It should only run between 06:00 and 16:00. Why doesn't it stop running at 16:00? What am I doing wrong here?

Re: timer: 'between aa and bb' not working

Posted: Monday 05 February 2018 20:07
by Aad3229
Solved, It should be :

'every 3 minutes between 06:00 and 16:00'

In my first post it runs: between 06:00 and 16:00 AND every 3 minutes