GPIO sensor automation not triggering on boot

Hi community, I need help to troubleshoot my automation.

My Setup:

I have few chained automations which does not work on home assistant start

  1. GPIO Sensor
binary_sensor:
  - platform: gpiod
    sensors:
    - name: "GPIO Button 7"
      port: 7
      active_low: true
      debounce: 500
  1. Automation [1] – State trigger based on GPIO sensor, this automation toggle input_boolean sensor
automation:
    - alias: Power Grid State
      id: power_grid_state_changed
      trigger:
        - platform: state
          entity_id: binary_sensor.gpiod_gpiod_7_gpio_button_7
      action:
      - choose:
          - conditions:
              - condition: state
                entity_id: binary_sensor.gpiod_gpiod_7_gpio_button_7
                state: "on"
            sequence:
              - service: homeassistant.turn_on
                entity_id: input_boolean.power_grid_state_helper
          - conditions:
              - condition: state
                entity_id: binary_sensor.gpiod_gpiod_7_gpio_button_7
                state: "off"
            sequence:
              - service: homeassistant.turn_off
                entity_id: input_boolean.power_grid_state_helper
  1. Automation [2] – State trigger based on Input Boolean sensor which sends a telegram message
    - alias: Power Grid Telegram Notify
      trigger:
        - platform: state
          entity_id:
            - input_boolean.power_grid_state_helper
      action:
        - service: notify.telegram
          data:
              message: Power State

This automation works fine when Home Assistant is up and running.

But failing when GPIO state was changed offline, so Automation [1] is not triggering despite GPIO sensor reports state change


I was managed to “fix” Automation [1] by adding Home Assistant Started trigger, but the Automation [2] is not triggering.

Any ideas of how to troubleshoot this?

Hassio was retired four and a half years ago.

Pretty sure you do not have “hassio” installed. You have a Home Assistant OS installation.

OK, let me fix that.

I am quite new to this and probably a bit late but I found reading logs was the most beneficial. I put even in some automations extra logfile writes to track what exactly was happening and i found out early on that alot of things are errored and warned in the logs that do not come out at all in the configuration checks.

One other thing is restarting… some things work it seems by just updating the configuration.yaml and doing a reload of it … sometimes it works when doing quick reload, sometimes soft restart and finally when all else fails i do a full reboot which solves some other issues that it seems the restart does not fix. … here is something i found interesting around that :upside_down_face:

Additionally you have in the developer tools not just YAML checks but states area that I also found to be very helpful.