Closed lellky closed 8 months ago
The firmware version is missing in the device info response. That's unexpected. It should have an item with key "3"
.
{"0":"IKEA of Sweden","1":"TRADFRI on/off switch","2":"","6":3,"7":4549,"8":0,"9":50}
My gateway is running 1.21.31 fyi.
I'd try running the script again, restarting the gateway and running the script again, removing and adding the on/off switch and running the script again.
This is really weird. In the Ikea app some entities are missing the firmware information as well!
So, after switching batteries in some devices and power toggle other devices, the ikea app finally reported a firmware version on all entities except one. That was a motion sensor. Removed it from the gateway and now it seems to work (no exceptions).
The issue could come back. Why is firmware version needed when getting device info, and why do we raise an exception when it's missing?
When we designed handling the responses using pydantic, the firmware version was in the response from the gateway and I believe it should be as per IKEA's design. The exception is raised by pydantic as a part of its validation of the response.
We could set the firmware version as optional but it's probably better to make sure the devices are properly linked to the gateway.
How would one make sure the devices are properly linked to the gateway? I did nothing and suddenly it stopped working.
If it doesn't mess up the home assistant integration I would suggest adding the firmware as optional. Also, when some devices lack the firmware version the Ikea app doesn't crash.
To be clear, this version of pytradfri that uses pydantic isn't used in Home Assistant yet. So any issues in Home Assistant is not because the pydantic validation we have implemented.
Thank you for the clarification.
My understanding is that the behaviour is the same in the two versions? I.e. if the problem occurs in the gateway, both versions (9 and 13) will raise an exception (KeyError: '3'
in version 9).
I think we can make the device firmware version optional. That information isn't required to communicate with the device or use it.
Note though that missing information that is expected for a device is a sign that something about the gateway or device in question isn't working correctly. Other things that are required for proper operation may be affected.
I think that is for the maintainers of this repo to decide. I'm just a regular user of trådfri and home assistant :)
So I recently upgraded HA to latest version and since then I get errors from tradfri in my log https://github.com/home-assistant/core/issues/106481. Then I forked this repo to try to understand what was could be the error, and this happened.
Where are you using pytradfri (eg stand-alone, Home Assistant etc)
stand-alone
Version of pytradfri
latest on master
Backend used (aiocoap, libcoap)
libcoap_api
What type of environment are you in, eg Dockerized, Raspberry PI, VirtualBox, WiFi network (give as much details as possible)
Docker, as per the docs
Expected behaviour
It would work without raised exceptions
Actual behaviour
I get an exception: