MTrab/landroid_cloud

On zone change via select, I get following error "Cannot request this zone as it is not defined."

fanningert opened this issue · 7 comments

Describe the issue

When I change the zone via the select entity, I get the error "Cannot request this zone as it is not defined.". In the landroid app the zones (3 zones) are correct configured. The current zone is showing 1 and I try to change to 2 or 3.

What version of Home Assistant Core has the issue?

core-2024.4.3

What was the last working version of Home Assistant Core?

No response

What version of the Landroid Cloud integration do you have installed

v5.0.1

What type of installation are you running?

Home Assistant OS

Which make and model is the mower used for this integration?

Worx Landroid M500 (WR141E)

Diagnostics information (NOT log entries!)

None

Relevant log entries

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 195, in async_handle_select_option
    await self.async_select_option(option)
  File "/config/custom_components/landroid_cloud/device_base.py", line 890, in async_select_option
    self.entity_description.command_fn(self._api, str(int(option) - 1))
  File "/config/custom_components/landroid_cloud/select.py", line 23, in <lambda>
    command_fn=lambda api, value: api.cloud.setzone(
                                  ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyworxcloud/__init__.py", line 924, in setzone
    raise ZoneNotDefined("Cannot request this zone as it is not defined.")
pyworxcloud.exceptions.ZoneNotDefined: Cannot request this zone as it is not defined.

Additional information

No response

Please attach diagnostics as requested

Since I have the same problem, you can find my diagnostic information here
config_entry-landroid_cloud-82561348d51e1571509629c87bcbaf89 (1).json

I have same problem

It's a shame that it can't continue. Everything that was required is there. Since it is an important function for me, I would be happy if the problem can be solved quickly.

It will be solved as quickly as I can. But I do have 2 jobs and a life besides this, so please be patient.

Yes I understand.
Excuse me.

The problem was introduced at MTrab/pyworxcloud@9a88283#diff-081e7326e6882fba84022220b407bd2f6feb6784849f9fb903bb8a10e5d02013R916 . The change should probably have been

            if (
                zone >= len(device.zone["starting_point"])
                or device.zone["starting_point"][zone] == 0
            ):

Since the starting_point array contains meters but not zone indices.