Show Home Assistant API connectivity status
This commit is contained in:
@@ -70,6 +70,7 @@ wireguard:
|
||||
logger:
|
||||
|
||||
api:
|
||||
id: api_server
|
||||
encryption:
|
||||
key: !secret apikey
|
||||
|
||||
@@ -117,6 +118,7 @@ font:
|
||||
size: 24
|
||||
glyphs:
|
||||
- "\U000F0306" # mdi:key
|
||||
- "\U000F07D0" # mdi:home-assistant
|
||||
- "\U000F091F" # mdi:wifi-strength-1
|
||||
- "\U000F0922" # mdi:wifi-strength-2
|
||||
- "\U000F0925" # mdi:wifi-strength-3
|
||||
@@ -202,12 +204,17 @@ display:
|
||||
it.fill(Color::BLACK);
|
||||
|
||||
if (id(sntp_time).now().is_valid()) {
|
||||
it.strftime(260, 10, id(font_small), Color::WHITE, TextAlign::TOP_RIGHT,
|
||||
it.strftime(234, 10, id(font_small), Color::WHITE, TextAlign::TOP_RIGHT,
|
||||
"%H:%M", id(sntp_time).now());
|
||||
} else {
|
||||
it.printf(260, 10, id(font_small), Color::WHITE, TextAlign::TOP_RIGHT, "--:--");
|
||||
it.printf(234, 10, id(font_small), Color::WHITE, TextAlign::TOP_RIGHT, "--:--");
|
||||
}
|
||||
|
||||
// Native API connectivity; Home Assistant is normally the connected client.
|
||||
const bool home_assistant_online = id(api_server).is_connected();
|
||||
const Color home_assistant_color = home_assistant_online ? Color(64, 255, 64) : Color(255, 80, 80);
|
||||
it.printf(260, 8, id(font_icon), home_assistant_color, TextAlign::TOP_RIGHT, "\U000F07D0");
|
||||
|
||||
// Green means the WireGuard peer is online; red means it is offline.
|
||||
const bool wireguard_online = id(energymonitor_wireguard).is_peer_up();
|
||||
const Color wireguard_color = wireguard_online ? Color(64, 255, 64) : Color(255, 80, 80);
|
||||
|
||||
Reference in New Issue
Block a user