MQTT Topic Mismatch in Home Assistant: A Safe Way to Find It
说明与用途
在 Home Assistant 中测试专用 MQTT 主题和有效负载,可在不影响真实设备的情况下隔离主题或有效负载不匹配。
问题
An MQTT publisher can connect to a broker and still leave a Home Assistant automation silent due to topic or payload mismatches.
结果
The test demonstrates whether the named topic and rule match the deliberately sent message, isolating topic or payload mismatches before affecting real devices.
工作流
- Write down the broker address, publisher topic, Home Assistant topic, and expected payload.
- Create a short‑lived test topic such as lab/mqtt-topic-check-2026-10-22 and a harmless payload like test-arrived.
- Set up a temporary MQTT trigger in Home Assistant for that test topic with a reversible action (notification, logbook entry).
- Publish the test payload from a client you control.
- Verify the listener received the same topic and payload and that the automation executed the reversible action.
- Publish a different payload that should be rejected by the condition and confirm no action occurs.
- Remove or disable the temporary automation and stop using the lab topic.
证据
An MQTT publisher can connect to a broker and still leave a Home Assistant automation silent.
Create a short‑lived topic with a name that clearly marks it as a lab value, such as lab/mqtt-topic-check-2026-10-22.
Set up a temporary MQTT trigger for that exact test topic. Make its first action reversible: a persistent notification, a logbook entry, or an update to a dedicated test helper.
Publish one clearly marked test payload from a client you control.
Check whether the listener received the same topic and payload.
- 记录日期: 2026-10-24T10:11:41.945Z