Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions Integrations/ESPHome/Core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,32 @@ sensor:
disabled_by_default: true

- platform: uptime
name: Uptime
id: sys_uptime
id: sys_uptime_seconds
update_interval: 60s
internal: true
on_raw_value:
then:
- text_sensor.template.publish:
id: sys_uptime
state: !lambda |-
const uint32_t total_seconds = static_cast<uint32_t>(x);
const uint32_t days = total_seconds / 86400;
const uint32_t hours = (total_seconds % 86400) / 3600;
const uint32_t minutes = (total_seconds % 3600) / 60;
const uint32_t seconds = total_seconds % 60;

std::string uptime;
if (days > 0) {
uptime += to_string(days) + "d ";
}
if (hours > 0) {
uptime += to_string(hours) + "h ";
}
if (minutes > 0) {
uptime += to_string(minutes) + "m ";
}
uptime += to_string(seconds) + "s";
return uptime;

- platform: scd4x
id: scd40
Expand Down Expand Up @@ -776,6 +799,10 @@ text_sensor:
id: apollo_firmware_version
update_interval: never
entity_category: "diagnostic"
- platform: template
name: Uptime
id: sys_uptime
update_interval: never

light:
- platform: esp32_rmt_led_strip
Expand Down