Manual timer in frontend

I already tried that but with no effct.

When I add the template sensor {{states.timer.mytimer.state}} I get only “Idle”.

I found a solution, just adding the entity to my lovelace ui:

  • type: entities
    title: Washing!
    show_header_toggle: false
    entities:
    • timer.washing

timer.washing displays the remaining time. No other code needed.

1 Like

Hello
can be used with any entity?
thanks

Hello everyone,

He added a configuration to my configuration.yaml and in entities he selected this, but he won’t get the counter operated, could he help me?

image

Hello, i try the same but don’t manage to get it work.

Automatisation:
  alias: Arrosage
  trigger:
  - entity_id: input_boolean.test
    platform: state
  condition: []
  action:
  - data:
    entity_id: timer.arrosage
    service: timer.start
      data_template:
        duration: '{{states.input_number.duree_arrosage | int }}'

Can anyone please help me?

You may have solved this by now but, you need to delete - data: from the action. You could use File editor to access the automations.yaml.

I search all the week, try everithing but not this :sob:, thanks men, you rock!!
The solution:

Automatisation:
  alias: Arrosage
  trigger:
  - entity_id: input_boolean.test
    platform: state
  condition: []
  action:
  - data_template:
           duration: '{{states.input_number.duree_arrosage | int }}'
    entity_id: timer.arrosage
    service: timer.start

I talk to early, it don’t take the duration of the input number.

I think it should be '{{states.input_number.duree_arrosage.state | int }}'

note the addition of .state

Thanks a lot. It work perfectly this time

Automatisation:
  alias: Arrosage
  trigger:
  - entity_id: input_boolean.test
    platform: state
  condition: []
  action:
  - data_template:
           duration: '{{states.input_number.duree_arrosage.state | int }}'
    entity_id: timer.arrosage
    service: timer.start

I try to improve it with input_datetime, but the timer get immediatly in idle position

  - data_template:
           duration: "{{states.input_datetime.arrosage_manuel.state | int| timestamp_custom('%HH:%MM', False) }}"

:disappointed_relieved:

Here’s a topic that could resolve your problem: -

It appears you just need to use {{states.input_datetime.arrosage_manuel.state}}.

just for my OCD (and YAML’s) you should work on a 2xspace principle as well, so

 - data_template:
           duration: "{{states.input_datetime.arrosage_manuel.state}}"

should be

 - data_template:
     duration: "{{states.input_datetime.arrosage_manuel.state}}"

An alternative solution is to use an input_datetime as your trigger i.e. set the time for when your timer should end.

  trigger:
  - platform: template
    value_template: '{{ states(''sensor.time'') == (state_attr(''input_datetime.arrosage_manuel'',
      ''timestamp'') | int | timestamp_custom(''%H:%M'', False)) }}'

Your input_boolean (or the state change of the input_datetime) could just turn the automation on. You could add an action at the end to turn the automation off again, so it doesn’t trigger daily.

This has the added bonus that a restart of Home Assistant won’t affect this working. If Home Assitant is just counting down a duration and Home Assistant restarts then the duration will be forgotten.

It work.
Thanks for your time.

Thanks! This works great!

Another way to achieve this is by using the Automation action “Wait for time to pass (delay)” and change the delay setting to reference your input_number.state as such:

delay:
  milliseconds: '{{ states.input_number.remote_pulse_time.state | int }}'

You’ll have to swap from the visual editor to the YAML editor to modify it but this is an easy way to achieve the solution.

Be aware that automation delays don’t survive a reboot.

I’m assuming you mean the accumulated delay doesn’t survive? As in the current count of the delayed time will reset to 0 on a reboot, not the preset delay time.

Correct, when you set a delay in an automation a reboot will reset the delay but also anything that was supposed happen after the delay will also not happen. This may/may not be a problem for some but if you want to ensure your delayed action happens it’s better to setup a Timer helper that is started, which will survive a reboot, and then you can trigger based on that timer finishing.

1 Like

Got ya. Good bit of advice to be aware of. Thank @timnolte.

Hi, any of you have issue with this automation after updating to 2023.10.1 to 5?