Integration with Orbit B-Hyve Irrigation System

Can you please raise a github issue and I will debug with you more closely

1 Like

@sebr - I’m greatly enjoying this! I’ve incorporated it with a calendar integration and Node-Red to schedule my watering.

@Pirol_62 - thanks for the note about the app’s default. Mine was set to 10 minutes, and I was confused why it kept turning itself off before I did. A quick tweak of that setting, and now Node-Red and my calendar integration are in full control. :slight_smile:

I updated to the latest version as well. I get all the switches for my 6 zones. But I also automatically get the following: sensor.bhyve_battery_level_house AND binary_sensor.bhyve_rain_delay_house as “unavailable”. I do not get a freezing_delay (that’s what I get in the Orbit app). Also, my unit is currently off since it’s below freezing right now. Should there be a switch for that as well?

Thanks for your great work.

1 Like

Hello, Just like to second this, as i also have the same problem with version 0.1.3.

Battery level unknown and I for some reason i don’t see any binary_sensor entities at all.

PS I am running 2 x Hose Tap Timers with a WIFI Hub.

Thanks.

@Madelinot / @John_Ornsby - I would be happy to take a look into this. Can you please enable debugging (only the logs, not the packet_dump) and raise a Github issue with the logs?

I can only try fix with this info. Thanks!

I’m not sure what to do about this - I don’t live in a freezing climate so have never seen this. What do you expect to happen? Should the switch be marked as Unavailable ?

Hi, already updated to 0.1.3 – no issues
For everyone who is interested in.
My intension is, to start the irrigaion in dependency of rain total during the last 7 days.
Unfortunately, my netatmo deliveres states for rain during last hour and last 24 hours.
the statistics sensor provides complete useless information because the entries in states are doubled. Using sql and grouping the entries makes the result even more confusing and not usable.
So, this is my solution:
Create a variable and store the 24Hours rainstate every night at 23:59:45
image

  last_rain_total:
    value: 0
    restore: true
    name: 'Regen vom Vortag'

Integrate the variable into recording. I set the purge_keep_days to 7 before.
Store the latest value from netatmo every night at the same time

- id: '20017'
  alias: 'Store Raintotal'
  initial_state: 'on'
  trigger:
     - platform: time
       at: '23:59:45'
  action:
    - service: variable.set_variable
      data:
        variable: last_rain_total
        value_template: '{{ states.sensor.netatmo_rs_garten_sum_rain_24.state }}'

Then create a sensor like this:

  - platform: sql
    queries:
      - name: 'weekly_total_rain'
        query: >
              SELECT ROUND(SUM(sum_days),2) 'value'
              FROM (
                SELECT SUM(state) AS sum_days
                FROM states
                WHERE entity_id = 'variable.last_rain_total'
                and time(created) = '22:59:45'
                order by created desc
                );
        column: 'value'
        unit_of_measurement: mm

The assumption is, that I have only one entry in states with the total for the last 24 hours per day.
Works so far.

last but not least the automation:

- id: '150'
  alias: 'Irrigation'
  initial_state: false
  trigger:
    - platform: time
      at: '19:00'
  condition:
      - condition: template
        value_template: '{{ states.sensor.weekly_total_rain.state |int < 5 and states.variable.last_rain_total.state |int < 1 and states.sensor.netatmo_garten_temperature.state |int > 20 and now().month in (5,6,7,8,9) }}'
  action:
    - service: script.turn_on
      entity_id: script.add_log
      data:
        variables:
          name: 'Bewässerung'
          message: 'has been triggered'
    - service: switch.turn_on
      entity_id: switch.zone_1_zone
    - delay: '00:20:00'
    - service: switch.turn_off
      entity_id: switch.zone_1_zone

I’m not sure, if the sql ‘order by’ is really necessary, because i expect never more then 7 entries. But it is no issue in the end :wink:
Correction: After some restarts it shows, that the group by and order by is important. Order by asc ensures, that the first entry is beeing used. Obviously HA creates new entries in order to restore values after a restart.

By the way: an improvement can be to react on yesterdays total of rain, stored in the variable, as well. Because if all the rain, the sensor reports, comes only from yesterday, it could be a good idea, to wait with irrigation until the next day :slight_smile: I changed the template

Edit at 23.01: Die Where-Clause could be improved and simply select my entries at 22:59:45.

1 Like

@Pirol_62 I’m curious why you have manually set up this irrigation automation with weather sensing, when the b-hyve service does this for you?

For what it’s worth, the api provides some very detailed metrics around water retention for a yard such as evaporation, water run off and uses soil type to calculate how often to water the soil. That could be exposed if useful.

Also, another minor tip - it is always best to water plants / lawn early in the morning rather than in the evening to avoid fungal disease!

Best

Hi @sebr
Yes, bHyve has a lot of possibilities but the rain information provided by bHyve are for the german region very unreliable.
There is rain, when it hasen’t rained for days and there is no rain information even when it aleady rains.
Often it rains 1km away but not where I live.
So I have to create my own measurement based on my netatmo weatherstation :wink:
But thanks for your tip. You’re completely right. I changed it to 05:30 :slight_smile: Now, with this automation, I have enough control.

2 Likes

Hi @sebr. Does the api exposes the flow volume of the water?
That would be great to know in order to calulate the right duration of irrigaion.

@Pirol_62 it does - however my device does not report it because allegedly not enough water flows through the device to allow it to report a valid reading.

Can you please follow the instructions on this github issue and I will take a look and add it in. Please leave the api response as a comment on the github issue, thanks!

already done

Thanks especially to @billchurch and @sebr . I found @billchurch’s initial investigation into the web socket very useful and encouraging. My interest was not so much repeating what the bhyve app already provides. It already does a decent job of controlling the sprinklers.

My interest was in monitoring detailed water usage. I live in California, where water is expensive. and i have a large yard (2 acres), where the irrigation lines run to distant places. Frequently the remote lines get chewed up by rodents and coyotes, resulting in a LOT of wasted water, and I was getting tired of having to inspect all the lines at watering time. I really needed a solution for this, and the information on this page really motivated me to do some programming. (which I haven’t done for a long time).

So in my setup, I have the following elements:

  • Independent water meter on the main line of the irrigation like this
  • Esphome with esp8266 node cmu board, which takes pulses from the water meter and send to HA
  • InfluxDB time series database
  • Grafana for analysis and debugging
  • Perl scripts, to analyze the data (more familiar with Perl than Python)
  • HA scripts to centrally integrate everything.

For each zone and good watering event, I analyze the average and expected deviations and store a historical record in InfluxDB. For the current watering event, I rely on this historical data to determine whether there is an unexpected pipe break, or water usage over the expected rate.

So far, it is working quite well, and I can sleep a lot easier. The system is sensitive enough to identify a blown out drip head on 1/4 inch line. When that happens HA and associated scripts will send a command to shut down the current zone, and continue on the rest, as well as to send alerts to me.

Here is picture of some of the results:

1 Like

Hi @sebr
I already updated
Result:
The switch.zone_1 has not been recreated. There is no replacement
the binary sensor and battery level sensor entities are now new and named with _2
And I have an error in the log:

Error while setting up platform bhyve
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/bhyve/switch.py", line 44, in async_setup_platform
    hass, bhyve, device, zone, name, programs, "water-pump"
  File "/config/custom_components/bhyve/switch.py", line 64, in __init__
    super().__init__(hass, bhyve, device, name, icon, DEVICE_CLASS_SWITCH)
  File "/config/custom_components/bhyve/__init__.py", line 157, in __init__
    self._setup(device)
  File "/config/custom_components/bhyve/switch.py", line 111, in _setup
    self._set_watering_program(program)
  File "/config/custom_components/bhyve/switch.py", line 127, in _set_watering_program
    program_name = program.get("name", "Unknown")
NameError: name 'program' is not defined

Hi Sebr,
did something change at the repo? I cannot find a way to install it.

20-04-03 13:04:30 INFO (MainThread) [supervisor.store] Load add-ons from store: 68 all - 0 new - 0 remove
20-04-03 13:22:24 INFO (MainThread) [supervisor.store.git] Clone add-on https://github.com/sebr/bhyve-home-assistant repository
20-04-03 13:22:25 WARNING (MainThread) [supervisor.store.data] Can’t read /data/addons/git/c2eea46b/coffee_maker/config.json: required key not provided @ data[‘arch’]. Got None
20-04-03 13:22:25 WARNING (MainThread) [supervisor.store.data] Can’t read /data/addons/git/c2eea46b/sync/config.json: required key not provided @ data[‘arch’]. Got None
20-04-03 13:22:25 ERROR (MainThread) [supervisor.utils.json] Can’t read json from /data/addons/git/6e2ba233/repository.json: [Errno 2] No such file or directory: ‘/data/addons/git/6e2ba233/repository.json’
20-04-03 13:22:25 WARNING (MainThread) [supervisor.store.data] Can’t read repository information from /data/addons/git/6e2ba233/repository.json
20-04-03 13:22:25 INFO (MainThread) [supervisor.store] Load add-ons from store: 68 all - 0 new - 0 remove

Thanks!

Nope nothing has changed, are you using HACS? Looks like you have a few other errors there which aren’t related to the b-hyve integration?

I’ve been using the Homebridge plugin to control my Orbit Bhyve from HomeKit. It works well and most importantly has timers in the Home app. Unfortunately it only supports 4 zones.

Has anyone tried controlling their Orbit Bhyve through HomeKit with this Home Assistant integration? And can you see the timers?

Hi, I’m a little confused about the switch.
Obviously it is not possible, to stop the switch via script before the in the app configured runtime is finished.
My use case: Configure a default runtime of 45 Minutes.
For less use, write a script which starts the switch, delay 15 Minutes and then stop.
That doesen’t work:
I wrote following script:

command_start_irrigation:
  sequence:
  - service: logbook.log
    data_template:
      name: 'irrigation'
      message: 'has been triggered'
  - service: switch.turn_on
    entity_id: switch.zone_1_zone
  - delay: '00:15:00'
  - service: switch.turn_off
    entity_id: switch.zone_1_zone
  - service: logbook.log
    data_template:
      name: 'irrigation'
      message: 'has been stopped'

The result: The switch has been started, but then nothing: no log-entry and no stop. I had to stop the switch manual or wait until the preconfigured time runs out.
Then I separated the script into two single ones, start irrigation and stop irrigation.
I exposed both scripts to alexa, built a routine, start, wait 15 Min, stop.
Result: the switch has been started and then nothing. the irrigation always stops after the prconfigured 45 Minutes.
So it has nothing to do with HA itself or with wrong scripts. It seem to be a special behavior initiated by the switch.

For the time being, I reduced the runtime in the bHyve app and simply exposed the switch to alexa.
Does anybody have an idea how to realize what I intend to do?

Can it be, that the switch doesn’t “report” the succesful start to the interface and executing apps waiting for a result. It seems that the script never came back from the switch.turn_on. That’s why the log entries never have been created

I just installed the latest version .0.1.12 - (new, never before used) and was curious as to what entities I can expect to be available, as well as their content.

I seem to see the ‘status’ of each zone, being able to turn on a zone, battery (if present) and rain delay. Are these the only exposed sensors? I’m not interested in the switches to turn off / on for the most part as I can do that via TTS to smart speaker or from the B-Hyve app.

As an example of what I see, for the Status, I manually turned on a single zone from the B-Hyve App, and saw that HA got updated, showing all zones as ‘Manual’, but not showing that a single zone was ‘watering’ vs the others being left alone. Once it was finished watering that single zone, all zones updated to show as ‘auto’.

Main Entities:

Manually Watered Zone for 30 Minutes:
image

Non-Watered Zone, matching the Front Yard that was watered:
image

Can I obtain whether or not a zone is running (single zone), for how long (say I set it to 30 minutes via the app), and also the time / duration of the last watering? I utilized the smart watering feature so it will automatically adjust watering days / duration and I hope not to go into the app to view this.

I won’t be doing automation from inside of HA as I’ll let the B-Hyve adjust itself, but I’m looking to get all the same information extracted and into HA to view as it’s own Lovelace tab.

Thanks!

Hi,
the switch provides the info in his attributes, on or off, the preset of runtime and if smart watering is enabled.
image
If you records the switch, you can see the history of activation time and duration
For me, this is all I need. And yes: I have an automation running in dependency of the total of rain during the last 7 days and the last day.