Integration with Orbit B-Hyve Irrigation System

That sounds good. Thank you.
I will increase the debug level for the integration in order to collect some log entries :slight_smile:

So, this weekend, I could not run my bhyve sprinkler due to a communication problem with their “server”. I was away from home and needed access. I’d like to see local control via HA. I’m tackling other problems in my home and slowly replacing components to bring the control more localized, and may even build my own sprinkler controller, now that I understand how with my reading & learning via the HA Community.

Hi @sebr , I had to wait for a long time, which is excellent in this case ;-), but now it happened again:
The switch doesn’t work:
The logs:

Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:118
Integration: Orbit BHyve Integration (documentation)
First occurred: 3:03:05 (1 occurrences)
Last logged: 3:03:05

websocket connection closed

Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:136
Integration: Orbit BHyve Integration (documentation)
First occurred: 3:03:42 (1 occurrences)
Last logged: 3:03:42

Client connection error; state: starting

When trying to start irrigation:

Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:173
Integration: Orbit BHyve Integration (documentation)
First occurred: 11:55:26 (2 occurrences)
Last logged: 11:55:37

Tried to send message whilst websocket closed; state: starting

Maybe these messages help a little

A few things I had questions on:

  1. I have 4 zones. When the watering starts, the switch for zone 1 turns on in HA. Once zone 1 is done, the switch for zone 2 turns on, but the switch for zone 1 also stays on. This happens all the way until zone 4. Zone 1 is on from zones 1-4. Zone 2 is on from zones 2-4. Zone 3 is on during 3 and 4. Obviously only one zone is being watered at a time. Is this behavior expected?

  2. How can I see the next scheduled watering when I have a program turned on? Can’t seem to find it in any of the bhyve sensors.

Thanks!

Hi @sebr, thanks so much for the plugin, it’s seriously great work. I’m just tipping my toes in to the Home Assistant waters now after Homebridge didn’t have the sort of functionality I was hoping for.

No issues getting your integration installed in HACS… but it’s only picking up 4 out of my 5 faucet timers. Have tried uninstalling and reinstalling etc. and it just doesn’t pick up #5 (always seems to be the same one, but it’s definitely showing up as online on my BHyve dashboard). Any ideas?

Edit: I should add, it creates a “rain delay” item for the 5th timer, just no “zone” switch…

Edit 2: Sorry for all the edits, I’ll keep the original request there for posterity. Looked at the debug logs and the fifth device wasn’t receiving a ‘zone’ entry when it called the API.

To fix, I logged in to https://techsupport.orbitbhyve.com, and I deleted the zone that was listed under the device. Then, from the BHyve app, I made that device my active device, and pressed the ‘Zones’ tab - it created a new zone, which I could see from the Tech Support site.

Deleted the integration, restarted HASS, deleted the old entities, restarted HASS again, installed the integration, restarted HASS again! And the zone and the zone-history have now appeared.

Cheers

Hi @Derekzielinski and @twhug,
I’d be happy to take a look at what’s going on with your respective systems. Can you each please raise a Github issue and I’ll investigate. Please follow the instructions and include the debug data :slight_smile:

cheers

Hello everyone. Pretty basic question.

Installing the HACS bhyve-home-assistant component. I see there is a python script (bhyve_next_watering.py) that needs to be installed manually.

Note: HACS does not install the script automatically and they must be added manually to your HA instance.

Wondering where this script should be installed. Somewhere in the config folder?

In your configuration.yaml file make sure you have a simple line of python_script:

and in your config directory you create a directory called python_scripts and put the script there:

~/.homeassistant/python_scripts $ ll
total 4
-rwxrwxr-x 1 homeassistant homeassistant 3422 Aug  3 08:53 bhyve_next_watering.py

Pretty sure that is all.

Great, got it, thanks very much.

Hello, looking for a bit of advice.

I’ve installed the bhyve_next_watering.py script (thanks GardenMonkey) but I’m not sure it is working correctly (as in not at all).

I can see it in the system as a service but running it does not seem to create or update the entities named sensor.{zone_name}_next_watering and sensor.{device_name}_rain_delay_finishing .

I assume I should be able to call it from the services tab in developer tools.

Is there something I am missing?

I just let an automation update the sensors:

- alias: BHyve Sensor Update - Left
  trigger:
    - platform: state
      entity_id: switch.left_zone, switch.left_rain_delay
    - platform: homeassistant
      event: start
  action:
    - service: python_script.bhyve_next_watering
      data:
        entity_id: switch.left_zone
- alias: BHyve Sensor Update - Deck
  trigger:
    - platform: state
      entity_id: switch.deck_zone, switch.deck_rain_delay
    - platform: homeassistant
      event: start
  action:
    - service: python_script.bhyve_next_watering
      data:
        entity_id: switch.deck_zone
- alias: BHyve Sensor Update - Back
  trigger:
    - platform: state
      entity_id: switch.back_zone, switch.back_rain_delay
    - platform: homeassistant
      event: start
  action:
    - service: python_script.bhyve_next_watering
      data:
        entity_id: switch.back_zone

I am pretty sure that is all you need to do.

Thanks, I did set up an automation but it doesn’t seem to work so I thought I’d try to run it from developer tools to check.

This is my automation:

- id: '1602819993691'
  alias: Update bhyve
  description: https://github.com/sebr/bhyve-home-assistant#bhyve_next_wateringpy
  trigger:
  - platform: state
    entity_id: switch.veg_trug_zone
  - platform: state
    entity_id: switch.veg_trug_rain_delay
  - platform: homeassistant
    event: start
  condition: []
  action:
  - service: python_script.bhyve_next_watering
    data:
      entity_id: switch.veg_trug_zone
  mode: single

I created this via the GUI. But as far as I can see it should work.

did you try executing it directly under automations? I also added the automation entity in lovelace just to confirm that I had it enabled.

I sure did.

The documentation says the file is bundled in this repository, but I didn’t see it in my config / custom_components folder.

So I copied and pasted the code from the git-hub page into a new file and uploaded it to the python_scripts folder because I could not find a way to download it directly. Perhaps that could be the cause of the issue.

Where did you get yours?

Pulled down bhyve_next_watering.py via wget and copied it to the python_scripts folder. Automation still does not work. Tried to run it manually via a script. No go. Also changed the file’s permissions… still nothing.

I added the debug to my configuration. There seems to be an error in the script:

Logger: homeassistant.components.python_script
Source: components/python_script/__init__.py:147
Integration: Python Scripts (documentation, issues)
First occurred: 1:41:38 PM (1 occurrences)
Last logged: 1:41:38 PM

Error loading script bhyve_next_watering.py: Line 28: "_LOGGER" is an invalid variable name because it starts with "_"

PS: Downloading the script via WGET just pulled down the HTML file which was less than useful.

I see that there was a new version, but can you make sure you are wget’ing the raw version…I don’t see any such line in what is up there:

wget https://raw.githubusercontent.com/sebr/bhyve-home-assistant/main/python_scripts/bhyve_next_watering.py

Thanks, I thought that strange as well, so I checked the file on github site and it was there. But now it isn’t.

I raised an issue over at github and script has been fixed by its author.

I’ll try the new file.

Thanks for the comment and in particular the github link.

Hi @sebr
little time ago we discussed on the issue that bHyve looses contact to the host and you improved the logging.
This night I had a massive internet lost for about an hour.
bHyve wasn’t able to reestablish the connection.
For your info enclosed the logs:

Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:117
Integration: Orbit BHyve Integration (documentation)
First occurred: 3:17:38 (1 occurrences)
Last logged: 3:17:38

websocket connection closed

Protokolldetails ( WARNING )
Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:131
Integration: Orbit BHyve Integration (documentation)
First occurred: 3:17:38 (1 occurrences)
Last logged: 3:17:38

Websocket exception:

Protokolldetails ( ERROR )
Logger: custom_components.bhyve.pybhyve.websocket
Source: custom_components/bhyve/pybhyve/websocket.py:137
Integration: Orbit BHyve Integration (documentation)
First occurred: 3:18:17 (1 occurrences)
Last logged: 3:18:17

Client connection error; state: starting

Protokolldetails ( WARNING )
Logger: urllib3.connectionpool
Source: /usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py:751
First occurred: 3:05:32 (123 occurrences)
Last logged: 4:20:48

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x5bce9928>: Failed to establish a new connection: [Errno -3] Try again')': /network/116231/update
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x586c2688>: Failed to establish a new connection: [Errno -3] Try again')': /network/116231/update
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x61265370>: Failed to establish a new connection: [Errno -3] Try again')': /network/116231/update
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x5b67eee0>: Failed to establish a new connection: [Errno -3] Try again')': /network/116231/update
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x69016ee0>: Failed to establish a new connection: [Errno -3] Try again')': /network/116231/update

It seems, that the interface doesn’t come out of the starting sequence.
The last message must be connected to bHyve becouse it is the only component with debuglevel warning.

Hey guys,

I have an additional tap timer. I have added it to the b-hyve app, does it automatically show up in home assistant after some period of time or do I have to re-install the add-on?