Skip to content

Commit

Permalink
Rain debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrLipp committed Jun 7, 2023
1 parent 77f1b37 commit 9faae7e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/automations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
32 changes: 32 additions & 0 deletions config/packages/familie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Filter to: home kann entfernt werden, wenn man die anderen Meldungen auch haben möchte.
# Weitere Personen können einfach hinzugefügt werden.
# Siehe https://community.home-assistant.io/t/error-rendering-data-template-undefinederror-dict-object-has-no-attribute-from-state/325386/12

automation:
- id: '1681559151264'
alias: 'Notify: Familienmitglied kommt heim'
description: ''
trigger:
- platform: state
entity_id:
- person.anna_mavie
to: home
condition: "{{ trigger.to_state.state != trigger.from_state.state }}"
action:
- variables:
old: "{{ trigger.from_state.state }}"
new: "{{ trigger.to_state.state }}"
person: "{{ trigger.to_state.name }}"
- service: notify.telegram_admin
data:
message: >
{% if new == "not_home" and old == "home"%}
{{ person }} ist weg gegangen.
{% elif new == "home" %}
{{ person }} ist zuhause.
{% elif new == "not_home" %}
{{ person }} ist von {{ old }} weg.
{% else %}
{{ person }} ist in {{ new }} angekommen.
{% endif %}
mode: single
8 changes: 4 additions & 4 deletions config/packages/rain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ binary_sensor:
delay_off:
minutes: 30
value_template: >-
{{ states('sensor.netatmo_rain_changes')|float(0) > 0.1 }}
{{ states('sensor.netatmo_rain_changes')|float(0) >= 0.1 }}
template:
- trigger:
Expand All @@ -45,14 +45,16 @@ template:
{% if trigger.platform == 'homeassistant' %}
0.0
{% elif trigger.entity_id == 'sensor.netatmo_pottelsdorf_rain_today' %}
{% set delta = trigger.to_state.state|float(0) - trigger.from_state.state|float(0) %}
{% set delta = (trigger.to_state.state|float(0) - trigger.from_state.state|float(0))| round(1) %}
{{ delta if delta > 0.0 else 0.0 }}
{% elif trigger.entity_id == 'sensor.netatmo_pottelsdorf_rain' %}
{% if trigger.to_state.state|float(0) == 0.0 %}
0.0
{% else %}
{{ states('sensor.netatmo_rain_changes') | float(0) }}
{% endif %}
{% else %}
100.0
{% endif %}
unit_of_measurement: mm
icon: mdi:weather-rainy
Expand Down Expand Up @@ -116,8 +118,6 @@ automation:
- platform: state
entity_id:
- sensor.netatmo_rain_changes
condition:
- "{{ trigger.to_state.state|float(0) <= 0.1 }}"
action:
- service: notify.telegram_admin
data:
Expand Down

0 comments on commit 9faae7e

Please sign in to comment.