Having trouble with a timer

Hi
I have just started playing with Home Assistant and am trying to implement a timer. It should be easy but I cannot figure out what I have done wrong.

My /config/automations.yaml looks like this

- id: '1631111223314'
  alias: washerOn
  description: ''
  trigger:
  - platform: event
    event_type: timer_finished
    event_data:
    entity_id: timer.10sec
   
  condition: []
  action:
  - type: toggle
    device_id: 204d749d27b4bb09d2ad264db25ea7c5
    entity_id: switch.75216207e0980600b01f
    domain: switch
  mode: single

I cannot get the trigger to work, I have a card to display the timer and it counts down but nothing happens when it reaches zero. I can manually run the automation and it toggles the output, I must just be reading the documentation wrong.
any help much appreciated
Thanks
Mark

You need to correct the Event Trigger.

  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.10sec

Thanks 123 Tatas
It was really late last night and I couldn’t see it! however
Its still not triggering the action, the whole sequence start timer and trigger is

- id: '1631105296444'
  alias: timer
  description: ''
  trigger:
  - platform: device
    type: turned_on
    device_id: 391e113cd53c99515b8fd923bad768b7
    entity_id: switch.my_light_2
    domain: switch
  condition: []
  action:
  - service: timer.start
    data:
      duration: '1'
    target:
      entity_id: timer.10sec
  mode: restart
- id: '1631111223314'
  alias: washerOn
  description: ''
  trigger:
   - platform: event
     event_type: timer.finished
     event_data:
      entity_id: timer.10sec
  condition: []
  action:
  - type: toggle
    device_id: 204d749d27b4bb09d2ad264db25ea7c5
    entity_id: switch.75216207e0980600b01f
    domain: switch
  mode: single

Opps
Did I mention I’m really new to this?
I restarted the core and it started working. Is this something I need to do each time I make a manual change to a config file?
Thanks again

If you make create or modify automations using a text editor, after you save automations.yaml (or configuration.yaml or wherever you are storing automations) you should execute:

Configuration > Server Controls > Check Configuration

If it reports no errors, proceed to execute:

Configuration > Server Controls > Reload Automations

Now your new automation, or modified automation, is loaded into Home Assistant.

When you “restarted the core” you effectively did the same thing except it takes longer. If you create/modify automations using the Automation Editor, it performs the two steps for you the moment you save your changes.

And as a note, still, if you restart your whole HA, versus just reloading the automations yamls, timers with a set time will not allow themselves to be interrupted to continue an automation. I can’t confirm yet that reloading just the yaml will cause the same thing.
I went down a similar road recently, and that happens to me, in case you branch out to make actual timers :slight_smile:
To explain further, here’s the code:

alias: Kitchen Light timer starts
  description: Kitchen Light timer starts
  trigger:
  - platform: state
    entity_id: group.kitchenmotion
    to: 'on'
  condition:
  - condition: or
    conditions:
    - condition: time
      after: '20:00'
    - condition: sun
      before: sunrise
  action:
  - service: timer.start
    data: {}
    target:
      entity_id: timer.kitchen_light_timer
  - type: turn_on
    device_id: 4856f51b9d4f30ebc0d25c555496a473
    entity_id: switch.kitchen_light
    domain: switch
  mode: single

Now, this automation runs in a certain time, and I have 2 motions sensors, in a group together. If either one is interrupted (motion detected) it restarts the timer.
When the timer runs out, the light goes off. ( another automation just to turn off light after timer ends :slight_smile:
All this just to say what I said earlier though :slight_smile: Total restart will not let either sensor restart the timer while running for around 24 hours.

Seeing that the root cause of the problem was incorrect syntax, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps other users find answers to similar questions. For more information refer to the guideline 21 in the FAQ.

Thank you its working well,
one thing about syntax is you can read it 100 times and it looks good until someone else points it out!
Thank you again

1 Like