From 4b3e5f6a652465429017a5f32a72b89a9e068978 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 18 Dec 2023 19:19:09 -0500 Subject: [PATCH] Move door open counters to actual counters #184 --- automations.yaml | 11 +++-- packages/presence.yaml | 56 -------------------------- templates/speech/nightly_briefing.yaml | 10 ++--- 3 files changed, 10 insertions(+), 67 deletions(-) diff --git a/automations.yaml b/automations.yaml index 76b0cf9..8213b0a 100644 --- a/automations.yaml +++ b/automations.yaml @@ -2764,14 +2764,13 @@ value: '{{ states(''input_number.tomorrow_corrected_high_temp'') | int }}' target: entity_id: input_number.today_corrected_high_temp - - service: input_number.set_value + - service: counter.reset target: entity_id: - - input_number.back_door_opened_today - - input_number.front_door_opened_today - - input_number.basement_studio_door_opened_today - data: - value: 0 + - counter.back_door_opened_today + - counter.front_door_opened_today + - counter.basement_studio_door_opened_today + data: {} - conditions: - condition: trigger id: audible-off diff --git a/packages/presence.yaml b/packages/presence.yaml index ce1763c..4b40659 100644 --- a/packages/presence.yaml +++ b/packages/presence.yaml @@ -20,29 +20,6 @@ input_boolean: name: Away Mode Skipped icon: mdi:debug-step-over -input_number: - front_door_opened_today: - name: Front Door Opened Today - min: 0 - max: 200 - step: 1 - unit_of_measurement: times - icon: mdi:door-open - back_door_opened_today: - name: Back Door Opened Today - min: 0 - max: 200 - step: 1 - unit_of_measurement: times - icon: mdi:door-open - basement_studio_door_opened_today: - name: Basement Studio Door Opened Today - min: 0 - max: 200 - step: 1 - unit_of_measurement: times - icon: mdi:door-open - proximity: home_tony: devices: @@ -391,39 +368,6 @@ template: states.person.kallen_stork, ] %} {{ people | selectattr('state','ne','home') | list | count }} - - unique_id: 6a8bb32e-5f4e-4d1f-8e17-77f07e5b174a - name: "Front Door Opened Today" - unit_of_measurement: 'times' - state: >- - {{ states('input_number.front_door_opened_today') | int }} - icon: >- - {% if states('input_number.front_door_opened_today') | int > 0 %} - mdi:door-open - {% else %} - mdi:door-closed - {% endif %} - - unique_id: 77786cc9-64de-4035-a635-e831a3b0ef63 - name: "Back Door Opened Today" - unit_of_measurement: 'times' - state: >- - {{ states('input_number.back_door_opened_today') | int }} - icon: >- - {% if states('input_number.back_door_opened_today') | int > 0 %} - mdi:door-open - {% else %} - mdi:door-closed - {% endif %} - - unique_id: 3d74efd0-2df5-438e-a015-26ac1ce2c4ee - name: "Basement Studio Door Opened Today" - unit_of_measurement: 'times' - state: >- - {{ states('input_number.basement_studio_door_opened_today') | int }} - icon: >- - {% if states('input_number.basement_studio_door_opened_today') | int > 0 %} - mdi:door-open - {% else %} - mdi:door-closed - {% endif %} mqtt: sensor: diff --git a/templates/speech/nightly_briefing.yaml b/templates/speech/nightly_briefing.yaml index 873a765..7d09d04 100644 --- a/templates/speech/nightly_briefing.yaml +++ b/templates/speech/nightly_briefing.yaml @@ -125,16 +125,16 @@ "In case you had a burning desire to know, ", "Since I know everyone lays awake at night wondering the answer to this question, ", ] | random }} - {% if (states('sensor.front_door_opened_today') | int) > 0 %} - "Today, the front door was opened {{ states('sensor.front_door_opened_today') }} times. " + {% if (states('counter.front_door_opened_today') | int) > 0 %} + "Today, the front door was opened {{ states('counter.front_door_opened_today') }} times. " {% else %} "Today, the front door was never opened at all. Wow, did you people seriously not go anywhere? " {% endif %} - {% if (states('sensor.back_door_opened_today') | int) > 0 %} - {% if (states('sensor.back_door_opened_today') | int) == 1 %} + {% if (states('counter.back_door_opened_today') | int) > 0 %} + {% if (states('counter.back_door_opened_today') | int) == 1 %} "And in a rare and shocking incident, the back door was also opened today! But only just once. There's no telling what could happen otherwise! " {% else %} - "In what has to be considered a near catastrophic incident, the back door was opened multiple times today! {{ states('sensor.back_door_opened_today') }} times, to be precise! " + "In what has to be considered a near catastrophic incident, the back door was opened multiple times today! {{ states('counter.back_door_opened_today') }} times, to be precise! " {% endif %} {% endif %}