Integrate with OpenSprinkler

Looks like there is a bug somewhere, it should work if you the sensor instead

Seems to only work for the binary sensor right now

1 Like

Not sure what is the issue but it started working again after i restarted HA. Will investigate more

Well, how about that… I only tried the switch and the sensor as that’s how everyone else referenced their triggers, but binary sensor works for me. Let me know if you’d like any further detail!

Hey @vinteo,
Awesome work you have put into your integration.
I am interested in displaying the open sprinkler flow rate in a lovelace history card.
Unfortunately it comes out as a progress bar rather than a line graph.


I’ve read else where that this is caused due to unit_of_measurement not defined in the senor, but not sure where to go about changing that with your integration - I’m still a Home Assistant newbie.

Do you know what unit it is supposed to be based on your numbers? Litres (liters) per pulse?

In my application, I have it set to 1 pulse per litre.

Did you mean 1 litre per pulse? Sorry I don’t have flow sensor on my setup.

Yes that is correct, I use 1 litre per pulse.

There is also the option to Gal/pulse - so maybe other users might need the option to set that too.

I think the OS App does conversion from gal -> liter. Please try updating to v1.1.1 and see if it works for you now.

FIXED!


Fantastic work @vinteo, maybe next update change the description to ‘L/min’ but I’m happy to have the graph displayed correctly. Well done!
Let me know if I can help out with any testing of sorts.
Very excited about your integration - top work!

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