Ignore device events that are triggered by a script

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

Moderator: leecollings

Post Reply
blooop
Posts: 5
Joined: Monday 12 February 2018 19:33
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Ignore device events that are triggered by a script

Post by blooop »

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?
dannybloe
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

Post by dannybloe »

Use .silent(). See the docs.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
blooop
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

Post by blooop »

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)
dannybloe
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

Post by dannybloe »

Which version of dzvents are you using?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
blooop
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

Post by blooop »

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.
blooop
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

Post by blooop »

Do you know if there is a workaround for this earlier version of dzvents?
dannybloe
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

Post by dannybloe »

No because the Domoticz version doesn’t support this at all.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
jake
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

Post by jake »

blooop wrote:Do you know if there is a workaround for this earlier version of dzvents?
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 variable
blooop
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

Post by blooop »

jake wrote: Wednesday 14 February 2018 13:38 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 variable
Thanks, I've got something working now using this method.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest