infrapuzzle/k8s/monitoring/README_Z2M.md

95 lines
4.4 KiB
Markdown

# Zigbee2MQTT & Shelly Weather Station Integration
This guide describes how to deploy Zigbee2MQTT in the `monitoring` namespace and pair your **Shelly Weather Station (Ecowitt WS90)** using the **SLZB-MR1U Zigbee multiradio** (`192.168.10.10`).
> [!NOTE]
> These resources have already been successfully applied and verified running in the cluster.
---
## 1. Deploy Zigbee2MQTT
The Kubernetes secret and workload manifests are located in `k8s/monitoring/`:
```bash
# 1. Apply the encrypted secrets (MQTT credentials & Traefik basic auth credentials)
# Note: Basic auth credentials are split into 'zigbee2mqtt-auth-secret' to satisfy
# Traefik's constraint requiring exactly one key in the basic auth secret.
kubectl apply -f k8s/monitoring/zigbee2mqtt.secret.yaml
# 2. Apply the main deployment, PVC, ConfigMap, Service, Middleware, and Ingress
kubectl apply -f k8s/monitoring/zigbee2mqtt.yaml
```
---
## 2. Verify the Deployment
1. Check that the Persistent Volume is provisioned and the pod starts:
```bash
kubectl get pods -n monitoring -l app=zigbee2mqtt
```
2. Inspect the logs to ensure Zigbee2MQTT connects successfully to the SLZB-MR1U coordinator (`192.168.10.10:7638` — port `7638` is the TI CC2652P7 coordinator chip on the MR1U) and the Mosquitto MQTT broker (`mosquitto.datalab.svc.cluster.local`):
```bash
kubectl logs -n monitoring deploy/zigbee2mqtt
```
**Expected healthy output:**
```
info: z2m: Starting Zigbee2MQTT version 1.40.1 (commit #403d3c0)
info: z2m: Starting zigbee-herdsman (0.57.3)
info: zh:zstack:znp: Opening TCP socket with 192.168.10.10:7638
info: zh:zstack:znp: Socket connected
info: z2m: zigbee-herdsman started (resumed)
info: z2m: Connecting to MQTT server at mqtt://mosquitto.datalab.svc.cluster.local:1883
info: z2m: Connected to MQTT server
info: z2m: Started frontend on port 0.0.0.0:8080
info: z2m: Zigbee2MQTT started!
```
---
## 3. Access the Dashboard
The dashboard is exposed on your custom domain with TLS and basic authentication:
* **URL:** [https://zigbee2mqtt.moritzgraf.de](https://zigbee2mqtt.moritzgraf.de)
* **Username:** `admin`
* **Password:** `moritz-z2m-2026`
*Note: You can change the basic auth password by running the `k8s/htpasswd.py` script on your machine to generate a new bcrypt hash, then updating the `users` value in `k8s/monitoring/zigbee2mqtt.secret.yaml`.*
---
## 4. Pair the Weather Station (WS90)
1. Open the Zigbee2MQTT dashboard and click **Permit join (All)** at the top right.
2. Go to your physical Ecowitt WS90 weather station and **double-press the physical CAL button** on the bottom of the sensor array.
3. The LED on the weather station should flash, indicating it is in pairing mode (active for 3 minutes).
4. Within a few seconds, the weather station will appear in the Zigbee2MQTT dashboard. You can rename it there (e.g. to `Shelly WS90`).
---
## 5. Heartbeat LED Blinking (How to Disable)
By default, the weather station's LED flashes briefly every ~8.8 seconds to indicate it is transmitting data.
* **To disable the blinking:** Press the physical **CAL button** on the bottom of the sensor package **exactly 3 times** in quick succession. This toggles the heartbeat LED mode.
* **To enable the blinking again:** Press the **CAL button exactly 3 times** again.
---
## 6. Verified Metrics Flow
The weather station successfully reports metrics. You can query them in Prometheus or display them in Grafana:
| Metric Name | Description | Verified Value Example |
| :--- | :--- | :--- |
| `homeassistant_sensor_temperature_celsius` | Outdoor Temperature | `30.8` °C |
| `homeassistant_sensor_humidity_percent` | Outdoor Humidity | `29.0` % |
| `homeassistant_sensor_pressure_kpa` | Atmospheric Pressure | `97.8` kPa |
| `homeassistant_sensor_illuminance_lux_lx` | Ambient Light Level | `80.0` lx |
| `homeassistant_sensor_battery_percent` | Sensor Battery Level | `100.0` % |
> [!NOTE]
> **Wind/Rain/UV Data:** The Shelly WS90 custom edition transmits advanced meteorological data (wind speed, wind direction, rain, and UV index) over manufacturer-specific Zigbee clusters. Depending on your Zigbee2MQTT version and device configuration, these may not be fully parsed out-of-the-box. If you require advanced wind/rain/UV metrics, integrating the device via **Bluetooth (BTHome protocol)** using a BLE proxy (e.g. an ESP32 or the SLZB-MR1U's Bluetooth proxy capability) is the recommended alternative.