Skip to content

AttributeError: 'NoneType' object has no attribute 'id' #143235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
to4ko opened this issue Apr 18, 2025 · 1 comment
Open

AttributeError: 'NoneType' object has no attribute 'id' #143235

to4ko opened this issue Apr 18, 2025 · 1 comment

Comments

@to4ko
Copy link

to4ko commented Apr 18, 2025

The problem

starting couple releases ago this error popped up.

tryed both configurations

  1. with telegram_bot.send_photo (with and without timeout
      - action: telegram_bot.send_photo
        data:
          url: http://localhost:1984/api/frame.jpeg?src=g5_yard #!secret yard_snap
          caption: "\U0001f4f7 Yard {{states('sensor.time')}} {{states('sensor.date')}}"
          target: !secret tel_chat_id_cam
          #timeout: 180
  1. with notify
      - action: notify.telegram_cam
        data:
          #title: "Send an images"
          message: "Yard"
          data:
            photo:
              - url: http://localhost:1984/api/frame.jpeg?src=g5_yard #!secret street_snap
                caption: "\U0001f4f7 Yard {{states('sensor.time')}} {{states('sensor.date')}}"

both are giving errors

What version of Home Assistant Core has the issue?

core-2025.4.2

What was the last working version of Home Assistant Core?

core-2024.12.x (maybe core-2025.1.x)

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

telegram_bot, telegram

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

error message in case of config 1 (tlegram_bot.send_photo"

2025-04-18 17:34:51.678 ERROR (MainThread) [homeassistant.components.automation.system_snapshot_street] While executing automation automation.system_snapshot_street
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 717, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        variables, trigger_context, started_action
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1827, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    self._handle_exception(
    ~~~~~~~~~~~~~~~~~~~~~~^
        ex, continue_on_error, self._log_exceptions or log_exceptions
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 556, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 524, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1008, in _async_step_call_service
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2794, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/__init__.py", line 428, in async_send_telegram_message
    messages = await notify_service.send_file(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        msgtype, context=service.context, **kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/__init__.py", line 981, in send_file
    msg_ids[chat_id] = msg.id
                       ^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'


error message in case of notify

2025-04-18 18:05:53.325 ERROR (MainThread) [homeassistant.components.telegram_bot] Error sending photo: Timed out. Args: (), kwargs: {'chat_id': -1001923224659, 'photo': <_io.BytesIO object at 0x7f68b7404400>, 'caption': '📷 Dixy 18:05 2025-04-18', 'disable_notification': False, 'reply_to_message_id': None, 'reply_markup': None, 'read_timeout': None, 'parse_mode': <ParseMode.HTML>, 'message_thread_id': None}
2025-04-18 18:05:53.327 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall telegram_bot.send_photo (xxxxxxxxxxxxxY): target=[-xxxxxxxxx], message=, url=http://localhost:1984/api/frame.jpeg?src=g5_xxxxx, caption=📷 18:05 2025-04-18>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2814, in _run_service_call_catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/__init__.py", line 428, in async_send_telegram_message
    messages = await notify_service.send_file(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        msgtype, context=service.context, **kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/components/telegram_bot/__init__.py", line 981, in send_file
    msg_ids[chat_id] = msg.id
                       ^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'

Additional information

No response

@home-assistant
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants