galletn / iaqualink

Home Assistant Iaqualink Vacuums Robots
9 stars 2 forks source link

CNX40 IQ #34

Closed smuliv closed 2 weeks ago

smuliv commented 1 month ago

Hi, I have a CNX40 IQ

The integration did not work at all because of:

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/websocket_api/commands.py:241
Integration: Home Assistant WebSocket API (Dokumentation, Probleme)
Erstmals aufgetreten: 14:09:07 (2 Vorkommnisse)
Zuletzt protokolliert: 14:09:13

[139765092741856] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/vacuum.py", line 227, in async_start
    data = await asyncio.wait_for(self.setCleanerState(request), timeout=30)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/vacuum.py", line 480, in setCleanerState
    await self.async_update()
  File "/config/custom_components/iaqualinkRobots/vacuum.py", line 389, in async_update
    self._total_hours = data['payload']['robot']['state']['reported']['equipment']['robot.1']['totRunTime']
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'totRunTime'

I checked my iAqualink app on the mobile and even there it says "null Stunden" at total time.

So I removed totRunTime completely from the integration.

image

Now it works, but there is still an error when changing modes:

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/websocket_api/commands.py:241
Integration: Home Assistant WebSocket API (Dokumentation, Probleme)
Erstmals aufgetreten: 14:17:29 (1 Vorkommnisse)
Zuletzt protokolliert: 14:17:29

[140518812086144] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/iaqualinkRobots/vacuum.py", line 523, in async_set_fan_speed
    request = {"action":"setCleaningMode","namespace":"cyclonext","payload":{"clientToken":clientToken,"state":{"desired":{ "equipment":{"robot.1":{"cycle":_cycle_speed}}}}},"service":"StateController","target":self._serial_number,"version":1}
                                                                                                                                                            ^^^^^^^^^^^^
UnboundLocalError: cannot access local variable '_cycle_speed' where it is not associated with a value

Kind regards and many many thanks for your work on this integration Markus

smuliv commented 1 month ago

When playing with the app i can see that mine has 2 cycle modes, 1 and 3. Switching from "Floor and wall" (set in the app) to "Floor only" in HA works without a problem.

In the developer tools i can see it's not correct recognized:

fan_speed_list: Floor only, SMART Floor and walls
fan_speed: SMART Floor and walls
username: XX
first_name: XX
last_name: XX
id: XX
serial_number: XX
device_type: cyclonext
status: connected
last_online: 2024-08-10T10:07:57.539000
canister: 0
error_state: 0
cycle_start_time: 2024-08-10T10:17:47
cycle: 1
cycle_duration: 90
cycle_end_time: 2024-08-10T11:47:47
time_remaining: 1 Hour(s) 26 Minute(s) 21 Second(s)
model: CNX 40 IQ
friendly_name: PoolDog
supported_features: 8360

so the supported mode should not be "SMART floor and wall", but "Floor and wall". This model also has a lift functionality ( which I think should be the return to docking station button), which gives this error:

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/websocket_api/commands.py:241
Integration: Home Assistant WebSocket API (Dokumentation, Probleme)
Erstmals aufgetreten: 12:05:32 (2 Vorkommnisse)
Zuletzt protokolliert: 12:16:35

[140550151374592] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 981, in entity_service_call
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity vacuum.pooldog does not support this service.

image

Kind regards

galletn commented 1 month ago

hi @smuliv good to know, I based the devs on just one robot for cyclonext type, so no wonder there are some issues. Would it be possible for you to reset your password and send over your credentials to nicolas.gallet@skynet.be ?

I will then do the needed to fix the code accordingly to support your model. I might need you to test at some point too!

Let me know if you would prefer to debug all yourself, I can send you some python programs too if you prefer that.

KR,

Nicolas

smuliv commented 1 month ago

Hi Nicolas,

No problem, we can do that. I can also put the robot in the pool so that you can experiment with it. I would just need to know when you can find the time (we have GMT+2 summer time here) so that I don't have to leave it inside all the time.

As for total time, I have no idea why it is not displayed/stored in the system. I have also tried deleting the robot and reintegrating it into Zodiac (iAquaLink). As already written, the app on the cell phone also shows "null" all the time.

In case it is of interest to you: The CNX 40 IQ has:

  1. floor cleaning
  2. wall and floor cleaning
  3. lift system to get the robot out of the water (with manual left/right rotation if needed)
  4. remote control (forward, back, left, right) And all this via app.

What also works via app is a shortening/extending of the cleaning time in 15 minute steps. If I do this in the app, the attribute in the Home Assistant does not change, but the robot stops at the time set on the cell phone as intended.

Kind regards Markus

galletn commented 1 month ago

Hi Markus,

well received the credenatials, thanks for the trust.

I'll be away for one week now, but I'll continue working on it afterwards and let you know when we can test furter. I also live in GMT+2 summertime so should be no issue to check in the evening some day!

Enjoy the pool for now šŸ˜„

galletn commented 2 weeks ago

Hi Markus,

I put it in branch #33

you can test it there, but I plan to merge it today too so could be you can just take the update on the main!

Let me know if something else breaks šŸ˜„