Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HACS install sensor.py mapping incorrect attributes #2

Closed
ppastur opened this issue May 23, 2023 · 5 comments
Closed

HACS install sensor.py mapping incorrect attributes #2

ppastur opened this issue May 23, 2023 · 5 comments

Comments

@ppastur
Copy link

ppastur commented May 23, 2023

Reposting from #flz/iaqualink-py#23

HACS install works but there is an issue with mapping which prevents the sensor from loading in HASS

I managed to get it working by tweaking sensor.py

Here is what I changed:

line 110 is trying to map

self._temperature = data["state"]["reported"]["equipment"]["robot"]["sensors"]["sns_1"]["val"]
but it should be (in my case)
self._temperature = data["state"]["reported"]["equipment"]["robot"]["sensors"]["sns_1"]["state"]
as "val" doesn't exist

so now I get this

not sure if this is just specific to my device.

@galletn
Copy link
Owner

galletn commented May 23, 2023

@ppastur, I expected this indeed, I'm wondering if this is related to your robot or not.

I could easily add a if else based on robot numbers .. or try catch ... but not sure what the cleanest solution is. at this moment the try catch seems the cleanest to avoid building up a list of "supported" robots.

Might need to add the list of "tested" robots in the readme, that would also avoid people wondering why it goes wrong.

@ppastur
Copy link
Author

ppastur commented May 23, 2023

I understand. I cant really comment on the best solution because I have no clue how often the schema will change per model. I do agree that we need to gracefully handle the error so the other attributes can load and worst case scenario you will simply have a reduced list of attributes. In my case, the code stopped and no sensor was instantiated in HASS. I figured it out because I used postman to look at the schema and compare it to what the code was trying to map.
Does yours work without the change?

galletn added a commit that referenced this issue May 23, 2023
#2 Fixing incorrect attribute of temperature
@galletn
Copy link
Owner

galletn commented May 23, 2023

@ppastur for me it works indeed, can you try out the new version? added the error logging and catch on the temperature

@ppastur
Copy link
Author

ppastur commented May 23, 2023

Just reloaded the integration from HACS and I can confirm it works without issue.

@galletn galletn closed this as completed May 24, 2023
@LOki61
Copy link

LOki61 commented May 27, 2023

Just reloaded the integration from HACS and I can confirm it works without issue.

I haven’t tested yet guys, once I get my robot back from repairs will try again

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

No branches or pull requests

3 participants