mirror of
https://github.com/athom-tech/esp32-configs.git
synced 2026-07-28 04:05:53 +00:00
Update athom-smart-plug.yaml
Update YAML to be able to compile in ESPHome 2025.7.0 via move to esp-idf from arduino and updating uptime sensor.
This commit is contained in:
+4
-22
@@ -83,8 +83,7 @@ esp32:
|
||||
flash_size: 4MB
|
||||
variant: ESP32C3
|
||||
framework:
|
||||
type: arduino
|
||||
version: recommended
|
||||
type: esp-idf
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 5min
|
||||
@@ -346,28 +345,11 @@ text_sensor:
|
||||
# device_class: timestamp
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
- platform: uptime
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
format:
|
||||
separator: " "
|
||||
icon: mdi:clock-start
|
||||
|
||||
time:
|
||||
|
||||
Reference in New Issue
Block a user