manatee: Reload Plejd when its BLE link goes stale

pyplejd keeps using a dead BLE client ("Service Discovery has not been
performed yet") instead of reconnecting, which left the Plejd lights
unreachable for two days. Fire system log events and let an automation
reload the integration when that warning shows up.

Also add systemd to bt-reset's PATH so its `systemctl` calls work.
This commit is contained in:
Alexander Heldt committed 2026-11-02 07:22:57 +00:00
1 parent 3f4a790b53
commit 924d06865a
1 file changed
+24
@@ -22,12 +22,35 @@ frontend:
themes: !include_dir_merge_named themes themes: !include_dir_merge_named themes
automation: !include automations.yaml automation: !include automations.yaml
automation nix:
# pyplejd keeps using a dead BLE client forever ("Service Discovery has not
# been performed yet") instead of reconnecting; reloading the integration fixes it
- alias: Reload Plejd when its BLE link goes stale
mode: single
triggers:
- trigger: event
event_type: system_log_event
event_data:
level: WARNING
conditions:
- "{{ 'pyplejd' in trigger.event.data.name and 'Service Discovery has not been performed yet' in (trigger.event.data.message | join(' ')) }}"
actions:
- action: homeassistant.reload_config_entry
target:
entity_id: light.takbelysning
# With mode: single, this caps it at one reload per 5 minutes
- delay: "00:05:00"
script: !include scripts.yaml script: !include scripts.yaml
scene: !include scenes.yaml scene: !include scenes.yaml
recorder: recorder:
purge_keep_days: 365 purge_keep_days: 365
# Turns logged warnings/errors into `system_log_event`s that automations can react to
system_log:
fire_event: true
alert: alert:
fridge_door: fridge_door:
name: Fridge is open name: Fridge is open
@@ -64,6 +87,7 @@ ${cfg.extraConfig}'';
pkgs.kmod pkgs.kmod
pkgs.gnugrep pkgs.gnugrep
pkgs.coreutils pkgs.coreutils
pkgs.systemd
] ]
}" }"