From d8fd3aeb833f91a61b08ad258adffb6253a8fbdb Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 6 Apr 2023 14:04:14 -0400 Subject: [PATCH] Found a new way to do age sensors, so I can actually share them now! --- .gitignore | 2 +- sensors/ages.yaml | 60 ++++++++++++++++++++++++++++++++++++++++ sensors/house_stats.yaml | 16 ----------- 3 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 sensors/ages.yaml diff --git a/.gitignore b/.gitignore index c69867f..8760801 100644 --- a/.gitignore +++ b/.gitignore @@ -69,7 +69,7 @@ **.log* **alexa_auth **.corrupt* -**ages.yaml +**ages_old.yaml # exceptions !/appdaemon/apps/ diff --git a/sensors/ages.yaml b/sensors/ages.yaml new file mode 100644 index 0000000..1fc182d --- /dev/null +++ b/sensors/ages.yaml @@ -0,0 +1,60 @@ +- platform: template + sensors: + tony_current_age: + friendly_name: 'Tony Current Age' + unique_id: a9178c12-6bc6-435d-9055-5e8adf31e2ff + value_template: "{{ state_attr('sensor.anniversary_tony_s_birthday','current_years') }}" + icon_template: > + {% if is_state('sensor.anniversary_tony_s_birthday','0') %} + mdi:cake + {% else %} + mdi:eye + {% endif %} + tina_current_age: + friendly_name: 'Tina Current Age' + unique_id: 56453052-150c-47bf-a351-2f8ce0d43378 + value_template: "{{ state_attr('sensor.anniversary_tina_s_birthday','current_years') }}" + icon_template: > + {% if is_state('sensor.anniversary_tina_s_birthday','0') %} + mdi:cake + {% else %} + mdi:eye + {% endif %} + kallen_current_age: + friendly_name: 'Kallen Current Age' + unique_id: f601002c-e6f0-4a19-bf13-1193ba1910d0 + value_template: "{{ state_attr('sensor.anniversary_kallen_s_birthday','current_years') }}" + icon_template: > + {% if is_state('sensor.anniversary_kallen_s_birthday','0') %} + mdi:cake + {% else %} + mdi:eye + {% endif %} + emma_current_age: + friendly_name: 'Emma Current Age' + unique_id: a9af85ab-ea43-4541-8e97-2d596dab5e69 + value_template: "{{ state_attr('sensor.anniversary_emmalynn_s_birthday','current_years') }}" + icon_template: > + {% if is_state('sensor.anniversary_emmalynn_s_birthday','0') %} + mdi:cake + {% else %} + mdi:eye + {% endif %} + + # The sum of all the years of life in our household, because why not LOL + total_age_years: + friendly_name: Total Age Years + unique_id: c1380627-b3a5-43ce-811d-3fb856c062a1 + unit_of_measurement: '' + value_template: > + {% set tony = states('sensor.tony_current_age') | int %} + {% set tina = states('sensor.tina_current_age') | int %} + {% set kallen = states('sensor.kallen_current_age') | int %} + {% set emmalynn = states('sensor.emma_current_age') | int %} + {{ tony + tina + kallen + emmalynn }} + icon_template: > + {% if (states('sensor.birthdays_today') | int) > 0 %} + mdi:cake + {% else %} + mdi:eye + {% endif %} diff --git a/sensors/house_stats.yaml b/sensors/house_stats.yaml index d5d6741..dec0365 100644 --- a/sensors/house_stats.yaml +++ b/sensors/house_stats.yaml @@ -230,22 +230,6 @@ mdi:eye {% endif %} # The sum of all the years of life in our household, because why not LOL - total_age_years: - friendly_name: Total Age Years - unique_id: c1380627-b3a5-43ce-811d-3fb856c062a1 - unit_of_measurement: '' - value_template: > - {% set tony = states('sensor.tony_current_age') | int %} - {% set tina = states('sensor.tina_current_age') | int %} - {% set kallen = states('sensor.kallen_current_age') | int %} - {% set emmalynn = states('sensor.emma_current_age') | int %} - {{ tony + tina + kallen + emmalynn }} - icon_template: > - {% if (states('sensor.birthdays_today') | int) > 0 %} - mdi:cake - {% else %} - mdi:eye - {% endif %} - platform: history_stats name: Basement TV Time