Integrate with OpenSprinkler

How do you get flow rate, what hardware?

I use a Cyble Sensor V2 which attaches nicely to the top of my mains water meter.

Hi vinteo, thanks a lot for this integration. It is really essential now, once IFTTT is not free anymore.
Can you please make numeric sensors for the last run water volume of each station?
Thanks
Eyal

I am not sure that should be the responsibility of the integration, you could probably get that working with a combination of the the template sensor, flow rate sensor and the start/end time attributes of the station sensors with automations.

Thank you vinteo.

If no one did it before I will probably do it:

  • For each station whenever station status <> “idle”, accumulating flow_rate for averaging.

  • multiply the average flow rate by last_run.duration

  • Notify if water volume is not in the reasonable range for this station.

Hey Vincent
How do I stop all stations?
The doco says:

service: opensprinkler.stop
data:
  entity_id: switch.controller_name # Switches or sensors for controller

But I don’t see a switch with the “controller_name”. I assume my controller name is just opensprinkler, but there is no “switch.opensprinkler”. There is an enabler switch -> switch.opensprinkler_enabled, but this doesn’t stop all stations.
Any help appreciated

1 Like

OK,
Here is my implementation.
It send once a day notification to HA app, with irrigation volume of each station.
many thanks to vinteo for the intergration.

input_number:

current_irr:
    name: current irr 
    initial: 0
    min: 0
    max: 1000000
    step: 0.1
    mode: box
    unit_of_measurement: 'l/m'
irr_st_1:
    name: irr st_1 
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'
irr_st_2:
    name: irr st_2
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'
irr_st_3:
    name: irr st_3
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'
irr_st_4:
    name: irr st_4
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'
irr_st_5:
    name: irr st_5
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'
irr_st_6:
    name: irr st_6
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'
irr_unknown:
    name: irr unknown
    initial: 0
    min: 0
    max: 1000
    step: 0.1
    mode: box
    unit_of_measurement: 'liter'

automations:

 
- alias: "accumulate irrigation"
  trigger:
      platform: numeric_state
      entity_id: sensor.gina_haviva_flow_rate
      above: 0
  action:
    repeat:
      sequence:
        - service: input_number.set_value
          data_template:
                  entity_id: input_number.current_irr
                  value: "{{ (states('sensor.gina_haviva_flow_rate')) | multiply(0.000167)| float | round(3)}}"
                     #divid by (calibration fator * 6 readings per minute)
        - delay: 00:00:10 #The delay is here to consumpt the time that irrigation start but sensor show 0
        - choose:
          - conditions:
              - condition: state
                entity_id: binary_sensor.st_1_station_running 
                state: "on"
            sequence:
              - service: input_number.set_value
                data:
                  entity_id: input_number.irr_st_1
                  value: "{{(states('input_number.irr_st_1'))| float| round(1) + (states('input_number.current_irr')) | float| round(2)}}"
          - conditions:
              - condition: state
                entity_id: binary_sensor.st_2_station_running 
                state: "on"
            sequence:
              - service: input_number.set_value
                data:
                  entity_id: input_number.irr_st_2
                  value: "{{(states('input_number.irr_st_2'))| float| round(1) + (states('input_number.current_irr')) | float| round(1)}}"
          - conditions:
              - condition: state
                entity_id: binary_sensor.st_3_station_running 
                state: "on"
            sequence:
              - service: input_number.set_value
                data:
                  entity_id: input_number.irr_st_3
                  value: "{{(states('input_number.irr_st_3'))| float| round(1) + (states('input_number.current_irr')) | float| round(1)}}"
          - conditions:
              - condition: state
                entity_id: binary_sensor.st_4_station_running 
                state: "on"
            sequence:
              - service: input_number.set_value
                data:
                  entity_id: input_number.irr_st_4
                  value: "{{(states('input_number.irr_st_4'))| float| round(1) + (states('input_number.current_irr')) | float| round(1)}}"
          - conditions:
              - condition: state
                entity_id: binary_sensor.st_5_station_running 
                state: "on"
            sequence:
              - service: input_number.set_value
                data:
                  entity_id: input_number.irr_st_5
                  value: "{{(states('input_number.irr_st_5'))| float| round(1) + (states('input_number.current_irr')) | float| round(1)}}"
          - conditions:
              - condition: state
                entity_id: binary_sensor.st_6_station_running 
                state: "on"
            sequence:
              - service: input_number.set_value
                data:
                  entity_id: input_number.irr_st_6
                  value: "{{(states('input_number.irr_st_6'))| float| round(1) + (states('input_number.current_irr')) | float| round(1)}}"
          default:
            - service: input_number.set_value
              data:
                  entity_id: input_number.irr_unknown
                  value: "{{(states('input_number.irr_unknown'))| float| round(1) + (states('input_number.current_irr')) | float| round(1)}}"
      until:
              condition: numeric_state
              entity_id: sensor.gina_haviva_flow_rate
              below: 0.00001
            

- alias: Notify irrigation
  initial_state: 'on'
  trigger:
    platform: time
    at: '10:00:00'
  action:
    - service: notify.mobile_app_gm1910
      data:
          title: Irrigation report
          message: " אחוז השקיה  {{ (states('sensor.gina_haviva_water_level'))}} % \n
               aaa  {{ (states('input_number.irr_st_1'))| round(1)}}\n
               bbb  {{ (states('input_number.irr_st_2'))| round(1)}}\n
               ccc  {{ (states('input_number.irr_st_3'))| round(1)}}
               ddd  {{ (states('input_number.irr_st_4'))| round(1)}}
               eee  {{ (states('input_number.irr_st_5')| round(1))}}
               fff  {{ (states('input_number.irr_st_6'))| round(1)}}
               unknown  {{ (states('input_number.irr_unknown'))| round(1)}}"
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_st_1
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_st_2
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_st_3
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_st_4
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_st_5
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_st_6
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.irr_unknown
                  value: 0 
    - service: input_number.set_value
      data:
                  entity_id: input_number.current_irr
                  value: 0 

Hi there, my OpenSprinkler Pi kit just arrived today. Did anyone succeed in getting it to operate on the same Pi as HASSIO?
I think it would be great if vinteo’s repository could be made to work with this most basic configuration as well!

I add this into my configuration.yaml file (just after “scene: !include scenes.yaml”):

!include switches.yaml:

This the content of the switches.yaml file

- platform: template
  switches:
     sprinkler_front_s1:
        value_template: "{{ is_state('binary_sensor.sprinkler_front_s1_station_running', 'on') }}"
        turn_on:
          service: opensprinkler.run
          data_template:
            entity_id: binary_sensor.sprinkler_front_s1_station_running
            # Run seconds uses the input_number below.
            run_seconds: "{{ ((states('input_number.sprinkler_front_s1_station_minutes') | float) * 60) | int }}"
        turn_off:
          service: opensprinkler.stop
          data:
            entity_id: binary_sensor.sprinkler_front_s1_station_running 
     sprinkler_front_s2:
        value_template: "{{ is_state('binary_sensor.sprinkler_front_s2_station_running', 'on') }}"
        turn_on:
          service: opensprinkler.run
          data_template:
            entity_id: binary_sensor.sprinkler_front_s2_station_running
            # Run seconds uses the input_number below.
            run_seconds: "{{ ((states('input_number.sprinkler_front_s2_station_minutes') | float) * 60) | int }}"
        turn_off:
          service: opensprinkler.stop
          data:
            entity_id: binary_sensor.sprinkler_front_s2_station_running

And I put this into my configuration.yaml:

input_number:
  sprinkler_front_s1_station_minutes:
    initial: 10
    min: 10
    max: 60
    step: 10  
  sprinkler_front_s2_station_minutes:
    initial: 10
    min: 10
    max: 60
    step: 10

And then I created an entities card with the following entries in the code editor (on entities):

entities:
  - entity: switch.sprinkler_front_s1
    name: On/Off
    secondary_info: last-changed
  - entity: input_number.sprinkler_front_s1_station_minutes
    name: Duration
  - entity: sensor.sprinkler_front_s1_station_status
type: entities
show_header_toggle: false
title: Front Sprinkler 1

I add this into my configuration.yaml file (just after “scene: !include scenes.yaml”):

!include switches.yaml:

This the content of the switches.yaml file

- platform: template
  switches:
     sprinkler_front_s1:
        value_template: "{{ is_state('binary_sensor.sprinkler_front_s1_station_running', 'on') }}"
        turn_on:
          service: opensprinkler.run
          data_template:
            entity_id: binary_sensor.sprinkler_front_s1_station_running
            # Run seconds uses the input_number below.
            run_seconds: "{{ ((states('input_number.sprinkler_front_s1_station_minutes') | float) * 60) | int }}"
        turn_off:
          service: opensprinkler.stop
          data:
            entity_id: binary_sensor.sprinkler_front_s1_station_running 
     sprinkler_front_s2:
        value_template: "{{ is_state('binary_sensor.sprinkler_front_s2_station_running', 'on') }}"
        turn_on:
          service: opensprinkler.run
          data_template:
            entity_id: binary_sensor.sprinkler_front_s2_station_running
            # Run seconds uses the input_number below.
            run_seconds: "{{ ((states('input_number.sprinkler_front_s2_station_minutes') | float) * 60) | int }}"
        turn_off:
          service: opensprinkler.stop
          data:
            entity_id: binary_sensor.sprinkler_front_s2_station_running

And I put this into my configuration.yaml:

input_number:
  sprinkler_front_s1_station_minutes:
    initial: 10
    min: 10
    max: 60
    step: 10  
  sprinkler_front_s2_station_minutes:
    initial: 10
    min: 10
    max: 60
    step: 10

And then I created an entities card with the following entries in the code editor (on entities):

entities:
  - entity: switch.sprinkler_front_s1
    name: On/Off
    secondary_info: last-changed
  - entity: input_number.sprinkler_front_s1_station_minutes
    name: Duration
  - entity: sensor.sprinkler_front_s1_station_status
type: entities
show_header_toggle: false
title: Front Sprinkler 1

Im also having issues with the stop all stations and run once program. My opensprinkler only has switch.opensprinkler_enabled entity…

script:
  os_stop_all:
    alias: 'opensprinkler stop all stations'
    sequence:   
    - service: opensprinkler.stop
      data:
        entity_id: switch.opensprinklerback_enabled # Switches or sensors for controller

does not work and

  os_back_run1:
    alias: 'opensprinkler back run one'
    sequence:   
    - service: opensprinkler.run
      data:
        entity_id: switch.opensprinklerback_enabled # Switches or sensors for controller
        run_seconds: # Seconds to run for each station (required)
          0: "10"
          1: "5"

also does not work.

Yep, stop all stations doesn’t work, I don’t have an opensprinkler switch either (switch.opensprinkler).
And “switch.opensprinkler_enabled” does nothing :frowning:

Update: Solved… I tried the Home Assistant App on my iPad and it was available there. Still nothing in Safari on my MBP.

Hi vinteo, I followed the HACS option in the guide but do not see the integration in Configurations -> Integrations after restarting Home Assistant.

I can see the downloaded open sprinkler files in custom_components/opensprinkler and can also see it in HACS -> Integrations.

I’m running Hassio (Home Assistant OS?) version 2020.12.2.

Am I missing something?

Thank you
Paul

::holding breath waiting on updates… almost dead::

is this integration not working anymore? i also only have the switch “enable” and not the switch to control any of my sprinklers.

I created a script to stop all the stations and then can call that script from the start scripts.

Script to stop all zones

stop_all_zones:
  alias: Stop All Zones
  sequence:
    - service: opensprinkler.stop
      data:
        entity_id: 
          - binary_sensor.s01_station_running
          - binary_sensor.s02_station_running
  mode: restart

and then the scripts to start each zone

run_garden_zone:
  alias: Run Garden Zone
  sequence:
    - service: script.stop_all_zones
    - delay:
        seconds: 2
    - data_template:
        run_seconds: '{{ ((states(''input_number.s01_station_minutes'') | float) * 60)
          | int }}'
      entity_id: binary_sensor.s01_station_running
      service: opensprinkler.run
  mode: single
  icon: mdi:sprinkler

but you have to manually list all zones you want to stop, defeating the ‘all zones’ part of goal function, whereas the original integration would do as such without listing exactly which zones. and kept the text lines minimal and able to work with variations that are outside of the text lines scripting.

I had the same issue. But after setting the service opensprinkler.stop to a sensor (eg. entity_id: binary_sensor.opensprinkler_sensor_1_active) instead to the station-switch it worked. The integration works nearly perfectly for my usecase. I can start and stop predefined programs. But also I‘m able to run individual stations with runtimes out of homeassinstant.

having multiple opensprinklers, I have over 40 zones on one and over 50 zones on another.

scrolling to find which zones are on and turn them off manually isnt even a cool option to me. disable all doesnt stop them when they are running.

if i create a script to send a close zone and have to send it 50 times going through each zone in the list of zones, i feel like a mad amount of send requests and the opensprinkler may not handle it. is there not a better way? anyone?

The restful API is pretty straight forward, you can use a rest comand like so

rest_command:
  opensprinkler_stop_all:
    url: "http://os-ip/cv?pw=opendoor&rsn=1"

Just insert your ip and password.

Actually, you need to MD5 your password which you can do online → http://www.md5.cz/

Then just add a button

type: button
icon: 'mdi:water-off'
tap_action:
  action: call-service
  service: rest_command.opensprinkler_stop_all
  service_data: {}
  target: {}
name: Stop All Stations