1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 03:12:20 +01:00

Actions to enable and disable WireGuard connection (#5690)

This commit is contained in:
Simone Rossetto
2024-01-11 06:09:42 +01:00
committed by GitHub
parent 082d9fcf0e
commit d616025fed
5 changed files with 172 additions and 5 deletions

View File

@@ -44,6 +44,8 @@ binary_sensor:
- platform: wireguard
status:
name: 'WireGuard Status'
enabled:
name: 'WireGuard Enabled'
sensor:
- platform: wireguard
@@ -54,3 +56,26 @@ text_sensor:
- platform: wireguard
address:
name: 'WireGuard Address'
button:
- platform: template
name: 'Toggle WireGuard'
entity_category: config
on_press:
- if:
condition: wireguard.enabled
then:
- wireguard.disable:
else:
- wireguard.enable:
- platform: template
name: 'Log WireGuard status'
entity_category: config
on_press:
- if:
condition: wireguard.peer_online
then:
- logger.log: 'wireguard remote peer is online'
else:
- logger.log: 'wireguard remote peer is offline'