OpenSprinkler Bee 2.0 (OSBee)

Hi I bought and installed 1 year ago this:
https://rayshobby.net/wordpress/opensprinkler-bee/

It is a reduced version of OpenSprinkler for latching solenoid valves and only 3 zones. You can access it via web but it does not have any rain delay control. It has a rest API interface.
I have not created an integration (there is one for the OpenSprinkler, but not for the OSBee). However, by using rest commands I have managed to automate from HA a rain delay control.
I think not many people has this version but just in case it could be useful for anybody, here it is my code to be able to control my sprinkler programs in case it rains. I think the code is self-explanatory but, if someone needs to use it and needs some help, just let me know:

Inside configuration.yaml:

input_boolean:
  rainy:
    name: rainy
    icon: mdi:weather-pouring

Just to control if it is rainy or not.

input_text:
  osbee_url:
    initial: !secret opensprinklerbee_devip_changePrograms

…where I keep the beginning of the URL to change a sprinkler program.

rest_command:
 disable_osbee_programs:
   url: "{{ states('sensor.osbee_programs_disabled') }}"
 enable_osbee_programs:
   url: "{{ states('sensor.osbee_programs_enabled') }}"


sensor:  
  - platform: rest
    method: GET
    name: programas_osbee
    resource: !secret opensprinklerbee_devip_getPrograms
    json_attributes:
      - progs
  - platform: template
    sensors:
      osbee_programs_disabled:
        friendly_name: 'osbee_to_disable'
        entity_id: sensor.osbee_to_disable
        value_template: >-
          {% set ns = namespace (progstochange=[]) %}
          {%- for p in states.sensor.programas_osbee.attributes.progs -%}
            {% set myString=(states('input_text.osbee_url')|string+"&pid="+(loop.index-1)|string +"&name="+p.name+"&pt="+p.pt|string +"&sts="+p.sts|string+
                "&nt="+p.nt|string+"&config="+(p.config - 1 if p.config % 2 != 0 else p.config)|string).replace(" ","") %}    
            {% set ns.progstochange = ns.progstochange+[myString] %}            
          {%- endfor -%}
          {{ns.progstochange[0]}}
      osbee_programs_enabled:
        friendly_name: 'osbee_to_enable'
        entity_id: sensor.osbee_to_enable
        value_template: >-
          {% set ns = namespace (progstochange=[]) %}
          {%- for p in states.sensor.programas_osbee.attributes.progs -%}
            {% set myString=(states('input_text.osbee_url')|string+"&pid="+(loop.index-1)|string +"&name="+p.name+"&pt="+p.pt|string +"&sts="+p.sts|string+
                "&nt="+p.nt|string+"&config="+(p.config + 1 if p.config % 2 == 0 else p.config)|string).replace(" ","") %}    
            {% set ns.progstochange = ns.progstochange+[myString] %}            
          {%- endfor -%}
          {{ns.progstochange[0]}}

En automations.yaml:

- id: '1574011018002'
  alias: Activar rainy
  description: ''
  trigger:
  - above: '0.1'
    entity_id: sensor.dark_sky_precip_intensity
    for:
      minutes: 15
    platform: numeric_state
  condition:
  - condition: state
    entity_id: input_boolean.rainy
    state: '''off'''
  action:
  - data:
      entity_id: input_boolean.rainy
    service: input_boolean.turn_on
- id: '1574032736604'
  alias: Desactivar rainy
  description: ''
  trigger:
  - below: '0.03'
    entity_id: sensor.dark_sky_precip_intensity
    for:
      hours: 22
    platform: numeric_state
  condition:
  - condition: state
    entity_id: input_boolean.rainy
    state: '''on'''
  action:
  - data:
      entity_id: input_boolean.rainy
    service: input_boolean.turn_off


- id: '1560524856544'
  alias: Quitar riego por lluvia
  trigger:
  - entity_id: input_boolean.rainy
    from: 'off'
    platform: state
    to: 'on'
  action:
  - service: rest_command.disable_osbee_programs
  - data_template:
      message: '{{ as_timestamp(now()) | timestamp_custom(''%H:%M'', true) }} - Se
        ha desactivado el programa de riego por que existe previsión de lluvia.'
    service: notify.tele_cocina
  - data_template:
      message: '{{ as_timestamp(now()) | timestamp_custom(''%H:%M'', true) }} - Se
        ha desactivado el programa de riego porque existe previsión de lluvia.'
    service: notify.my_notifier
  - data_template:
      master: living
      volume: 0.5
      what: Hola. Se ha desactivado el programa de riego porque existe previsión de
        lluvia.
    service: script.sonos_tts_todos

- id: '1574010069514'
  alias: Reactivar riego por parar lluvia
  description: ''
  trigger:
  - entity_id: input_boolean.rainy
    platform: state
    to: 'off'
  condition: []
  action:
  - service: rest_command.enable_osbee_programs
  - data_template:
      message: '{{ as_timestamp(now()) | timestamp_custom(''%H:%M'', true) }} - Se
        ha reactivado el programa de riego por parar la previsión de lluvia.'
    service: notify.tele_cocina
  - data_template:
      message: '{{ as_timestamp(now()) | timestamp_custom(''%H:%M'', true) }} - Se
        ha reactivado el programa de riego por parar la previsión de lluvia.'
    service: notify.my_notifier
  - data_template:
      master: living
      volume: 0.5
      what: Hola. Se ha reactivado el programa de riego por parar la previsión de
        lluvia.
    service: script.sonos_tts_todos
2 Likes

Very nice, thanks for sharing. I think this version of OpenSprinkler will become more popular in the next months.

Apart from this rain delay control, have you been looking at possible ways to create an integration, any idea or suggestion?

1 Like

Hi, @msanchezt thank you. I don’t know yet how to do a complete integration with HA, I may study/investigate it a bit if I have the time. It would be nice to be able to program it completely from HA’s frontend. Now it covers my automation needs (rain delay control), but for sure, it would be great.

What makes the osbee a bit more difficult is that the remaining time for each of three relays (ie valves) needs to be given on the http GET.

For example, if I open 1 & 2 (45 minutes and 7 minutes) then 2 minutes later I want to turn on number 3, I need to give the remaining 43 minutes and 5 minutes for the other two relays. This means a bit of state-management but not much.

I’ve got an osbee controlling an Orbit 3-valve manifold, maybe I’ll get a chance to poke at this.

Just got myself an OSBee, running firmware v1.0.2… Been playing with it a bit.

Perhaps this weekend I will be able to get a little more acquainted with it…

Going to try 2 things:

  1. Postman collection of the API endpoints
  2. HASS HACS extension that supports local connection and operation! (I don’t like dealing with calendars tho, so tedious)

Anybody got anything to share in the meantime? I’m going to go get some piping from the hardware store at lunchtime so that I can get it all hooked up :call_me_hand:

1 Like

hi ,
i also orderd os bee , looks very nice! I plan to use a higrow sensor, cause i want to water my glashouse.
Did you get the endpoints or did u startet with the integration ?
Best regards
Michael

Heya. I’m currently (~2 weeks now) using the code at my GitHub - chickenandpork/hass-osbee: Simple integration for OpenSprinkler Bee (OSBee) irrigation controller in Home Assistant but it’s not an optimal config. It’s working though, and I’ll probably add some config items.

Currently, pre-HACS, usage is “copy the osbee directory from this custom_components to yours, restart Hass, and copy the example config”

What I’m not happy with:

  • the config is repetitive; I wanted to add just a single platform config, as noted in the README
  • the current version has a race-condition when activating two valves at once
  • the current config has the default password/token hard-coded to ship a working thing

I’ve fixed the race-condition with a simple mutex, but it’s clearly not eloquent code. I’ll publish that likely today.

You can see that repo is setup as a HACS component, but when choosing an icon – different platform and icon than opensprinkler – I kinda felt there was a better way to do osbee. If anyone chooses an icon, I’ll continue the steps to HACS-ify it.