2. automation doesn’t show up

Hello,
I trying to figure out how automation working.
i get to work my my first automation, but when i added a second one it even not show up in the gui.
I checked several automations.yaml file, but i cannot able to figure out what might be a problem

/config/automations.yaml

id: bf
alias: "When button off turn off led1"
initial_state: true
trigger:
    platform: state
    entity_id: sensor.Kapcsolo_1
    to: 'OFF'
condition: 
  condition: state
  entity_id: switch.Test_2
  state: 'on'
action:
  service: switch.turn_off
  entity_id: switch.Test_2

id: w
alias: "When button on turn on led1"
initial_state: true
trigger:
    platform: state
    entity_id: sensor.Kapcsolo_1
    to: 'on'
condition: 
  condition: state
  entity_id: switch.Test_2
  state: 'OFF'
action:
  service: switch.turn_off
  entity_id: switch.Test_2

It depends on how you reference automations.yaml from configuration.yaml, but more than likely you need to add dashes to create a list of automations:

- id: bf
  alias: "When button off turn off led1"
  initial_state: true
  trigger:
      platform: state
      entity_id: sensor.Kapcsolo_1
      to: 'OFF'
  condition: 
    condition: state
    entity_id: switch.Test_2
    state: 'on'
  action:
    service: switch.turn_off
    entity_id: switch.Test_2

- id: w
  alias: "When button on turn on led1"
  initial_state: true
  trigger:
      platform: state
      entity_id: sensor.Kapcsolo_1
      to: 'on'
  condition: 
    condition: state
    entity_id: switch.Test_2
    state: 'OFF'
  action:
    service: switch.turn_off
    entity_id: switch.Test_2
1 Like

Unfortunately it doesn’t worked :(.
I referencing the file like this:

automation: !include automations.yaml

Can you expand on “doesn’t work”? Do you get any errors (on the Info page or in home-assistant.log)? Do you see the automations listed on the States page?

Sorry i must done something wrong.
Checked again in the morning and it is fine :slight_smile:
Thank you for your help!

1 Like