Input select not triggering automation

I use this automation to boost my heating. And It used to work perfectly. I haven’t used it for 6 months and now it is not triggering. It is enabled.

- id: lounge_powerful_heat_on
  alias: 'Lounge Powerful Heat On'
  initial_state: true
  trigger:
  - platform: state
    entity_id: input_select.lounge_ac_mode
    to: 'Normal Heat'
    for:
      minutes: 30
  - platform: state
    entity_id: binary_sensor.lounge_ac_heat_required
    to: 'on'
    for:
      minutes: 5
  condition:
  - condition: state
    entity_id: binary_sensor.lounge_ac_heat_required
    state: 'on'
  - condition: state
    entity_id: input_select.lounge_ac_mode
    state: 'Normal Heat'
  action:
    service: input_select.select_option
    data:
      entity_id: input_select.lounge_ac_mode
      option: "Powerful Heat"

Input select:

lounge_ac_mode:
  name: Upstairs AC Mode
  options:
  - 'Off'
  - Powerful Heat
  - Normal Heat
  - Silent Heat
  - Powerful Cool
  - Normal Cool
  - Silent Cool
  icon: mdi:air-conditioner

If it trigger the automation manually with the conditions enabled in the developer tools it works as expected. So the conditions and actions are fine.

However if I change the input select to “Normal Heat”, and heating is still required 30 minutes later, it does not trigger.

input_sel

Screenshot_2020-08-12 Overview - Home Assistant

I’ve tried reloading input selects and restarting. No change. This particular automation and another just like it for downstairs refuse to trigger after 30 minutes.

I thought it might be a problem with input selects generally so I created a new input select and automation that mimicked the above automation but that worked.

I know there have been a lot of changes to input ‘helpers’ but why one created before these changes does not work as a trigger but one created after does baffles me. Especially as they were both created using yaml.

And now it’s working. :confused:?

Though I have no idea why.

You’ve got to be careful with that reloading of stuff. E.g., the input select might go away for a very brief time which could cause the trigger to restart. Or reloading automations will cause all triggers of all automations to reinitialize.

Thanks for the warning Phil. I only did it after everything else I tried had failed.

If you want to be able to figure out why it’s not triggering (assuming it happens again) I’d suggest setting your logger like this:

logger:
  info: default
  logs:
    homeassistant.core: debug

Then when the problem occurs everything that can explain why should be in home-assistant.log. And, if it helps, I have a script that will extract state_changed events from the log for entities you care about (including attributes you care about) and print them out with timestamps. That can often help to understand what happened. (I find it easier than querying the database, but if you’re familiar with that, that can help, too.)

given the topics we discussed lately, I would most certainly be interested…was looking for something like that tbh, without exactly knowing what ;-(

if you would share, Id be most appreciative.

https://github.com/pnbruckner/homeassistant-config/blob/0682cd8b69e92177942cbc3a9deb48e231eff68b/tools/state_updates.py

You use it like this:

python3 state_updates.py home-assistant.log entity_id_1 entity_id_2

You can add as many entity ID’s as you like, and after each one you can optionally add attributes. So, e.g.,

python3 state_updates.py home-assistant.log input_select.lounge_ac_mode binary_sensor.lounge_ac_heat_required automation.lounge_powerful_heat_on last_triggered

That’s actually how I discovered it was working again. Reading through the debug logs I noticed it had been triggered.