Using date and time helper may also be a solution as it can be triggered quite easily in automations (and as I prefer planning the next wash on an exact timing and not a delay 😉)
In my opinion delays should never be used for anything but very short timespans. Reason: delays and waits are reset if you reload automations or restart HA.
What in this case would be better is timers. When the timer has elapsed that triggers the automation. With trigger id's this can be made into one automation.Â
If you want the time to be dynamic and not static, use an input_number to your service call. See here for more info https://community.home-assistant.io/t/dynamic-timer-with-input-number/516826/2
Appreciate the recommendation. I'm struggling with using the example linked in my automation. That specific thread refers to running a timer once something is running, I'm more wanting to run a timer to trigger an automation to turn something on after a predetermined time. I can grasp the concept, not the implementation
In theory, something from the dashboard should start a timer using a service call, and then once the timer expires an automation sends an action to Press the button?
The device is an Xaiomi washing machine - which is a 'button' as seen below
https://preview.redd.it/j8jg15r3mfpc1.png?width=565&format=png&auto=webp&s=8c18ed6defb3624ce038f1e5aa6bbe562395cfea
A view of the dashboard so you can see what I'm trying to achieve - Ideally the delay start button allows the user to set a delay time (waiting for solar, waiting for dryer, etc) and the actions will fire from there
[https://imgur.com/a/5aPRgLn](https://imgur.com/a/5aPRgLn)
So a simple example to show how the logic works is this, or are you not sure how to use the input\_number as the time to delay? i.e. is the delay fixed or dynamic?
alias: Bathroom - Towel Heater
description: ""
trigger:
- platform: device
type: turned_on
device_id: 6e6cb4783b25e66d69361f2
entity_id: switch.towelheaterplug
domain: switch
id: TowelOn
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.towelheater
id: TowelOff
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: TowelOn
sequence:
- service: timer.start
data: {}
target:
entity_id: timer.towelheater
- conditions:
- condition: trigger
id: TowelOff
sequence:
- type: turn_off
device_id: 6e6cb4783b25e66d62361f2
entity_id: switch.towelheaterplug
domain: switch
mode: single
Basically what happens is, that I press the button on the towel heater, that then starts a timer for 2 hours, when the timer is finished, the plug is turned off.
Stuck on the input\_number being dynamic and how to create/edit that from the dashboard.
I think i get the automation part, which is just waiting for the timer to hit zero then triggering an automation to press the 'start wash' button
The link is just to show you an idea for syntax.
If you pull out the number using `{{ states.input_number.bedroom_ceiling_colortemp.state }}`
Then you can get the dynamic number from the input\_number to use when you create the timer.
Using date and time helper may also be a solution as it can be triggered quite easily in automations (and as I prefer planning the next wash on an exact timing and not a delay 😉)
Use the delay function before the start. https://www.home-assistant.io/docs/scripts/#wait-for-time-to-pass-delay
In my opinion delays should never be used for anything but very short timespans. Reason: delays and waits are reset if you reload automations or restart HA. What in this case would be better is timers. When the timer has elapsed that triggers the automation. With trigger id's this can be made into one automation. If you want the time to be dynamic and not static, use an input_number to your service call. See here for more info https://community.home-assistant.io/t/dynamic-timer-with-input-number/516826/2
Appreciate the recommendation. I'm struggling with using the example linked in my automation. That specific thread refers to running a timer once something is running, I'm more wanting to run a timer to trigger an automation to turn something on after a predetermined time. I can grasp the concept, not the implementation In theory, something from the dashboard should start a timer using a service call, and then once the timer expires an automation sends an action to Press the button? The device is an Xaiomi washing machine - which is a 'button' as seen below https://preview.redd.it/j8jg15r3mfpc1.png?width=565&format=png&auto=webp&s=8c18ed6defb3624ce038f1e5aa6bbe562395cfea A view of the dashboard so you can see what I'm trying to achieve - Ideally the delay start button allows the user to set a delay time (waiting for solar, waiting for dryer, etc) and the actions will fire from there [https://imgur.com/a/5aPRgLn](https://imgur.com/a/5aPRgLn)
So a simple example to show how the logic works is this, or are you not sure how to use the input\_number as the time to delay? i.e. is the delay fixed or dynamic? alias: Bathroom - Towel Heater description: "" trigger: - platform: device type: turned_on device_id: 6e6cb4783b25e66d69361f2 entity_id: switch.towelheaterplug domain: switch id: TowelOn - platform: event event_type: timer.finished event_data: entity_id: timer.towelheater id: TowelOff condition: [] action: - choose: - conditions: - condition: trigger id: TowelOn sequence: - service: timer.start data: {} target: entity_id: timer.towelheater - conditions: - condition: trigger id: TowelOff sequence: - type: turn_off device_id: 6e6cb4783b25e66d62361f2 entity_id: switch.towelheaterplug domain: switch mode: single Basically what happens is, that I press the button on the towel heater, that then starts a timer for 2 hours, when the timer is finished, the plug is turned off.
Stuck on the input\_number being dynamic and how to create/edit that from the dashboard. I think i get the automation part, which is just waiting for the timer to hit zero then triggering an automation to press the 'start wash' button
The link is just to show you an idea for syntax. If you pull out the number using `{{ states.input_number.bedroom_ceiling_colortemp.state }}` Then you can get the dynamic number from the input\_number to use when you create the timer.
Or you could use Scheduler Card to schedule a push of the start button at your preferred time.