Last tested on OS API 2.2.0
and Home Assistant 2024.2.0
To have a Lovelace card for the UI, opensprinkler-card can be used.
custom_components/opensprinkler
folder into <config_dir>/custom_components
Configuration
then Integrations
. Click on the add integration button at the bottom right and select OpenSprinkler
. Fill out the options and save.
http://<ip or host>:<port>
. The port can be omitted unless you have changed it, as the default port for OpenSprinkler is 80
. SSL (HTTPS) is also supported.Note: 1.0.0 has major breaking changes, you will need to update any automations, scripts, etc
hass_opensprinkler
folder in <config_dir>/custom_components
opensprinkler.run
and opensprinkler.stop
services to run and stop stations.opensprinkler.run
service to run programs.Available services are opensprinkler.run
for programs, stations and controllers (for running once program), and opensprinkler.stop
for stations or controller (to stop all stations).
service: opensprinkler.run
data:
entity_id: switch.program_name # Switches or sensors for programs
service: opensprinkler.run
data:
entity_id: switch.station_name # Switches or sensors for stations
run_seconds: 60 # Seconds to run (optional, defaults to 60 seconds)
To run an once program, the run seconds can either be a list of seconds per station or a list of index and second pairs. The following examples are all equivalent.
service: opensprinkler.run
data:
entity_id: switch.controller_name # Switches or sensors for controller
run_seconds: # Seconds to run for each station (required)
- 60
- 0
- 30
service: opensprinkler.run
data:
entity_id: switch.controller_name # Switches or sensors for controller
run_seconds: # List of station index and run seconds pairs (required)
- index: 0
run_seconds: 60
- index: 2
run_seconds: 30
service: opensprinkler.run
data:
entity_id: switch.controller_name # Switches or sensors for controller
run_seconds: # Dictionary of station index and run seconds key/value pairs (required)
0: 60
2: 30
By default running once program will stop all other stations that are running, you can specify
continue_running_stations
to true to allow the stations to continue running. This only works when
specifying the run seconds in index/second pairs.
service: opensprinkler.run
data:
entity_id: switch.controller_name # Switches or sensors for controller
run_seconds: # List of station index and run seconds pairs (required)
- index: 0
run_seconds: 60
- index: 2
run_seconds: 30
continue_running_stations: True # Whether to keep running stations running (optional, defaults to False)
service: opensprinkler.run
data:
entity_id: switch.controller_name # Switches or sensors for controller
run_seconds: # Dictionary of station index and run seconds key/value pairs (required)
0: 60
2: 30
continue_running_stations: True # Whether to keep running stations running (optional, defaults to False)
service: opensprinkler.stop
data:
entity_id: switch.station_name # Switches or sensors for stations
service: opensprinkler.stop
data:
entity_id: switch.controller_name # Switches or sensors for controller
This sets the water level to 50%, i.e. all stations will run half of their normally configured time.
service: opensprinkler.set_water_level
data:
entity_id: sensor.opensprinkler_water_level
water_level: 50
This sets the rain delay of the controller to 6 hours, i.e. all stations will stop and programs will not run until the rain delay time is over.
service: opensprinkler.set_rain_delay
data:
entity_id: sensor.opensprinkler_rain_delay_stop_time
rain_delay: 6
This pauses the station runs for 10 minutes (600 seconds), resuming afterwards.
service: opensprinkler.pause_stations
data:
entity_id: sensor.opensprinkler_pause_end_time
pause_duration: 600
This reboots the controller.
service: opensprinkler.reboot
data:
entity_id: switch.opensprinkler_enabled
If you wish to have a switch for your stations, here is an example using the switch template and input number.
Add the following to your YAML configuration (configuration.yaml
).
switch:
- platform: template
switches:
fruits_station:
value_template: "{{ is_state('binary_sensor.s01_station_running', 'on') }}"
turn_on:
service: opensprinkler.run
data_template:
entity_id: binary_sensor.s01_station_running
# Run seconds uses the input_number below.
run_seconds: "{{ ((states('input_number.s01_station_minutes') | float) * 60) | int }}"
turn_off:
service: opensprinkler.stop
data:
entity_id: binary_sensor.s01_station_running
input_number:
s01_station_minutes:
initial: 1
min: 1
max: 10
step: 1