Prevent a device from being turned on  [Solved]

Easy to use, 100% Lua-based event scripting framework.
Post Reply
jannnfe
Posts: 22
Joined: Tuesday 30 January 2018 1:27
Target OS: Linux
Domoticz version: Beta
Location: Germany
Contact:

Prevent a device from being turned on

Post by jannnfe » Thursday 13 September 2018 0:31

Hello,
I have been thinking for some time about a possibility of preventing a particular device from switching on. Use Case: The postman has brought mail and opens the mailbox. The contact sensor sends "mailbox open". The postman has forgotten a letter and opens the mailbox again. The sensor should not be activated because it is irrelevant that it has been opened a second time to avoid notification spam. Only after 10 minutes, for example, should the sensor be "unlocked" again.

I thought that maybe the sensor will be set to protected after opening and after 10 minutes it will be unprotected but no solution is found.

Thanks and have a nice day :)

User avatar
waaren
Posts: 930
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Prevent a device from being turned on

Post by waaren » Thursday 13 September 2018 0:53

jannnfe wrote:
Thursday 13 September 2018 0:31
...
preventing a particular device from switching on. Use Case: The postman has brought mail and opens the mailbox. The contact sensor sends "mailbox open". The postman has forgotten a letter and opens the mailbox again. The sensor should not be activated because it is irrelevant that it has been opened a second time to avoid notification spam. Only after 10 minutes, for example, should the sensor be "unlocked" again.
...
would something like

Code: Select all

if (domoticz.devices('mailbox contact sensor').lastUpdate.minutesAgo > 10) then
       notification code here
else
       ignore code here
end
work for you ?
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

jannnfe
Posts: 22
Joined: Tuesday 30 January 2018 1:27
Target OS: Linux
Domoticz version: Beta
Location: Germany
Contact:

Re: Prevent a device from being turned on

Post by jannnfe » Thursday 13 September 2018 13:13

I already had this idea, but I rejected it again because the notifications on my phone are not regulated by Domoticz, but by Homebridge. I use the homebridge-edomoticz plugin and activate notifications in HomeKit for the sensor. The code in the event must therefore prevent the device from sending an "on" or "letterbox open". Simply put the device during the timeout simply do nothing.

User avatar
waaren
Posts: 930
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Prevent a device from being turned on

Post by waaren » Thursday 13 September 2018 15:30

One way dzVents could help here then, is by using a virtual device linked to the notification system. Using a script to update the virtual device based on the actual sensor state and -lastUpdate.

Verstuurd vanaf mijn ONEPLUS A3003 met Tapatalk

Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

jannnfe
Posts: 22
Joined: Tuesday 30 January 2018 1:27
Target OS: Linux
Domoticz version: Beta
Location: Germany
Contact:

Re: Prevent a device from being turned on  [Solved]

Post by jannnfe » Sunday 16 September 2018 13:18

Thanks for the tip. Based on your idea, I was able to successfully realize my goal. I have created a second virtual device "Briefkasten" and called the actual sensor in the mailbox "Breifkasten Dummy". When "Briefkasten Dummy" is opened, I check the latest updates and turn on the virtual device or off if not enough time has passed.
Thank you! :)

Post Reply

Who is online

Users browsing this forum: Maxx and 3 guests