MQTT
Home Assistant setup
In Home Assistant
- create non admin user in home assistant e.g mqttuser
- install the Mosquitto MQTT Broker via Settings / Devices & Services, it will auto-discover the MoonLight devices
- Optionally enable TLS (Transport Layer Security) for secure connections in MQTT / Configure
In MoonLight / Network / MQTT:
- Enable MQTT
- URI: mqtt://homeassistant.local:1883 (non-secure)
- replace homeassistant.local by its appropriate mDNS name or IP address
- secure HA: use mqtts://homeassistant.local:8883
- to test outside HA e.g. use mqtts://broker.hivemq.com:8883
- Username / password: mqttuser credentials
- client id: ml-xxxx.
- Apply Settings
MoonLight devices show up in HA as follows:
On QoS
Typical configurations:
- High reliability: Subscribe QoS 1, Publish QoS 1 (at-least-once delivery both ways)
- Performance: Subscribe QoS 1, Publish QoS 0 (reliable commands, fire-and-forget state)
- Low bandwidth: Subscribe QoS 0, Publish QoS 0 (best-effort, no guarantees)
- Your original (subscribe 2, publish 0) was unusual but valid — QoS 2 for commands ensures exactly-once, QoS 0 for state is fine if you don't need delivery guarantees.