Skip to content

[Bug]: Adding power device causes exception #382

Description

@sshaikh

What happened and in what context?

Installed via KIAUH, I believe it's v2.1.0

I have a working power device in moonraker (a smart plug accessible via home assistant).

When passing this name to the telegram bot config I see an exception and status messages no longer get sent.

relevant config:

[status_message_content]
moonraker_devices: 3d-printer

and moonraker:

[power 3d-printer]
...

If needed, paste the relevant bot log contents here.


2025-12-08 16:16:07,260 - main - ERROR - main.py:1096 - Exception while handling an update:
Traceback (most recent call last):
File "/home/klipper/moonraker-telegram-bot-env/lib/python3.13/site-packages/telegram/ext/_application.py", line 1197, in __create_task_callback
return await coroutine # type: ignore[misc]
^^^^^^^^^^^^^^^
File "/home/klipper/moonraker-telegram-bot-env/lib/python3.13/site-packages/telegram/ext/_handlers/basehandler.py", line 158, in handle_update
return await self.callback(update, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/klipper/moonraker-telegram-bot/bot/main.py", line 185, in status
await status_no_confirm(update.effective_message)
File "/home/klipper/moonraker-telegram-bot/bot/main.py", line 155, in status_no_confirm
mess = await klippy.get_status()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/klipper/moonraker-telegram-bot/bot/klippy.py", line 569, in get_status
message += self._get_power_devices_mess()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/klipper/moonraker-telegram-bot/bot/klippy.py", line 457, in _get_power_devices_mess
if name == self._light_device.name:
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'name'
2025-12-08 16:16:36,336 - main - INFO - main.py:1372 - Shutting down the bot


FWIW I do not have a light device configured.

If needed, paste the relevant bot journal contents here.

As above

What branch does this occur on?

master

Reports only on latest master or development branches!

  • I have updated to latest development/master version before submitting the bug

Metadata

Metadata

Assignees

Labels

Next releaseExtra attention is neededbugSomething isn't working

Projects

Status
In testing

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions