diag.yaml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ---
  2. button:
  3. - platform: restart
  4. name: "${friendly_devicename} Restart"
  5. - platform: safe_mode
  6. name: "${friendly_devicename} Safe Mode Boot"
  7. entity_category: diagnostic
  8. sensor:
  9. - platform: uptime
  10. name: Uptime Sensor
  11. id: uptime_sensor
  12. update_interval: 60s
  13. on_raw_value:
  14. then:
  15. - text_sensor.template.publish:
  16. id: uptime_human
  17. state: !lambda |-
  18. int seconds = round(id(uptime_sensor).raw_state);
  19. int days = seconds / (24 * 3600);
  20. seconds = seconds % (24 * 3600);
  21. int hours = seconds / 3600;
  22. seconds = seconds % 3600;
  23. int minutes = seconds / 60;
  24. seconds = seconds % 60;
  25. return (
  26. (days ? to_string(days) + "d " : "") +
  27. (hours ? to_string(hours) + "h " : "") +
  28. (minutes ? to_string(minutes) + "m " : "") +
  29. (to_string(seconds) + "s")
  30. ).c_str();
  31. - platform: wifi_signal
  32. name: "${friendly_devicename} WiFi Signal"
  33. id: ${low_devicename}_wifi_signal
  34. update_interval: 60s
  35. entity_category: diagnostic
  36. # Reports the WiFi signal strength in %
  37. - platform: copy
  38. source_id: "${low_devicename}_wifi_signal"
  39. name: "${friendly_devicename} WiFi Strength"
  40. filters:
  41. - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
  42. unit_of_measurement: "%"
  43. entity_category: diagnostic
  44. - platform: uptime
  45. name: Uptime
  46. binary_sensor:
  47. - platform: status
  48. name: "${friendly_devicename} status"
  49. text_sensor:
  50. - platform: version
  51. name: "${friendly_devicename} Version"
  52. - platform: template
  53. name: Uptime Human Readable
  54. id: uptime_human
  55. icon: mdi:clock-start
  56. - platform: wifi_info
  57. ip_address:
  58. name: IP Address
  59. entity_category: diagnostic