mirror of
https://github.com/Anonym-tsk/smart-domofon.git
synced 2026-01-02 14:49:14 +03:00
47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
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"
|
|
update_interval: never
|
|
icon: mdi:clock-start
|
|
entity_category: "diagnostic"
|
|
|
|
- platform: template
|
|
id: last_action
|
|
name: "${board_name} Action"
|
|
update_interval: never
|
|
icon: mdi:clock-time-eight-outline
|
|
entity_category: "diagnostic"
|