Skip to content

Instantly share code, notes, and snippets.

@nelsonblaha
Created August 18, 2021 20:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelsonblaha/26f1e9d0fe791b40bcc8a3e3f14bc352 to your computer and use it in GitHub Desktop.
Save nelsonblaha/26f1e9d0fe791b40bcc8a3e3f14bc352 to your computer and use it in GitHub Desktop.
Home Assistant Automations to update input_number.lawn_wetness
- id: '1511485012754'
alias: Update Lawn Wetness Rain
trigger:
- platform: state
entity_id: sensor.openweathermap_rain
- platform: state
entity_id: sensor.openweathermap_forecast_precipitation
condition: []
action:
- data_template:
entity_id: input_number.lawn_wetness
value: "{{ ( states('input_number.lawn_wetness') | float ) + ( (states('sensor.openweathermap_rain') | float) * (states('input_number.lawn_wetness_rain_coefficient') | float) ) | float }}"
service: input_number.set_value
- id: '1521415012754'
alias: Update Lawn Wetness Sprinkler
trigger:
- platform: state
entity_id: binary_sensor.rotors_running
to: 'on'
condition: []
action:
- data_template:
entity_id: input_number.lawn_wetness
value: "{{ ( states('input_number.lawn_wetness') | int ) + 5 }}"
service: input_number.set_value
- id: '1541485012731'
alias: Update Lawn Wetness UV
trigger:
- platform: state
entity_id: sensor.openweathermap_uv_index
condition: []
action:
- data_template:
entity_id: input_number.lawn_wetness
value: >-
{% if states('input_number.lawn_wetness') | int - states('sensor.openweathermap_uv_index') | int <= 0 -%}
0
{%- else -%}
{{ states('input_number.lawn_wetness') | int - states('sensor.openweathermap_uv_index') | int }}
{%- endif %}
service: input_number.set_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment