Skip to content

Commit

Permalink
feat: introduce blueprint for warm outside automation
Browse files Browse the repository at this point in the history
  • Loading branch information
TribuneX committed Jun 30, 2024
1 parent 98a4b8f commit 7d83b61
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 26 deletions.
31 changes: 7 additions & 24 deletions automation/environment/temperature.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
- alias: "Temperature: Warmer outside"
initial_state: "on"
trigger:
- platform: numeric_state
entity_id: sensor.out_vs_in
above: 0
condition:
condition: and
conditions:
- condition: state
entity_id: group.personen
state: "home"
- condition: numeric_state
entity_id: "sensor.outdoor_temperature"
above: "20"
- condition: state
entity_id: binary_sensor.balcony_door
state: "on"
action:
- service: notify.devices_user_1
data:
title: "Doors"
message: "Close the living room doors, since it is {{states('sensor.out_vs_in')}}°C warmer outside."
use_blueprint:
path: temperature_outside.yaml
input:
out_vs_in: sensor.livingroom_out_vs_in
input_group_windows: binary_sensor.livingroom_doors

- alias: "Temperature: Colder outside"
initial_state: "on"
trigger:
- platform: numeric_state
entity_id: sensor.out_vs_in
entity_id: sensor.livingroom_out_vs_in
below: -2
condition:
condition: and
Expand All @@ -44,7 +27,7 @@
- service: notify.devices_user_1
data:
title: "Doors"
message: "Open the balcony door, since it is {{states('sensor.out_vs_in')}}°C colder outside."
message: "Open the balcony door, since it is {{states('sensor.livingroom_out_vs_in')}}°C colder outside."

- alias: "Humidity warning"
initial_state: "on"
Expand Down
51 changes: 51 additions & 0 deletions blueprints/automation/temperature_outside.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
blueprint:
name: Warmer outside
description: Send notification if warmer outside
domain: automation
input:
out_vs_in:
name: out_vs_in
description: The sensor calulating the diff betwenn a specific room and outdoor temperature
selector:
entity:
domain: sensor
input_group_windows:
name: Open Windows
description: The group of windows in the room
selector:
entity:
domain: binary_sensor
device_class: opening

variables:
group_windows: !input input_group_windows

trigger:
platform: numeric_state
entity_id: !input out_vs_in
above: 0
condition:
condition: and
conditions:
- condition: state
entity_id: group.personen
state: "home"
- condition: numeric_state
entity_id: "sensor.outdoor_temperature"
above: "20"
- condition: state
entity_id: !input input_group_windows
state: "on"
action:
- service: notify.devices_user_1
data:
title: "Doors"
message: >
Close the follwing doors, since it is {{states('sensor.livingroom_out_vs_in')}}°C warmer outside:
{%- for entity_id in states.{{ group_windows }}.attributes.entity_id if states(entity_id) == 'on' -%}
{%- if loop.first %}Open Doors: {% endif -%}
{{state_attr(entity_id, 'friendly_name') }}
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
message: "Close the {{ room_name }} doors, since it is {{states('sensor.livingroom_out_vs_in')}}°C warmer outside."
7 changes: 7 additions & 0 deletions includes/binary_sensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@
seconds: 60
value_template: >
{{states('sensor.outdoor_illumination')|int < 8}}
- platform: group
name: "Livingroom Doors"
device_class: opening
entities:
- binary_sensor.balcony_door
- binary_sensor.living_room_balcony_door
2 changes: 1 addition & 1 deletion includes/exclude.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
entities:
- sensor.network_in_eth0
- sensor.network_out_eth0
- sensor.out_vs_in
- sensor.livingroom_out_vs_in
- sensor.tribunex_home_assistant_last_build_state
- sensor.illumination_gateway
- sensor.palme_battery
Expand Down
8 changes: 7 additions & 1 deletion includes/sensors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
- platform: template
sensors:
# Inspired by https://community.home-assistant.io/t/temp-compare/19497
out_vs_in:
livingroom_out_vs_in:
value_template: "{{ (states('sensor.outdoor_temperature') | float) - (states('sensor.livingroom_temperature') | float) }}"
friendly_name: "Temperature Diff"
unit_of_measurement: '°C'

bedroom_out_vs_in:
value_template: "{{ (states('sensor.outdoor_temperature') | float) - (states('sensor.bedroom_temperature') | float) }}"
friendly_name: "Temperature Diff"
unit_of_measurement: '°C'

robo:
friendly_name: "Robo"
Expand Down

0 comments on commit 7d83b61

Please sign in to comment.