HA startup automation action that fails during startup but works fine if manually triggered

Hi all,

I have an automation action that usually fails (works on some rare occasion and if ran manually). It is a simple automation that sends a message on Telegram when my Home Assistant Green starts.

Versions:

  • Installation method: Home Assistant OS
  • Core: 2026.3.1
  • Supervisor: 2026.02.3
  • Operating System: 17.1
  • Frontend: 20260304.0

The automation YAML in question:

alias: "Notify: HA start"
description: ""
triggers:
  - event: start
    trigger: homeassistant
conditions: []
actions:
  - action: input_boolean.turn_on
    metadata: {}
    target:
      entity_id: input_boolean.startup_triggered
    data: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - action: telegram_bot.send_message
    metadata: {}
    data:
      message: "{{ now().strftime('%Y-%m-%d %H:%M.%S') }} | Home Assistant Green started"
      entity_id:
        - notify.telegram_bot_6111111111_1111111111111
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - action: input_boolean.turn_off
    metadata: {}
    target:
      entity_id: input_boolean.startup_triggered
    data: {}
mode: single

Under Automation Traces, I get this:

Telegram bot ‘Send message’
Executed: March 10, 2026 at 08:38:38
Error: ‘ConfigEntry’ object has no attribute ‘runtime_data’
Result:
params:
domain: telegram_bot
service: send_message
service_data:
message: 2026-03-10 08:38.38 | Home Assistant Green started
entity_id:
- notify.telegram_bot_6111111111_1111111111111
target: {}
running_script: false

Step config
action: telegram_bot.send_message
metadata: {}
data:
message: ‘{{ now().strftime(’‘%Y-%m-%d %H:%M.%S’‘) }} | Home Assistant Green started’
entity_id:
- notify.telegram_bot_6111111111_1111111111111

Under System Log I have this:

Logger: homeassistant.components.automation.ha_notify_start
Source: helpers/script.py:531
integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 08:38:38 (1 occurrence)
Last logged: 08:38:38

Notify: HA start: Error executing script. Unexpected error for call_service at pos 3: 'ConfigEntry' object has no attribute 'runtime_data'

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 531, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1018, in _async_step_call_service response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<9 lines>... ) ^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 631, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2817, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2860, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/telegram_bot/__init__.py", line 477, in _async_send_telegram_message service, target_config_entry.runtime_data, target_chat_id ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'ConfigEntry' object has no attribute 'runtime_data'

I don’t quite understand what’s wrong and why this only fails during startup. I tried adding delay thinking it needs time to “startup” but the delay doesn’t solve the issue.

If anyone can help, it is appreciated. Thanks.

Seems like Claude AI confirms it is a bug with the Telegram integration. Going to try this suggested fix.

Fix 1: Wait for Telegram to be Ready (Recommended)

Instead of a fixed delay, use a template condition that waits until the Telegram integration is actually loaded before proceeding:

alias: "Notify: HA start"
triggers:
  - event: start
    trigger: homeassistant
conditions: []
actions:
  - action: input_boolean.turn_on
    target:
      entity_id: input_boolean.startup_triggered
  - wait_template: >
      {{ integration_entities('telegram_bot') | select('in', states | map(attribute='entity_id') | list) | list | count > 0 }}
    timeout: "00:02:00"
    continue_on_timeout: false
  - delay:
      seconds: 5
  - action: telegram_bot.send_message
    data:
      message: "{{ now().strftime('%Y-%m-%d %H:%M.%S') }} | Home Assistant Green started"
      entity_id:
        - notify.telegram_bot_6111111111_1111111111111
  - delay:
      seconds: 15
  - action: input_boolean.turn_off
    target:
      entity_id: input_boolean.startup_triggered
mode: single

[quote=“desean, post:2, topic:994520”]
input_boolean.startup_triggered
Why the input_boolean.startup_triggered ?
Just wait 5 second and send your messages.

1 Like

“input_boolean.startup_triggered” is my helper entity, acting as a sensor for me to know when HA recently started. It is used for my other automations.

Then activate that input_boolean in a other separate automation.

Just to share this YAML solves the issue for me.

alias: "Notify: HA start"
triggers:
  - trigger: homeassistant
    event: start
conditions: []
actions:
  - wait_template: >
      {{ 'telegram_bot' in services }}
    timeout: "00:02:00"
    continue_on_timeout: true
  - delay:
      seconds: 5
  - action: telegram_bot.send_message
    metadata: {}
    data:
      message: "{{ now().strftime('%Y-%m-%d %H:%M.%S') }} | Home Assistant Green started"
      entity_id:
        - notify.telegram_bot_6111111111_1111111111111
mode: single

Was this vomited out by AI? The wait_template makes no sense at all and only serves as a 2 minute fixed delay.

services is not defined, so your template returns an error. After two minutes, it times out and continues. It’s identical to:

  - delay:
      seconds: 125

…except that it probably fills your logs with error messages.