rianadon / opensprinkler-card

Home Assistant card for collecting OpenSprinkler status
Other
66 stars 8 forks source link

Master stations shall not be controllable #13

Open nanosonde opened 2 years ago

nanosonde commented 2 years ago

Hi!

Would it be possible to disable the control buttons for master stations in the card? My 8th station is configured for the pump power supply and is, thus, a master station. It gets activiated by other stations if there is a request for water.

In the OpenSprinkler App it is also NOT controllable.

When I click on the "start/play" button in the card, I get an error from the integration:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/opensprinkler/__init__.py:324
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:01:40 (2 occurrences)
Last logged: 10:05:30

[140258864195568] ('Error code: 48', 48)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/opensprinkler/__init__.py", line 104, in _async_send_run_command
    await hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/config/custom_components/opensprinkler/__init__.py", line 324, in run
    await self._station.run(run_seconds)
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/station.py", line 81, in run
    return await self._manual_run(params)
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/station.py", line 40, in _manual_run
    content = await self._controller.request("/cm", params)
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/__init__.py", line 145, in request
    content = await self._request_http(url)
  File "/usr/local/lib/python3.9/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/__init__.py", line 200, in _request_http
    raise OpenSprinklerApiError(
pyopensprinkler.OpenSprinklerApiError: ('Error code: 48', 48)
rianadon commented 2 years ago

Great suggestion! I'm open to PRs if anyone wants to tackle this.