From f38598a854f26b3e705edd9072114ed97614e4eb Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Fri, 18 Nov 2022 21:45:55 +0100 Subject: [PATCH 1/8] Improved initial data handling --- weatherman.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/weatherman.yaml b/weatherman.yaml index b1a9bc4..7c9ea7a 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -9,6 +9,14 @@ esphome: priority: 200.0 then: - component.update: eink_display + - wait_until: + condition: + lambda: 'return id(data_updated) == true;' + # Wait a bit longer so all the items are received + - delay: 5s + - logger.log: "Initial sensor data received: Refreshing display..." + - lambda: 'id(initial_data_received) = true;' + - script.execute: update_screen esp32: board: esp32dev From 42d39dcdd7486e0ecd0916e1d2ccce81d77443f4 Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Fri, 18 Nov 2022 21:46:10 +0100 Subject: [PATCH 2/8] Added reboot and shutdown buttons --- weatherman.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weatherman.yaml b/weatherman.yaml index 7c9ea7a..09c7f7a 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -31,6 +31,12 @@ api: ota: + +button: + - platform: shutdown + name: "weatherman: Shutdown" + - platform: restart + name: "weatherman: Restart" # Global variables for detecting if the display needs to be refreshed. (Thanks @paviro!) globals: - id: data_updated From 6b25b5e3ccb81672357f2ae34ffb8919a20ba2b5 Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Fri, 18 Nov 2022 21:46:40 +0100 Subject: [PATCH 3/8] Added update_screen script and button --- weatherman.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/weatherman.yaml b/weatherman.yaml index 09c7f7a..5bc54b7 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -37,6 +37,13 @@ button: name: "weatherman: Shutdown" - platform: restart name: "weatherman: Restart" + - platform: template + name: "weatherman: Refresh Screen" + entity_category: config + on_press: + - script.execute: update_screen + + # Global variables for detecting if the display needs to be refreshed. (Thanks @paviro!) globals: - id: data_updated @@ -49,6 +56,16 @@ globals: initial_value: 'false' + +script: + - id: update_screen + then: + - lambda: 'id(data_updated) = false;' + - component.update: eink_display + - lambda: 'id(recorded_display_refresh) += 1;' + - lambda: 'id(display_last_update).publish_state(id(homeassistant_time).now().timestamp);' + + # Check whether the display needs to be refreshed every minute, # based on whether new data is received or motion is detected. (Thanks @paviro!) time: @@ -62,15 +79,13 @@ time: condition: lambda: 'return id(data_updated) == true;' then: - - lambda: 'id(initial_data_received) = true;' - if: condition: binary_sensor.is_on: motion_detected then: - logger.log: "Sensor data updated and activity in home detected: Refreshing display..." - - component.update: eink_display - - lambda: 'id(data_updated) = false;' - else: + - script.execute: update_screen + else: - logger.log: "Sensor data updated but no activity in home - skipping display refresh." else: - logger.log: "No sensors updated - skipping display refresh." From e2181c2e3facd6aa22f1ef9a00d85078a2d45d43 Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Fri, 18 Nov 2022 21:47:16 +0100 Subject: [PATCH 4/8] Added sensor for last screen refresh and total display refreshs --- weatherman.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/weatherman.yaml b/weatherman.yaml index 5bc54b7..6416caa 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -54,6 +54,10 @@ globals: type: bool restore_value: no initial_value: 'false' + - id: recorded_display_refresh + type: int + restore_value: yes + initial_value: '0' @@ -184,8 +188,18 @@ binary_sensor: id: motion_detected -# Call Subway and Weather sensors from HA. + sensor: + - platform: template + name: "weatherman: Display Last Update" + device_class: timestamp + id: display_last_update + + - platform: template + name: "weatherman: Recorded Display Refresh" + lambda: 'return id(recorded_display_refresh);' + + # Call Subway and Weather sensors from HA. - platform: homeassistant entity_id: sensor.gtfs_mta_subway_manhattan id: train_manhattan_due_in From 3671a83dca73b9084e07e7ecd7297d26731b1961 Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Sun, 27 Nov 2022 23:59:47 +0100 Subject: [PATCH 5/8] Improved display sensors --- weatherman.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weatherman.yaml b/weatherman.yaml index 6416caa..9d04915 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -193,10 +193,15 @@ sensor: - platform: template name: "weatherman: Display Last Update" device_class: timestamp + entity_category: "diagnostic" id: display_last_update - platform: template name: "weatherman: Recorded Display Refresh" + accuracy_decimals: 0 + unit_of_measurement: "Refreshs" + state_class: "total_increasing" + entity_category: "diagnostic" lambda: 'return id(recorded_display_refresh);' # Call Subway and Weather sensors from HA. From 8f79df5c3dcd5bf22df4de8e7e6dd0612a5bdd98 Mon Sep 17 00:00:00 2001 From: Paul-Vincent Roll Date: Mon, 28 Nov 2022 00:00:51 +0100 Subject: [PATCH 6/8] Added diagnostic flag to WiFi sensor --- weatherman.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/weatherman.yaml b/weatherman.yaml index 9d04915..340cf1a 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -278,6 +278,7 @@ sensor: - platform: wifi_signal name: "WiFi Signal Sensor" id: wifisignal + entity_category: "diagnostic" update_interval: 60s From 8b62148f4d03bcbcd31ae91dd993c539f64a1b7e Mon Sep 17 00:00:00 2001 From: Madelena Mak Date: Tue, 3 Jan 2023 22:44:33 -0500 Subject: [PATCH 7/8] Add hyphen to font glyphs --- weatherman.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weatherman.yaml b/weatherman.yaml index 340cf1a..74f36bb 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -114,7 +114,7 @@ font: - file: 'fonts/GothamRnd-Bold.ttf' id: font_large_bold size: 108 - glyphs: [' ', '°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C'] + glyphs: [' ', '-', '°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C'] - file: 'fonts/GothamRnd-Bold.ttf' id: font_title size: 54 From c3343ccf457363cf9e1466042873b4be032f5d02 Mon Sep 17 00:00:00 2001 From: Madelena Mak Date: Tue, 3 Jan 2023 22:44:50 -0500 Subject: [PATCH 8/8] Sensor name small changes --- weatherman.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weatherman.yaml b/weatherman.yaml index 74f36bb..dd4b265 100644 --- a/weatherman.yaml +++ b/weatherman.yaml @@ -191,13 +191,13 @@ binary_sensor: sensor: - platform: template - name: "weatherman: Display Last Update" + name: "Weatherman - Display Last Update" device_class: timestamp entity_category: "diagnostic" id: display_last_update - platform: template - name: "weatherman: Recorded Display Refresh" + name: "Weatherman - Recorded Display Refresh" accuracy_decimals: 0 unit_of_measurement: "Refreshs" state_class: "total_increasing"