Add WireGuard monitoring sensors
Expose WireGuard handshake, status, enabled state, and address in ESPHome.
This commit is contained in:
+65
-51
@@ -111,6 +111,71 @@ font:
|
|||||||
- GF_Latin_Kernel
|
- GF_Latin_Kernel
|
||||||
glyphs: ["äöüÄÖÜß"]
|
glyphs: ["äöüÄÖÜß"]
|
||||||
|
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: page_index
|
||||||
|
type: int
|
||||||
|
restore_value: true
|
||||||
|
initial_value: '0'
|
||||||
|
- id: wifi_connected
|
||||||
|
type: bool
|
||||||
|
restore_value: false
|
||||||
|
initial_value: 'false'
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: wifi_signal
|
||||||
|
id: wifi_rssi
|
||||||
|
internal: true
|
||||||
|
update_interval: 10s
|
||||||
|
- platform: homeassistant
|
||||||
|
id: grid_power
|
||||||
|
entity_id: sensor.netzleistung
|
||||||
|
internal: true
|
||||||
|
- platform: homeassistant
|
||||||
|
id: balcony_solar_power
|
||||||
|
entity_id: sensor.balkonkraftwerk_power
|
||||||
|
internal: true
|
||||||
|
- platform: wireguard
|
||||||
|
latest_handshake:
|
||||||
|
name: 'WireGuard Latest Handshake'
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: wireguard
|
||||||
|
status:
|
||||||
|
name: 'WireGuard Status'
|
||||||
|
- platform: wireguard
|
||||||
|
enabled:
|
||||||
|
name: 'WireGuard Enabled'
|
||||||
|
# M5Stack Core button A (left). GPIO39 is input-only and has an external pull-up.
|
||||||
|
- platform: gpio
|
||||||
|
pin:
|
||||||
|
number: GPIO39
|
||||||
|
mode: INPUT
|
||||||
|
inverted: true
|
||||||
|
id: button_left
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
id(page_index) = (id(page_index) + 2 - 1) % 2;
|
||||||
|
- component.update: tft
|
||||||
|
# M5Stack Core button C (right). GPIO37 is input-only and has an external pull-up.
|
||||||
|
- platform: gpio
|
||||||
|
pin:
|
||||||
|
number: GPIO37
|
||||||
|
mode: INPUT
|
||||||
|
inverted: true
|
||||||
|
id: button_right
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
id(page_index) = (id(page_index) + 1) % 2;
|
||||||
|
- component.update: tft
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: wireguard
|
||||||
|
address:
|
||||||
|
name: 'WireGuard Address'
|
||||||
|
|
||||||
# M5CORE is the mipi_spi preset for the M5Stack Core's integrated display.
|
# M5CORE is the mipi_spi preset for the M5Stack Core's integrated display.
|
||||||
display:
|
display:
|
||||||
- platform: mipi_spi
|
- platform: mipi_spi
|
||||||
@@ -199,54 +264,3 @@ display:
|
|||||||
"Weiter >");
|
"Weiter >");
|
||||||
it.printf(160, 239, id(font_small), Color::WHITE, TextAlign::BOTTOM_CENTER,
|
it.printf(160, 239, id(font_small), Color::WHITE, TextAlign::BOTTOM_CENTER,
|
||||||
"%d / 2", id(page_index) + 1);
|
"%d / 2", id(page_index) + 1);
|
||||||
|
|
||||||
globals:
|
|
||||||
- id: page_index
|
|
||||||
type: int
|
|
||||||
restore_value: true
|
|
||||||
initial_value: '0'
|
|
||||||
- id: wifi_connected
|
|
||||||
type: bool
|
|
||||||
restore_value: false
|
|
||||||
initial_value: 'false'
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: wifi_signal
|
|
||||||
id: wifi_rssi
|
|
||||||
internal: true
|
|
||||||
update_interval: 10s
|
|
||||||
- platform: homeassistant
|
|
||||||
id: grid_power
|
|
||||||
entity_id: sensor.netzleistung
|
|
||||||
internal: true
|
|
||||||
- platform: homeassistant
|
|
||||||
id: balcony_solar_power
|
|
||||||
entity_id: sensor.balkonkraftwerk_power
|
|
||||||
internal: true
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
# M5Stack Core button A (left). GPIO39 is input-only and has an external pull-up.
|
|
||||||
- platform: gpio
|
|
||||||
pin:
|
|
||||||
number: GPIO39
|
|
||||||
mode: INPUT
|
|
||||||
inverted: true
|
|
||||||
id: button_left
|
|
||||||
on_press:
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
id(page_index) = (id(page_index) + 2 - 1) % 2;
|
|
||||||
- component.update: tft
|
|
||||||
|
|
||||||
# M5Stack Core button C (right). GPIO37 is input-only and has an external pull-up.
|
|
||||||
- platform: gpio
|
|
||||||
pin:
|
|
||||||
number: GPIO37
|
|
||||||
mode: INPUT
|
|
||||||
inverted: true
|
|
||||||
id: button_right
|
|
||||||
on_press:
|
|
||||||
then:
|
|
||||||
- lambda: |-
|
|
||||||
id(page_index) = (id(page_index) + 1) % 2;
|
|
||||||
- component.update: tft
|
|
||||||
|
|||||||
Reference in New Issue
Block a user