I’m trying to get the excellent, low cost Bruh multisensor running.
When I use the arduino IDE serial monitor to look at the multisensor’s output, I can see that it is recording (accurate) values anytime a sensor updates. It also thinks that has successfully connected to the mqtt broker (“Attempting MQTT connection…connected”).
However, all of the values are “unknown” in the home assistant frontend, and when I subscribe to that topic on my raspberry pi, I don’t see any messages from the multisensor, even when I subscribe to all topics on the broker (mosquitto). I’ve double, triple, quadruple checked the state and set topics.
The arduino sketch does have some level of mqtt failed connection error messages, which I’ve tested.
Does anyone know what could explain the fact that the multisensor thinks its connected, while my broker doesn’t see it? I’ve previously successfully used the bruh rgb led, which uses a very similar sketch for all of its mqtt connectivity, so I’m extra flummoxed.
Edit: i just got the light to work. I wonder if my issue is that only my cloudmqtt bridge is allowed to publish. Gonna look into that now.
Edit to the edit: I don’t see any reason why home assistant would be able to publish (it can) but the multisensor can’t. Dang, I’m still stuck!
Is your sensor connected to to the local mosquitto broker or the cloud one? If connected to the local broker then HA should see something as should you subscribing to all (#). To help we probably need to see the config and what you think is connected to each other.
It’s connected to the local mosquitto broker. I can control the LED on the multisensor, but I can’t see any messages from the sensor (either through a mosquitto_sub or through home assistant). I also can’t see the state of that very same LED.
Can you think of anything that would cause me to have basically only one-way communication to the nodemcu? The mqtt broker settings are of course the same (calling the same variables) for each direction, except that the state topic has /set at the end of it.
can you connect to the NodeMCU via the serial connection and see what the serial monitor shows for activity?
Does it show that it’s publishing to any topics?
Yes. I added an extra serial print after the client.publish to serial print the topic name, and it shows the correct topic.
I can assume since you can control the LED that it actually is connected to the broker.
Can you open up a sniffer (like MQTTFx) and subscribe to see all the messages sent & received by the broker?
I would check the mosquitto log file to make sure that it thought that all the clients are connecting successfully.
You can also increase the mosquitto logging to display messages being received in the log file, but you will have to look up how to do that in the mosquitto documentation - I have long since forgotten.