fix: power outage auto-recovery improvements

Mosquitto:
- Change restart: always (was unless-stopped) to survive daemon restarts
- Add healthcheck (pub/sub ping) for depends_on conditions
- All downstream services use condition: service_healthy

Party-lock:
- Add MQTT connection retry loop (was crashing on DNS race after restart)

Zigbee2mqtt:
- Add entrypoint wrapper that auto-applies BLZ bridge patch at startup
- Bridge patch no longer needs manual 'just z2m-patch-bridge' after image pulls

Mopidy:
- Add python3-gi + python3-gi-cairo via apt (fixes 'No module named gi')
- Set PYTHONPATH to expose system gi module to Python 3.12
This commit is contained in:
2026-07-09 18:56:36 -07:00
parent 5383edd4ae
commit ba3e172dda
4 changed files with 36 additions and 6 deletions
+7 -1
View File
@@ -51,7 +51,13 @@ def main():
rebuild_acl()
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
client.on_message = on_message
client.connect(MQTT_HOST, MQTT_PORT, 60)
while True:
try:
client.connect(MQTT_HOST, MQTT_PORT, 60)
break
except Exception as e:
print(f"mqtt connect failed: {e}; retrying in 5s", flush=True)
time.sleep(5)
client.subscribe("party-lock/set", qos=1)
client.loop_forever()