Page 1 of 1

Prevent a device from being turned on

Posted: Thursday 13 September 2018 0:31
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 :)

Re: Prevent a device from being turned on

Posted: Thursday 13 September 2018 0:53
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 ?

Re: Prevent a device from being turned on

Posted: Thursday 13 September 2018 13:13
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.

Re: Prevent a device from being turned on

Posted: Thursday 13 September 2018 15:30
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


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

Posted: Sunday 16 September 2018 13:18
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! :)