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:
Raymond Richmond
2025-07-16 12:26:40 -06:00
committed by GitHub
parent 394681fa59
commit f77224df2b
+4 -22
View File
@@ -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: