call_start_detect_delay fix & action sensor

This commit is contained in:
Nikolay Vasilchuk
2022-09-09 22:38:39 +03:00
parent 13e97c6ad2
commit 1b6fdeb7da
6 changed files with 65 additions and 61 deletions

View File

@@ -59,45 +59,6 @@ globals:
restore_value: yes
initial_value: 'false'
sensor:
- platform: template
name: "${board_name} Heap Size"
lambda: "return ESP.getFreeHeap();"
update_interval: 20s
unit_of_measurement: bytes
accuracy_decimals: 0
entity_category: "diagnostic"
- platform: uptime
internal: true
id: uptime_sensor
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
text_sensor:
- platform: template
id: uptime_human
name: "${board_name} Uptime"
icon: mdi:clock-start
entity_category: "diagnostic"
substitutions:
# Ge1mer board
board: esp12e
@@ -117,4 +78,5 @@ packages:
switch: !include switch.yaml
button: !include button.yaml
light: !include light.yaml
sensor: !include sensor.yaml
binary_sensor: !include binary_sensor.yaml