I wonder if there is an entity type, which could help me solve a common class of problems I’m facing pretty regularly: having something turned on, but only for a period of time. Before commenting that this is doable via automation, blueprints, etc - I know it can. It just seems to me that it would be nice to have a built-in entity type to handle this, and perhaps there already is one, I just don’t know.
Here’s the examples of problems I wanna solved:
My doors are automatically locked via automation. Sometimes I need to turn the automation off for a few hours (house party, etc), and then resume normally.
I have a noisy heat pump, so sometimes I switch heating to propane when I want to watch a movie in quiet. There is an algorithm which I use to determine whether to use a heat pump or gas. I want to be able to create a flag which would tell algorithm to temporarily suspend, and then resume in a couple of hours.
These are the cases, where I could use some control (a button perhaps?) which sets or clears some entity. Something like a date-time flag set for 2 hours in future. And in 2 hours it should auto-clear, so that UI control could reflect that. But automation should also have access to this flag, and if it exists, skip a pass.
Again, I am capable of designing a complex automation which would do just that, but I’d rather have something very simple, where I could deploy, change, and delete the whole shebang cleanly
Any ideas how to implement it in generic and elegant way?
triggers:
- trigger: state
entity_id: switch.foobar
to: 'on'
for:
minutes: 42 # can be an input number if you want to make it configurable
actions:
- action: switch.turn_off
target:
entity_id: switch.foobar
Tom, I’m not trying to be annoying or to request people do work for me. I just thought something like that might have been taken care of already. If not, this is fine, I just asked.
Have your “button” start a timer and add the timer’s state as a condition in you automation.
condition: template
value_template: "{{ not is_state('timer.disable_door_locking', 'active') }}"
Just keep in mind, especially if there are time-based triggers for these automations, that you may need to add triggers to compensate for the fact that the timer was blocking execution of the actions during the normal operating time frame.
In theory you could also use Assist to do it by leveraging the conversation.process action…