Prevent a device from being turned on  [Solved]

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

Moderator: leecollings

Post Reply
jannnfe
Posts: 30
Joined: Tuesday 30 January 2018 0:27
Target OS: Linux
Domoticz version: Beta
Location: Germany
Contact:

Prevent a device from being turned on

Post by jannnfe »

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: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Prevent a device from being turned on

Post by waaren »

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 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
jannnfe
Posts: 30
Joined: Tuesday 30 January 2018 0:27
Target OS: Linux
Domoticz version: Beta
Location: Germany
Contact:

Re: Prevent a device from being turned on

Post by jannnfe »

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: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Prevent a device from being turned on

Post by waaren »

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

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
jannnfe
Posts: 30
Joined: Tuesday 30 January 2018 0:27
Target OS: Linux
Domoticz version: Beta
Location: Germany
Contact:

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

Post by jannnfe »

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: Google [Bot] and 1 guest