Keyerror "device" HA integration
This thread was auto created from this message by @flashback.
hi, last windows version (2.1.0), got this error in ha: 2025-01-30 17:02:06.552 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry PCNERO for hass_agent
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hass_agent/init__.py", line 135, in async_setup_entry
_logger.debug("setting up device from config entry: %s [%s]", entry.data["device"]["name"], entry.unique_id)
~~^^^^^^^^^^
KeyError: 'device'
14 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> ✅ Mark Solution

Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
Please provide us with your integration version number.
You can find it in HACS -> HASS.Agent 2 -> Top left
for installed version number.
We will help as soon as possible.
While you're waiting you can try the following:
- Checkout the documentation. - Search here in discord for previously solved similar issues.
@DrR0x
Could you grab this version number for me @flashback
harsh-harlequin•4w ago
yep, it's 2.1.1
just updated the windows agent to 2.1.1 beta3, same error in HA..
wise-white•4w ago
subscribing to this issue since I'm also experiencing this rn
it only discovered once but mediia player is not working (unavailable). Setting up still gave this error.
Most of the time discovery doesn't exist even if LocalAPI, HA API, Sattelite Service and MQTT are all "running"
@flashback did you do any reinstallations/name changes before this issue happened?
harsh-harlequin•3w ago
@Amadeo what do you mean with name changes ? the name of the pc itself ? no, I didn't change it, nor reinstalled agent.
wise-white•3w ago
Same here. It simply refused to work or get discovered. MQTT works though, just not the media player which says uses MQTT for communication.
ok, let's start with first step, can you please remove the HASS.Agent integration from HACS and then reinstall it again?
+ the question from before, is that the whole error log or was there something else?
harsh-harlequin•3w ago
Ok, I'll remove and install HASS.Agent from HACS, that was the whole error log.
removing and reinstalling worked, but I already did it in the past and I know it'll work; the problem will arise soon again, as it already happened, I'll keep you posted, meanwhile thank you for support.
I can swear someone reported this even for the original HASS.Agent
*if memory serves me right lol
Once I'm done with 2.2.0 I need to deep dive into the integration and clean it up from stuff like this
harsh-harlequin•2w ago
Hi, here I am again, with more infos about the problem: it came back, but only after the pc is suspended (and I always suspend it instead of turning it off). When i turn it on, the agent complains about lack of connection to mqtt and then trying any command from HA won't work. I'm available to help debugging, if requested to do so. Ciao !
so after suspending and waking up the pc the error from the first message in this thread appears in HA logs correct?