#Manipulating a delay

1 messages · Page 1 of 1 (latest)

exotic torrent
#

Heya, let's assume a button that triggers the following:

sequence:
  - call_some_service
  - delay:
      minutes: 30
  - call_some_service

Use case - e.g. boost mode in a house ventilation or hvac:

  • clicking a Start ⏵ button sets current fan speed to maximum (aka boost mode) for a time specified before in a drop down (15/30/45/60 minutes)
  • button text changes to ⏹ Stop + a countdown on the remaining time for the boost
  • pressing the same button again will stop boost mode manually by setting remaining delay to 00:00, button text turns back to Start ⏵
  • no button press / manual stop means boost mode will be switched back automatically to normal mode after the specified delay

Is there an easy way to address/manipulate the delay part while its active, and set remaining minutes e.g. to 00:00?

Or is it better to set up a dedicated timer.my_timer for this and do the whole thing by hand without automations, e.g. by utilizing a custom:button-card with [[[ multi-calls: hass.callService(call_some_service); delay; hass.callService(call_some_service); ]]]?

Appreciate your ideas, thanks in advance! 🙂

/tom

restive quiver
#

I'd say your best bet would be to incorporate the timer entity. IMO it will provide a lot more flexibility in the overall automation. In my automations, when certain lights are turned on, a timer starts. ```yaml
action: timer.start
target:
entity_id: timer.automation_auto_office_lights
data:
duration: >
{{ states.input_number.automation_auto_office_lights_duration.state |
int(0)*60 }}

The design of the card is also going to be important. The [custom:button-card](<https://github.com/custom-cards/button-card>) is going to be the best bet. Remember that it can contain other cards inside which could be useful for handling the START button. (TIP: the custom:button-card can handle templated actions particularly the service calls which most cards cannot. If the timer is running then restart it. if not, start it.) The countdown timer can be a bit tricky. The Entities card is one of the few cards than can handle a real-time countdown. Apply some [card_mod](<https://github.com/thomasloven/lovelace-card-mod>) to it and you can have just the countdown itself visible.
The multi-call option probably would not be best used in your case. In fact, I don't think it is completely supported. IMO, the multi-call is best used when you need to perform two simple actions: turn on a switch entity and turn on a light entity (since you would not be able to perform a turn_on with two different domains) or perhaps a simple delay, like wait 5 seconds and do the next thing. Anything more than that, scripts or automations would be better.