I have openHab running on a RasPi and I have connected an arduino to it. On Arduino I use the pubsubclient to receive the MQQT messages from the RasPi.
There is an example of the callback function of the pubsubclient:
So, basically this function is called everytime a message is send to the Arduino. It should then just print the received message. So far, so good.
I have created some basic switches in OpenHab and everytime I press one I can see the corresponding message on Arduino side. So my setup basically works.
Now I have created a Color Item to control a LED stripe which is connected to the Arduino. The problem is that as soon as I change one of the color values in OpenHab I don’t see any message on the Arduino. The callback function just doesn’t pick anything up.
I then used wireshark to check if the actual message is send out or not. But in fact, the RasPi sends the message. But obviously the callback function just ignores it. Other messages are working fine (like the one for the switch)
Maybe you can see something misconfigured here but actually I don’t think the issue can be found here. I in fact can see the message on the network. That means that OpenHab and the broker seem to do everything right. But somehow the arduino doesn’t react to this message.
So, the MQTT message (that we cannot see) is what you expect, as to content and topic? openHAB is doing everything it should, you have an Arduino coding problem?
@rossko57 I am not sure if it is just an Arduino coding problem. But at least I think the problem is more related to Arduino than to the RasPi or OpenHab.
For me it looks like the RasPi sends out the message correctly (I can see it on the network) but the Arduino just doesn’t recognize it. Although it does with other MQTT messages.
Configuration: Go to Thing->Code and copy the code. Paste it marked as Code.
Message: What’s a working message (paste the data)? What’s a non working message (paste the data)?
When pasting code, mqtt messages, logs and so on, please mark as code. That way there will be no changing in format or text.
I don’t need to see the message.
but
You obviously want the correct message to be sent.
You’re telling us it is correct, that’s fine.
But you have a problem somewhere.
Maybe there is a typo you don’t see, or a difference in LetterCase, who knows.
If you’d like another pair of eyes to check it over, you have to show it.
If you completely trust your own judgement, then you don’t have to show it, and there’s no point in any of us talking about it.
Hey, I have to apologize. The issue is completely selfmade. I am not yet that much familiar with this MQTT stuff so I missed one line of code: of course I have to subsrice to a topic before I can receive commands from it
But now I face another issue:
These are the values which I can set in the corrseponding item. And I do see a receiving message on my Arduino. But the numbers are not the same: