Skip to content

Error creating entity #2486

@yufretti

Description

@yufretti

What happened?

Hi,
fron the version 0.17.11 i can't create entity with AppDaemon in Home Assistant.
For example, I use this command:
self.set_state(entity_id="plc.write_luci_esterne_on", state=0)
And I obtain this error in the log:
2025-11-10 08:25:02.796421 ERROR moxa_sck: ===========================================================================
2025-11-10 08:25:03.839832 INFO moxa_sck: Creo le entita' del PLC su HA
2025-11-10 08:25:03.844366 ERROR HASS: [400] HTTP POST: Bad Request {'attributes': {}}
2025-11-10 08:25:03.844861 ERROR moxa_sck: ===== sckmoxa.main for moxa_sck =========================================
2025-11-10 08:25:03.845202 ERROR moxa_sck: SchedulerCallbackFail: Scheduled callback failed for app 'moxa_sck'
2025-11-10 08:25:03.845377 ERROR moxa_sck: args: ({'__thread_id': 'thread-1'},)
2025-11-10 08:25:03.845515 ERROR moxa_sck: Callback has signature: sckmoxa.main(kwargs)
2025-11-10 08:25:03.845634 ERROR moxa_sck: argument of type 'ClientResponseError' is not iterable
2025-11-10 08:25:03.846094 ERROR moxa_sck: TypeError: argument of type 'ClientResponseError' is not iterable
2025-11-10 08:25:03.847148 ERROR moxa_sck: File "/usr/lib/python3.12/site-packages/appdaemon/threads.py", line 1092, in safe_callback
2025-11-10 08:25:03.847350 ERROR moxa_sck: funcref()
2025-11-10 08:25:03.847493 ERROR moxa_sck: File "/config/apps/moxa_socket.py", line 60, in main
2025-11-10 08:25:03.847615 ERROR moxa_sck: self.Create_HA_Entity()
2025-11-10 08:25:03.847748 ERROR moxa_sck: File "/config/apps/moxa_socket.py", line 996, in Create_HA_Entity
2025-11-10 08:25:03.847863 ERROR moxa_sck: self.set_state(entity_id="plc.write_luci_esterne_on", state=0)
2025-11-10 08:25:03.847973 ERROR moxa_sck: File "/usr/lib/python3.12/site-packages/appdaemon/utils.py", line 289, in wrapper
2025-11-10 08:25:03.848082 ERROR moxa_sck: return run_coroutine_threadsafe(self, coro, timeout=timeout)
2025-11-10 08:25:03.848190 ERROR moxa_sck: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-10 08:25:03.848407 ERROR moxa_sck: File "/usr/lib/python3.12/site-packages/appdaemon/utils.py", line 615, in run_coroutine_threadsafe
2025-11-10 08:25:03.848595 ERROR moxa_sck: return future.result(timeout.total_seconds())
2025-11-10 08:25:03.848780 ERROR moxa_sck: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-10 08:25:03.848969 ERROR moxa_sck: File "/usr/lib/python3.12/concurrent/futures/_base.py", line 456, in result
2025-11-10 08:25:03.849153 ERROR moxa_sck: return self.__get_result()
2025-11-10 08:25:03.849346 ERROR moxa_sck: ^^^^^^^^^^^^^^^^^^^
2025-11-10 08:25:03.849538 ERROR moxa_sck: File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
2025-11-10 08:25:03.849715 ERROR moxa_sck: raise self._exception
2025-11-10 08:25:03.849899 ERROR moxa_sck: File "/usr/lib/python3.12/site-packages/appdaemon/adapi.py", line 1789, in set_state
2025-11-10 08:25:03.850084 ERROR moxa_sck: return await self.AD.state.set_state(
2025-11-10 08:25:03.850315 ERROR moxa_sck: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-10 08:25:03.850455 ERROR moxa_sck: File "/usr/lib/python3.12/site-packages/appdaemon/state.py", line 793, in set_state
2025-11-10 08:25:03.850572 ERROR moxa_sck: if "entity_id" in result:
2025-11-10 08:25:03.850687 ERROR moxa_sck: ^^^^^^^^^^^^^^^^^^^^^
2025-11-10 08:25:03.850807 ERROR moxa_sck: ===========================================================================

I also tried with self.call_service("state/set",...) instead of: self.set_state(...) but for me it didn't work. This is the error:

TypeError: argument of type 'ClientResponseError' is not iterable
2025-11-14 15:08:24.868139 WARNING Error: ------------------------------------------------------------
2025-11-14 15:08:24.871970 ERROR HASS: [400] HTTP POST: Bad Request {'attributes': {'last_changed': '2025-11-14T04:50:57.954410+00:00', 'last_reported': '2025-11-14T04:50:57.954410+00:00', 'last_updated': '2025-11-14T04:50:57.954410+00:00', 'context': {'id': '01KA0B7JS2NGRN6RHMXQN1M4RF', 'user_id': 'bec61cd7e06d47a2b31031547b72de1d'}}}
2025-11-14 15:08:24.872778 WARNING Error: Previous message repeated 1 times
2025-11-14 15:08:24.872936 WARNING Error: ------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/appdaemon/utils.py", line 511, in wrapper
result = await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/appdaemon/services.py", line 278, in safe_service
return await coro
^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/appdaemon/state.py", line 694, in state_services
await self.set_state(domain, namespace, entity_id, **kwargs)
File "/usr/lib/python3.12/site-packages/appdaemon/state.py", line 793, in set_state
if "entity_id" in result:
^^^^^^^^^^^^^^^^^^^^^
How can I resolve thie?
Thaks.

Yuri

Version

=0.17.11

Installation type

Home Assistant add-on

Relevant log output

Relevant code in the app or config file that caused the issue

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issueSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions