Files
shaggy-solar/openevse/Install.md
2026-05-01 16:56:37 -04:00

84 lines
2.3 KiB
Markdown

# Install
Single one-shot. No daemon, no systemd unit, no service to keep running.
## Prerequisites
- OpenEVSE WiFi firmware already configured to publish to the broker
(`mqtt_enabled:true`, `mqtt_connected:1` in `/status` JSON).
- Broker reachable from the machine you're running this on.
- `uv` installed and on `$PATH` (the script is a PEP-723 inline-deps
script — `uv` resolves `paho-mqtt` and `pyyaml` on first run).
## 1. Verify OpenEVSE is publishing
```bash
mosquitto_sub -h <BROKER> -u <USER> -P <PASS> -t 'openevse/#' -W 5 -v
```
Expect a steady stream of `openevse/{power,voltage,amp,...}` plus retained
`openevse/announce/<id>`, `openevse/config`, etc. If nothing arrives, the
EVSE isn't talking to the broker — fix that first via the OpenEVSE web UI
at `http://<EVSE>/`.
## 2. Preview the discovery payloads (optional)
```bash
~/solar/openevse/bin/openevse-publish-discovery --dry-run --device-id a048
```
Prints the 23 topics + JSON payloads it would publish without connecting.
## 3. Publish
Broker creds default-load from `~/.config/powermon/powermon.yaml`:
```bash
~/solar/openevse/bin/openevse-publish-discovery
```
The tool reads the retained `openevse/announce/<id>` payload to discover
the device id automatically. Override broker / device id if needed:
```bash
~/solar/openevse/bin/openevse-publish-discovery \
--host 10.0.0.41 --user mqtt --password '...' \
--device-id a048
```
Re-running is idempotent — the broker just overwrites the retained payloads
in place.
## 4. Verify
The 23 retained discovery configs:
```bash
mosquitto_sub -h <BROKER> -u <USER> -P <PASS> \
-t 'homeassistant/sensor/+/config' \
-t 'homeassistant/binary_sensor/+/config' \
-W 5 -F '[r=%r] %t' | grep openevse | sort -u
```
Expect 20 sensor + 3 binary_sensor entries, all `[r=1]`.
In HA: **Settings → Devices & Services → MQTT** should show "OpenEVSE-a048"
as a new device. If not, force a reload:
```bash
mosquitto_pub -h <BROKER> -u <USER> -P <PASS> \
-t 'homeassistant/status' -m 'online'
```
HA listens on this topic and re-scans retained discovery on receipt.
## Rollback
```bash
~/solar/openevse/bin/openevse-publish-discovery --purge
```
Publishes empty retained payloads to all 23 config topics; HA forgets the
entities on next reload. The OpenEVSE-side `openevse/<key>` topics are not
touched (they're not ours to clear).