I have a relay that is triggered by a timer, and also by a hardware event (a button press). If the relay is turned on by the timer script, the device script will fire again. The problem is that I have no way of distinguishing when I physically press the relay button vs when my timer script turns the relay on or off.
I want to use the button to set a user variable that enables and disables that relay.
I have thought of a hacky way around this. I could have the timer script record when it switched the relay state. When the device event fires directly after the timer script I could ignore that event and not set the user variable. The problem is that if I go to press the button and the timer event happen to have run recently, it will ignore my button press.
Is there a less hacky solution to this problem?
Ignore device events that are triggered by a script
Moderator: leecollings
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Ignore device events that are triggered by a script
Use .silent(). See the docs.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 5
- Joined: Monday 12 February 2018 19:33
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Ignore device events that are triggered by a script
Thanks for the fast reply. I'm sorry I missed that section of the docs before.
I've tried appending the silent command to the switchOn() function:
domoticz.devices(dev .. ' Radiator').switchOn().silent()
but it crashes with the error:
attempt to call field 'silent' (a nil value)
I've tried appending the silent command to the switchOn() function:
domoticz.devices(dev .. ' Radiator').switchOn().silent()
but it crashes with the error:
attempt to call field 'silent' (a nil value)
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Ignore device events that are triggered by a script
Which version of dzvents are you using?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 5
- Joined: Monday 12 February 2018 19:33
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Ignore device events that are triggered by a script
Ah, that must be it. I'm on:
Domoticz 3.8153
Dzvents 2.2.0
and silent() was added in 2.3.0.
I did check for updates but it says there are none available. It might be because I'm running on a synoloy.
Domoticz 3.8153
Dzvents 2.2.0
and silent() was added in 2.3.0.
I did check for updates but it says there are none available. It might be because I'm running on a synoloy.
-
- Posts: 5
- Joined: Monday 12 February 2018 19:33
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Ignore device events that are triggered by a script
Do you know if there is a workaround for this earlier version of dzvents?
-
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Ignore device events that are triggered by a script
No because the Domoticz version doesn’t support this at all.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 744
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: Ignore device events that are triggered by a script
A workaround is to let your script set a variable (or dzVents: persistent data), which you can check when you manually switch. In that case there will be no update of the variableblooop wrote:Do you know if there is a workaround for this earlier version of dzvents?
Who is online
Users browsing this forum: No registered users and 1 guest