galletn / iaqualink

Home Assistant Iaqualink Vacuums Robots
8 stars 1 forks source link

Zodiac XA 5095 iQ error in Homeassistant #9

Closed DAVIZINH0 closed 4 months ago

DAVIZINH0 commented 1 year ago

Hello. Im noob with this integration but i will try :-)

my iaqualink robot is Zodiac XA 5095 iQ I installed it from hacs, setup as readme said. but i obtain a error in home assistant:

`Error while setting up iaqualinkRobots platform for sensor Traceback (most recent call last): File "/config/custom_components/iaqualinkRobots/sensor.py", line 154, in _update self._temperature = data["state"]["reported"]["equipment"]["robot"]["sensors"]["sns_1"]["val"]


TypeError: list indices must be integers or slices, not str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/iaqualinkRobots/sensor.py", line 157, in _update
    self._temperature = data["state"]["reported"]["equipment"]["robot"]["sensors"]["sns_1"]["state"]
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 362, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/sensor.py", line 36, in setup_platform
    add_devices([iaqualinkRobotSensor(config)])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/sensor.py", line 52, in __init__
    self._update()
  File "/config/custom_components/iaqualinkRobots/sensor.py", line 159, in _update
    error = error + ' temparture mapping error'
            ^^^^^
UnboundLocalError: cannot access local variable 'error' where it is not associated with a value`

any idea or something i can test?
rufjame commented 8 months ago

I'm seeing the same error when attempting to add my Zodiac duo x 4050iq. I'm running HACS 1.33.0 on Home Assistant Core 2023.12.3

galletn commented 8 months ago

It's been a while, sorry for that, It's due to your robots returning this value in another field most probably.

I'll surround it with a try catch to fix the issue, but you will need to provide me the correct field for your Robot's to take it from there.

Do you have experience with API call's and POSTMAN?

It's not too complicated to get the right data, but just to make sure we are on the same page!

rufjame commented 8 months ago

I have some experience with API calls.

galletn commented 7 months ago

You need to make 3 calls: post to: https://prod.zodiac-io.com/users/v1/login boby: {"apiKey": "EOOEMOW4YR6QNB07","email": "yourmail","password" : "yourpassword"}

Then call with the authentication_token and id you get from call 1 https://r-api.iaqualink.net/devices.json?authentication_token=#replace with your auth token#&user_id=#replace with your id#&api_key=EOOEMOW4YR6QNB07

then take the IdToken from the first post and add as header for the third call https://prod.zodiac-io.com/devices/v1/#replace with serial_number from call 2#/shadow

image and provide me the result.

that way we can check where your temperature is located.

Don't forget to remove sensitive data before posting!

rufjame commented 7 months ago

image

I'm not seeing temperature in the mobile app or specs at all so I assume it doesn't even support it.

galletn commented 4 months ago

Hi there, with some delay a new version that might fix it. Can you please give it a go?

thanks!

rufjame commented 4 months ago

Have updated to release 2f3eafa and i'm getting a new error in the homeassistant log.

2024-03-25 09:27:59.079 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up iaqualinkRobots platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in _async_setup_platform await asyncio.shield(awaitable) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/iaqualinkRobots/sensor.py", line 42, in setup_platform iaqualink_data.update() File "/usr/src/homeassistant/homeassistant/util/init.py", line 190, in wrapper result = method(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/iaqualinkRobots/sensor.py", line 187, in update self._pressure = data["state"]["reported"]["equipment"]["robot"]["sensors"]["sns_2"]["state"]



TypeError: list indices must be integers or slices, not str
galletn commented 4 months ago

Added try catches around almost all the items now as it seems your robot returns a lot less in this API. Can you give it another go?

rufjame commented 4 months ago

new error sorry:

2024-03-25 20:48:06.239 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up iaqualinkRobots platform for sensor Traceback (most recent call last): File "/config/custom_components/iaqualinkRobots/sensor.py", line 218, in update self._cycle_start_time = datetime_obj = datetime.datetime.fromtimestamp(data["state"]["reported"]["equipment"]["robot"]["cycleStartTime"])


TypeError: list indices must be integers or slices, not str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/sensor.py", line 42, in setup_platform
    iaqualink_data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/sensor.py", line 220, in update
    self._cycle_start_time = datetime.now()
                             ^^^^^^^^^^^^
AttributeError: module 'datetime' has no attribute 'now'
galletn commented 4 months ago

Try one more time please, it did not like the datetime.now, stupid is that I cannot test this as I do have all these fields, so sorry for the trial and error.

rufjame commented 4 months ago

It's Alive!

image

galletn commented 4 months ago

Great to see it's working now, too bad you have so many not applicable ... so if you find any of your data in other API call's let me know then I can try to add them, because now its basically just online time, and model number.

rufjame commented 4 months ago

Yeah i'll have to find some time to test what else is available as it would be nice to have current run time and mode. Thanks for the works so far!

DAVIZINH0 commented 4 months ago

hello. With the last update the sensor works for me too robot_piscina

now my robot is in winter mode (in a box, jeje). In a few months i will use again.

One more question, and maybe this is not the place to make this question: now with the integration working, its posible to start a clean for home assistant? or stop if the robot its cleaning?

galletn commented 4 months ago

@DAVIZINH0, still need to work on that one, see #1 , I'm not the biggest coding expert, but want to invest some time into the topic anyhow so keep you posted. Also here, the pool season has not started yet 👍

Good it works, but same remark as previous post, you Robot does not seem to give back a lot of info with the current API's used, If you guys have any other API's you know the app is using in your cases feel free to inform me, I can try to add it then.

Good luck already!

DAVIZINH0 commented 4 months ago

@DAVIZINH0, still need to work on that one, see #1 , I'm not the biggest coding expert, but want to invest some time into the topic anyhow so keep you posted. Also here, the pool season has not started yet 👍

Good it works, but same remark as previous post, you Robot does not seem to give back a lot of info with the current API's used, If you guys have any other API's you know the app is using in your cases feel free to inform me, I can try to add it then.

Good luck already!

maybe when I start a cleaning, the api retreives more info. I will test when the "pool season" start. :-P

thanks a lot for your work!

galletn commented 1 month ago

@DAVIZINH0 can you test the new release too? thanks!

DAVIZINH0 commented 1 month ago

@DAVIZINH0 can you test the new release too? thanks!

Now Im out of home and cant power on the robot to clean and test if any New information apears.

This is the informativo i can see in remote Screenshot_20240703_142935_Home Assistant

galletn commented 1 month ago

you will need to add the new vacuum entity to your config file to see the new stuff.

let me know when you have tested it thanks!

vacuum:

DAVIZINH0 commented 1 month ago

you will need to add the new vacuum entity to your config file to see the new stuff.

let me know when you have tested it thanks!

vacuum:

  • platform: iaqualinkRobots username: password: api_key: EOOEMOW4YR6QNB07 name:

Done. I will try the new device when i go home Screenshot_20240703_155914_Home Assistant

Apears a warning in the log: Screenshot_20240703_160158_Home Assistant

DAVIZINH0 commented 1 month ago

Hello. Im at home and can confirm that i can play and stop the zodiac XA 5095 IQ from home assistant. It works fine! you can add the robot in the compatibility list :-)

thanks for your work