Skip to content

Instantly share code, notes, and snippets.

@gyoza
Created January 28, 2023 22:14
Show Gist options
  • Save gyoza/55ad99a35a6bc8699cd697d74ca358ba to your computer and use it in GitHub Desktop.
Save gyoza/55ad99a35a6bc8699cd697d74ca358ba to your computer and use it in GitHub Desktop.
home-automation script: check outside humidity and turn on fresh_air fan
sequence:
- if:
- condition: template
value_template: >-
{{
int(states('sensor.openweathermap_humidity')|regex_replace(find='%',
replace='', ignorecase=False)) > 25}}
- condition: template
value_template: >-
{{
int(states('sensor.openweathermap_temperature')|regex_replace(find='°F',
replace='', ignorecase=False)) < 80 }}
- condition: template
value_template: >-
{{
int(states('sensor.openweathermap_temperature')|regex_replace(find='°F',
replace='', ignorecase=False)) > 25 }}
then:
- type: turn_on
device_id: xxx
entity_id: switch.fresh_air
domain: switch
else:
- type: turn_off
device_id: xxx
entity_id: switch.fresh_air
domain: switch
alias: Outside Humidity Detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment