Rainbird HA integration - error

Hi,

I’m using docker installation on Raspberry, HA 2022-02

Have installed pyrainbird 0.5.0 - it is working with a python test script, can switch the different zones on and off.
Have installed via github and setup.py because of the issue with pip installation: https://github.com/jbarrancos/pyrainbird/issues/38

Now have installed the Rainbird HA integration - this is not working
(https://github.com/konikvranik/hacs_rainbird)
I had to remove the pyrainbird requirements because of the bug (see above) - then could configure the component. I do not use rain sensors - have configured 6 zones (“auto” does not change the issue)
But when I try to switch on/off any zone - I get this error in log:

2022-02-26 16:49:07 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [1718911544] Status request failed with wrong response! Requested 01 but got 00:
{'type': 'NotAcknowledgeResponse', 'commandEcho': 57, 'NAKCode': 4}
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 "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 948, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/rainbird/switch.py", line 82, in turn_on
    response = self._controller.irrigate_zone(int(self._zone), int(self._duration))
  File "/usr/local/lib/python3.9/site-packages/pyrainbird/__init__.py", line 136, in irrigate_zone
    response = self._process_command(
  File "/usr/local/lib/python3.9/site-packages/pyrainbird/__init__.py", line 202, in _process_command
    response = self.command(cmd, *args)
  File "/usr/local/lib/python3.9/site-packages/pyrainbird/__init__.py", line 188, in command
    raise Exception(
Exception: Status request failed with wrong response! Requested 01 but got 00:
{'type': 'NotAcknowledgeResponse', 'commandEcho': 57, 'NAKCode': 4}

Connection itself seems to be ok, because I see the Firmware version of the Rainbird unit 2.9 (?).

Somebody could tell me what here can be wrong?
Maybe @konikvranik ? :wink:

Thanks!

Hi, i’ve been updating the rainbird integration and i’m curious if you are still seeing this or if it has been resolved in newer home assistant releases (e.g. 2022.12 and beyond)

Hi @allenporter - Glad to see someone is supporting this integration! I have been having some issues recently. I just submitted this github issue. Please let me know if there is anything i can do to help debug.

Thanks, I’ll have a look.

Goodmorning @allenporter, thanks for making some updates to the integration. For a few years now I got the rainbird controller with three zones running in my garden.

But never had it working properly with H.A. with your update I can now see which zone is active at the moment. When I start that zone from the Rainbird app it will show active in H.A.

I got an automation running that determines if the rainbird should start doing its work for the starting zone, if so the automation tells the rainbird integration to start the zone and let it run for a period that is calculated.

But when the start_zone is beeing executed the following error occurs.

Error:
Status request failed with wrong response! Requested 01 but got 00: {‘type’: ‘NotAcknowledgeResponse’, ‘commandEcho’: 57, ‘NAKCode’: 4}

Part Of Automation:

- service: rainbird.start_zone
        data:
          zone_run_time: '{{ states(''input_number.sprinkler_watering_duration'') | int }} '
        target:
          entity_id: switch.rainbird_zone_1
      - delay:
          minutes: '{{ states(''input_number.sprinkler_watering_duration'') | int }}'
        enabled: true
      - type: turn_off
        device_id: 5910bc45f65d50de025cd5c707296d82
        entity_id: switch.rainbird_zone_1
        domain: switch

Version Information:

Home Assistant 2023.5.3
Supervisor 2023.04.1
Operating System 10.1
Frontend-versie: 20230503.3 - latest

Rainbird Information:
ESP-RZXe
Firmware: 2.9
LNK2 WiFi Module

Can you help me out with this?

Hi, it looks like we’ll need to capture some of the messages from the device to make sure it can be supported by the library. If you’re up for it, it involves running an http proxy and capturing packets using mitmproxy as described here: pyrainbird/CONTRIBUTING.md at fdb3f77ab6dcfcc19ba84bdc7e8ba548535849d8 · allenporter/pyrainbird · GitHub

But either way, it seems like we’ll need to fix support for this device so maybe worth filing an issue under Issues · allenporter/pyrainbird · GitHub and we can follow up (on the proxy data or some other approach to get it working)

Thanks for you really quick response!!

What I can do is change the LNK2 module into the LNK module. I still got the LNK module from the time that the LNK2 was not available. The only reason I bought the newest version was that it would be faster and I hoped it could handle multiple connections.

If it works then we know it is a hardware support issue for the LNK2 module.

Still, Im going to try and create the http proxy and use it to get some extra information. When done I will create an issue on github.

1 Like

Some extra logging:

Logger: homeassistant.helpers.script.websocket_api_script
Source: custom_components/rainbird/switch.py:96
Integration: Rainbird
First occurred: 21 mei 2023 om 12:42:48 (1 occurrences)
Last logged: 21 mei 2023 om 12:42:48

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Status request failed with wrong response! Requested 01 but got 00: {'type': 'NotAcknowledgeResponse', 'commandEcho': 57, 'NAKCode': 4}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 452, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1849, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 809, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 980, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
    await result
  File "/config/custom_components/rainbird/switch.py", line 117, in async_start_zone
    await self.async_turn_on(duration=zone_run_time)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1034, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/rainbird/switch.py", line 96, in turn_on
    response = self._controller.irrigate_zone(int(self._zone), int(duration // 60))
  File "/usr/local/lib/python3.10/site-packages/pyrainbird/__init__.py", line 136, in irrigate_zone
    response = self._process_command(
  File "/usr/local/lib/python3.10/site-packages/pyrainbird/__init__.py", line 202, in _process_command
    response = self.command(cmd, *args)
  File "/usr/local/lib/python3.10/site-packages/pyrainbird/__init__.py", line 188, in command
    raise Exception(
Exception: Status request failed with wrong response! Requested 01 but got 00:
{'type': 'NotAcknowledgeResponse', 'commandEcho': 57, 'NAKCode': 4}

hopefully this could help.

This confirms that the device is responding that it does not accept the command sent by the python library. Presumably it expects a different input format for the command that it is trying to issue.

Yesterday I tried to set up a virtual environment on my windows machine.

But I could not get it to work, will try it again later this week. When I got running I will provide the proxy data.

I created an issue on github for adding support of the provided hardware.
Thanks in advance!