Skip to content

fix: version property returns dict instead of string on V2 API#8

Open
DarkByteZero wants to merge 1 commit into
milanmeu:mainfrom
DarkByteZero:fix/version-object-object
Open

fix: version property returns dict instead of string on V2 API#8
DarkByteZero wants to merge 1 commit into
milanmeu:mainfrom
DarkByteZero:fix/version-object-object

Conversation

@DarkByteZero
Copy link
Copy Markdown

Problem

The V2 API returns the versionc sensor as a dict:

{"title": "6.1", "raw": "6.1", "description": "", "icon": "", "image": "", "discover_url": ""}

The version property returns this dict directly, so Home Assistant passes it to DeviceInfo(sw_version=...) and the frontend displays "[object Object]" instead of "6.1".

Fix

Extract the string from the dict:

v = self.hub_data.get("sensors", {}).get("versionc", "")
if isinstance(v, dict):
    return v.get("title", v.get("raw", ""))
return str(v) if v else ""

Confirmed against the live V2 API.

The V2 API returns versionc as a dict (e.g. {"title": "6.1", "raw": "6.1", ...}).
The version property was returning the raw dict, causing Home Assistant to display
"[object Object]" for the firmware version in device info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant