Skip to content

Instantly share code, notes, and snippets.

@pewu78
Created August 13, 2023 14:23
Show Gist options
  • Save pewu78/c2b44c0252af46f657bccf7e46922da8 to your computer and use it in GitHub Desktop.
Save pewu78/c2b44c0252af46f657bccf7e46922da8 to your computer and use it in GitHub Desktop.
Smart Irrigation Automation Example
alias: Smart Irrigation
description: Run Smart Irrigation
trigger:
- platform: event
event_type: Smart_Irrigation_start
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.smart_irrigation_daily_adjusted_run_time
above: 0
enabled: true
- condition: numeric_state
entity_id: sensor.smart_irrigation_hourly_adjusted_run_time
above: 0
enabled: false
alias: Check current hourly run time, not used currently
- condition: state
entity_id: binary_sensor.front_lawn_soil_moisture
state: "off"
for:
hours: 4
minutes: 0
seconds: 0
enabled: false
alias: Check if lawn soil moisture sensor readings are 'dry' for at least 4 hours, not used currently
- condition: template
value_template: >-
{{ (states('sensor.smart_irrigation_bucket') | float(default=0) +
states('sensor.openweathermap_forecast_precipitation') |
float(default=0)) < 0 }}
alias: Test if bucket + forecast precipitation < 0
action:
- service: number.set_value
data:
value: "{{states('sensor.smart_irrigation_daily_adjusted_run_time')}}"
target:
entity_id: number.front_lawn_run_duration
- service: switch.turn_on
data: {}
target:
entity_id: switch.front_lawn
- delay:
seconds: "{{states('sensor.smart_irrigation_daily_adjusted_run_time')}}"
alias: Delay for run time
- service: smart_irrigation.smart_irrigation_reset_bucket
data: {}
alias: Reset Bucket
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment