esphome device updates
This commit is contained in:
@@ -1,26 +1,58 @@
|
||||
substitutions:
|
||||
local_update_interval: 30s
|
||||
|
||||
##########################################################################################
|
||||
# GENERAL COMMON SENSORS
|
||||
# https://esphome.io/components/sensor/
|
||||
##########################################################################################
|
||||
|
||||
# Debug helpers (loop time / heap / reset info)
|
||||
debug:
|
||||
update_interval: ${local_update_interval}
|
||||
|
||||
sensor:
|
||||
- platform: uptime # Uptime for this device in seconds
|
||||
name: "Uptime (s):"
|
||||
update_interval: ${local_update_interval}
|
||||
id: uptime_sensor
|
||||
entity_category: "diagnostic"
|
||||
- platform: wifi_signal # Wifi Strength
|
||||
name: "Wifi (dB):"
|
||||
id: wifi_signal_db
|
||||
update_interval: ${local_update_interval}
|
||||
entity_category: "diagnostic"
|
||||
- platform: copy # Reports the WiFi signal strength in %
|
||||
source_id: wifi_signal_db
|
||||
name: "WiFi (%):"
|
||||
filters:
|
||||
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||
unit_of_measurement: "% Max"
|
||||
entity_category: "diagnostic"
|
||||
device_class: ""
|
||||
# - platform: uptime # Uptime for this device in seconds
|
||||
# name: "Uptime (s):"
|
||||
# update_interval: ${local_update_interval}
|
||||
# id: uptime_sensor
|
||||
# entity_category: "diagnostic"
|
||||
|
||||
# - platform: wifi_signal # Wifi Strength
|
||||
# name: "Wifi (dB):"
|
||||
# id: wifi_signal_db
|
||||
# update_interval: ${local_update_interval}
|
||||
# entity_category: "diagnostic"
|
||||
|
||||
# - platform: copy # Reports the WiFi signal strength in %
|
||||
# source_id: wifi_signal_db
|
||||
# name: "WiFi (%):"
|
||||
# filters:
|
||||
# - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||
# unit_of_measurement: "% Max"
|
||||
# entity_category: "diagnostic"
|
||||
# device_class: ""
|
||||
|
||||
# Free heap via debug (replaces template-based ESP.getFreeHeap if you prefer)
|
||||
- platform: debug
|
||||
free:
|
||||
name: "Free Heap"
|
||||
entity_category: "diagnostic"
|
||||
|
||||
# Loop time via debug (replaces broken template loop time)
|
||||
- platform: debug
|
||||
loop_time:
|
||||
name: "Loop Time"
|
||||
entity_category: "diagnostic"
|
||||
|
||||
# If you’d rather keep the legacy heap sensor, uncomment below and
|
||||
# delete the debug "free" block above to avoid duplicates:
|
||||
# - platform: template
|
||||
# name: "${friendly_name} Free Heap"
|
||||
# unit_of_measurement: "B"
|
||||
# update_interval: 30s
|
||||
# entity_category: "diagnostic"
|
||||
# lambda: |-
|
||||
# return (float) ESP.getFreeHeap();
|
||||
|
||||
# Only works with esp8266
|
||||
#- platform: adc
|
||||
@@ -29,11 +61,11 @@ sensor:
|
||||
# id: vcc_voltage_sensor
|
||||
# entity_category: diagnostic
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Network Status"
|
||||
icon: mdi:check-network-outline
|
||||
entity_category: diagnostic
|
||||
#binary_sensor:
|
||||
# - platform: status
|
||||
# name: "Network Status"
|
||||
# icon: mdi:check-network-outline
|
||||
# entity_category: diagnostic
|
||||
|
||||
##########################################################################################
|
||||
# Text Sensors
|
||||
@@ -46,6 +78,7 @@ text_sensor:
|
||||
- platform: version
|
||||
name: "Version:"
|
||||
entity_category: "diagnostic"
|
||||
|
||||
- platform: wifi_info
|
||||
ip_address:
|
||||
icon: mdi:ip-network
|
||||
@@ -59,37 +92,12 @@ text_sensor:
|
||||
name: "MAC Address:"
|
||||
icon: mdi:network-pos
|
||||
entity_category: diagnostic
|
||||
|
||||
- platform: uptime # Uptime for this device human readable
|
||||
name: "Uptime:"
|
||||
icon: mdi:clock-start
|
||||
update_interval: ${local_update_interval}
|
||||
entity_category: "diagnostic"
|
||||
- platform: template
|
||||
name: "Last Reset Reason"
|
||||
update_interval: 30s
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
#if defined(USE_ESP8266)
|
||||
return { ESP.getResetReason().c_str() };
|
||||
#elif defined(USE_ESP32)
|
||||
auto r = esp_reset_reason();
|
||||
switch (r) {
|
||||
case ESP_RST_POWERON: return { "Power-on" };
|
||||
case ESP_RST_EXT: return { "External pin" };
|
||||
case ESP_RST_SW: return { "Software reset" };
|
||||
case ESP_RST_PANIC: return { "Exception/Panic" };
|
||||
case ESP_RST_INT_WDT: return { "Interrupt WDT" };
|
||||
case ESP_RST_TASK_WDT: return { "Task WDT" };
|
||||
case ESP_RST_WDT: return { "Other WDT" };
|
||||
case ESP_RST_DEEPSLEEP: return { "Deep sleep wake" };
|
||||
case ESP_RST_BROWNOUT: return { "Brownout" };
|
||||
case ESP_RST_SDIO: return { "SDIO" };
|
||||
default: return { "Unknown" };
|
||||
}
|
||||
#else
|
||||
return { "Unknown" };
|
||||
#endif
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
@@ -118,44 +126,23 @@ text_sensor:
|
||||
# }
|
||||
# icon: mdi:clock-start
|
||||
|
||||
# - platform: template
|
||||
# name: "Uptime (Days)"
|
||||
# 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() };
|
||||
# }
|
||||
# icon: mdi:clock-start
|
||||
|
||||
##########################################################################################
|
||||
# BUTTONS
|
||||
# Diagnostic buttons, activated if needed in HA
|
||||
##########################################################################################
|
||||
button:
|
||||
- platform: safe_mode
|
||||
name: "Safe Mode Restart:"
|
||||
entity_category: "diagnostic"
|
||||
disabled_by_default: true
|
||||
- platform: restart
|
||||
name: "Restart:"
|
||||
entity_category: "diagnostic"
|
||||
disabled_by_default: true
|
||||
- platform: factory_reset
|
||||
name: "FACTORY RESET:"
|
||||
entity_category: "diagnostic"
|
||||
disabled_by_default: true
|
||||
#button:
|
||||
# - platform: safe_mode
|
||||
# name: "Safe Mode Restart:"
|
||||
# entity_category: "diagnostic"
|
||||
# disabled_by_default: true
|
||||
#
|
||||
# - platform: restart
|
||||
# name: "Restart:"
|
||||
# entity_category: "diagnostic"
|
||||
# disabled_by_default: true
|
||||
#
|
||||
# - platform: factory_reset
|
||||
# name: "FACTORY RESET:"
|
||||
# entity_category: "diagnostic"
|
||||
# disabled_by_default: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user