Automation not Initialized

I’ve added a new automation to my HASS install, but it does not get initialized. It’s a fairly simple rule so I’m unsure what the problem is and I’m not sure what to do to debug. All other automations are initialized and functioning properly including other rules depending on the same sensor.

What can I do to figure out why an automation rule is not initialized?

Broken automation:

- alias: "Toilet Motion Off and Diffuser On"
  trigger:
    platform: state
    entity_id: sensor.aeotec_zw100_multisensor_toilet_burglar
    to: '0'
  condition:
    - condition: state
      entity_id: input_boolean.enable_bathroom_automation
      state: 'on'
  action:
    - service: script.turn_on
      data:
        entity_id: script.timed_bathroom_diffuser_on

- alias: "Timer Finished and Diffuser Off"
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.bathroom_diffuser_timer
  action:
    - service: script.turn_on
      data:
        entity_id: script.timed_bathroom_diffuser_off

Working automation using same sensor:

- alias: "Toilet Motion On (Day)"
  initial_state: 'true'
#  hide_entity: true
  trigger:
    platform: state
    entity_id: sensor.aeotec_zw100_multisensor_toilet_burglar
    to: '8'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.bathroom_light_dim
        state: 'off'
      - condition: state
        entity_id: input_boolean.enable_bathroom_automation
        state: 'on'
  action:
    - service: script.turn_on
      data:
        entity_id: script.timed_bathroom_bright

Proof ‘Toilet Motion On (Day)’ is initialized:

INFO (MainThread) [homeassistant.components.automation] Initialized trigger Toilet Motion On (Day)

Proof ‘Toilet Motion Off and Diffuser On’ is not initialized:

[root@host homeassistant]# grep -Hrni diffuser logs/home-assistant.log 
[root@host homeassistant]# 

Can there be automation conflicts? Might some other rule prevent the diffuser rule from running? The working rule is triggered by the sensor state transitioning to ‘8’ whereas the broken automation is triggered by the sensor state transitioning to ‘0’.

I can see the sensor state change in the UI, so I know that the sensor is not the problem.

Any pointers would be greatly appreciated!

Let’s start with the basics, is the automation on? Look at the States page, find the automation and confirm its state is on.

platform: numeric_state Instead of state?

I see your other automation that does work has the same settings… but just an idea

automation.timer_finished_and_diffuser_off off last_triggered: null friendly_name: Timer Finished and Diffuser Off
automation.toilet_motion_off_and_diffuser_on off last_triggered: null friendly_name: Toilet Motion Off and Diffuser On

There’s your answer why the automations aren’t being triggered, they’re off. Turn them on.

Yeah, I just added initial_state: ‘true’ and it seems to be initialized. Thank you for your help!

You’re not obliged to add initial_state: true, you just need to turn it on and the restore feature will take care of the rest.