So that is the general question, but I'll provide the scenario here.
I'm running Mosquitto server to provide mqtt comm between esp relay modules (Sonoff from Itead) and Home Assistant. Most of the time, it works just fine. Each module has its own topic, and there are as many "light" configurations in HASS as modules, so they can be controlled from the web frontend by individual toggle buttons.
I've experienced, though, inconsistent state situations where the light is actually on and the toggle in HASS is shown as off (and the opposite situation as well).
By inspecting logs I've found that Mosquitto is not publishing certain messages to HASS (which should be subscribed to all module state topics). More specifically, given 4 modules and its corresponding state topics (state/sonoff_xx/POWER
), HASS seems to be subscribed only to modules 2 and 4 topics, but not 1 and 3. The following is the expected behavior for module 4, the same can be verified for the other working module, but publishing to HASS is missing for the other two.
Jun 15 19:22:46 nas mosquitto[9486]: Received PUBLISH from sonoff4 (d0, q0, r1, m0, 'stat/sonoff4/POWER', ... (2 bytes))
Jun 15 19:22:46 nas mosquitto[9486]: Sending PUBLISH to home-assistant (d0, q0, r0, m0, 'stat/sonoff4/POWER', ... (2 bytes))
This is not a question regarding HASS and the relay modules, but it is about how to dig into the status of MQTT Server that is supposed to have certain clients subscribed but, by looking at the logs, it has not.