Switch delay Topic is solved

Moderator: leecollings

Post Reply
StefanWouters
Posts: 14
Joined: Tuesday 18 June 2019 17:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Switch delay

Post by StefanWouters »

I have a script running in DzVents, de scripts runs every time on changes from de P1 device.
I have a switch with a delay time of 120 seconds, the script runs every 10 seconds. On every (10sec) "run" de script restarts the 120 seconds.

is their a possibility get the state of remaining time or an other option?

domoticz.devices (Addition) .switchOn ().checkFirst().afterMin(2)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Switch delay

Post by waaren »

StefanWouters wrote: Saturday 22 June 2019 14:44 I have a script running in DzVents, de scripts runs every time on changes from de P1 device.
I have a switch with a delay time of 120 seconds, the script runs every 10 seconds. On every (10sec) "run" de script restarts the 120 seconds.
Is their a possibility get the state of remaining time or an other option?
I only understand part of your requirement but from what I understand you should look for a solution with either dzVents persistent data or a domoticz uservariable.
If you can elaborate a bit on what you intend to do and share the scripts you already have, I might be able to help.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
StefanWouters
Posts: 14
Joined: Tuesday 18 June 2019 17:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Switch delay

Post by StefanWouters »

I run a script wich is triggerd by f
execute = function(domoticz, triggerItem)
if (triggerItem.isDevice) then

the script wil run every 10 seconds, in the last part of the script (after some calculations) some of the switches needs to be changed

for example 1:
if ((domoticz.data.Huidigverbruik >= 0) and (domoticz.devices (Vrijgave).state == 'On')) then
domoticz.devices (Vrijgave) .switchOff ().checkFirst().afterMin(2)
end

With the time delay i want to preventthat the siwtches change every 10 seconds from on to off
Some switches have a delay of 30 second other have 2 minutes

Because the (example 1) is every 10 seconds true, the 2 minutes delay will restart every 10 seconds....

mamybe their is a way to get the remaining time of is their a state, that de delay time is started.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Switch delay

Post by waaren »

StefanWouters wrote: Saturday 22 June 2019 16:18 With the time delay i want to prevent that the switches change every 10 seconds
Again still guessing what you exactly mean because you only share part of your script but it just might work if you code it like.

Code: Select all

if domoticz.data.Huidigverbruik >= 0  and domoticz.devices(Vrijgave).lastUpdate.secondsAgo > 120  then
      domoticz.devices(Vrijgave).switchOff().checkFirst()
end
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
StefanWouters
Posts: 14
Joined: Tuesday 18 June 2019 17:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Switch delay

Post by StefanWouters »

Problem solved with your solution
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest