mirror of
https://github.com/michivonah/esphome-eink-dashboard.git
synced 2025-12-22 21:16:28 +01:00
Added update_screen script and button
This commit is contained in:
parent
42d39dcdd7
commit
6b25b5e3cc
1 changed files with 19 additions and 4 deletions
|
|
@ -37,6 +37,13 @@ button:
|
||||||
name: "weatherman: Shutdown"
|
name: "weatherman: Shutdown"
|
||||||
- platform: restart
|
- platform: restart
|
||||||
name: "weatherman: 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!)
|
# Global variables for detecting if the display needs to be refreshed. (Thanks @paviro!)
|
||||||
globals:
|
globals:
|
||||||
- id: data_updated
|
- id: data_updated
|
||||||
|
|
@ -49,6 +56,16 @@ globals:
|
||||||
initial_value: 'false'
|
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,
|
# Check whether the display needs to be refreshed every minute,
|
||||||
# based on whether new data is received or motion is detected. (Thanks @paviro!)
|
# based on whether new data is received or motion is detected. (Thanks @paviro!)
|
||||||
time:
|
time:
|
||||||
|
|
@ -62,15 +79,13 @@ time:
|
||||||
condition:
|
condition:
|
||||||
lambda: 'return id(data_updated) == true;'
|
lambda: 'return id(data_updated) == true;'
|
||||||
then:
|
then:
|
||||||
- lambda: 'id(initial_data_received) = true;'
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
binary_sensor.is_on: motion_detected
|
binary_sensor.is_on: motion_detected
|
||||||
then:
|
then:
|
||||||
- logger.log: "Sensor data updated and activity in home detected: Refreshing display..."
|
- logger.log: "Sensor data updated and activity in home detected: Refreshing display..."
|
||||||
- component.update: eink_display
|
- script.execute: update_screen
|
||||||
- lambda: 'id(data_updated) = false;'
|
else:
|
||||||
else:
|
|
||||||
- logger.log: "Sensor data updated but no activity in home - skipping display refresh."
|
- logger.log: "Sensor data updated but no activity in home - skipping display refresh."
|
||||||
else:
|
else:
|
||||||
- logger.log: "No sensors updated - skipping display refresh."
|
- logger.log: "No sensors updated - skipping display refresh."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue