We now have Profiles to use between our Items and Channels. I want to discuss if it is possible and useful to use a profile to delay commands to be sent to the channels.
I use Timers (and sometimes the expire binding) to delay actions pretty often in my “smart” (as in “hands-off, no manual control needed”) setup of openHAB. Some of the everyday-life examples:
-
Turn on small lights instantly when entering a room or walking by
-
Turn on the big lights only if people stay there for more than 20 seconds (using Timers)
-
Switch HiFi-peripherals/TV ON/OFF only if the AV Receiver Input stays for 3 seconds (using Timers, for debouncing the Input-Knob-Turning)
-
Consider “everyone asleep” only if there is no motion for some time (using Timers)
I have timers all over the place and they do almost the same thing over and over but are implemented in so many different places and with different parameters. Would this be a thing we could control using the new Profiles feature? The description says With Profiles, you’re able to change the behavior how Channels interact with your Items. so I would assume I could use it to have the Item receive the command, but delay sending it to the Channel, re-check the Item’s state and only send the Command to the Channel if the Channel’s state is still the same? Like this:
Using the first example from above:
- Person entered living room, grabs something, and leaves. Living Room PIR updated to ON
- Rule sends Command=ON to lights through “delayed action”-Profile
- Item is ON but lights stay off to obey the delay
- Living Room PIR updated to OFF
- *Rule sends Command=OFF to lights (but they are still OFF, physically)
- Delayed action times out
- Profile will now send the current Item State to the Channel
- Channel receives command OFF (or nothing, because it’s the same as before)
Or - if the person stays in the room:
- Person entered living room, stays, keeps triggering the PIR, so it stays ON for a long time. Living Room PIR updated to ON
- Rule sends Command=ON to lights through “delayed action”-Profile
- Item is ON but lights stay off to obey the delay
- Person is still in the room, PIR is still ON
- Delayed action times out
- Profile will now send the current Item State to the Channel
- Channel receives command ON
I hope this was clear enough. I’m having a hard time explaining this correctly. Please ask, if I left out any details or am too unclear
What do you think? Is this something we could generalize using profiles? Is it too hacky? Is it more hacky than using Timers?