Recently, the Raspberry PI I have been using for my home automation died. Since I can't get a new one at the moment, I decided to backup my Node Red flows and import them into my windows machine. I made sure all used nodes were installed. I then installed mosquitto and set it up as a service at boot (confirmed functioning). I then manually reset my IP address to the one the PI was using and confirmed through my router that it is configured properly. I can get nothing to work. My MQTT nodes say there connected, but I get no feedback from them and I get no control of them. What am I missing?
Test the MQTT is working with a few commands.
Open a two terminals on a PI and test if the broker is actually working.
(Bad example but.....)
## How to send MQTT messages
-h HOST
-t TOPIC
-m MESSAGE
mosquitto_sub -h 192.168.1.10 -t armtronix_mqtt
mosquitto_pub -h 192.168.1.10 -t armtronix_mqtt -m "Hi this is Armtronix_server"
Hope that helps.
Use an existing topic if you want.
And the two commands are each in their own terminal.
I apologize if I was unclear. The raspberry pi is dead. I migrated the flows over to my windows machine and I am trying to run it from there until I can get another pi or equivalent.
So far in my investigation, I have these facts:
My windows machine does operate on the pi's old IP address
Node red seems to be operating properly (there are no broken flows, and all used nodes are installed and working)
Node red is communicating with mosquitto (I created an MQTT flow to send a payload through the broker and I get the same payload back from a separate receive node)
All MQTT nodes are connected (if I change the broker settings, the MQTT nodes fail to connect)
I can verify mosquitto via command line using the above commands (windows version)
I have verified that port 1883 is listening
I can find no settings in my router that inhibit the use of port 1883 (as evident by the pi operating from the same router)
I set an inbound and outbound rule to allow port 1883 through the firewall
All my IOT devices are still connected to the network (I can bring each one up in UI according to their IP addresses((Tasmota ui))
I thought it might have been my antivirus, but I disabled it, and still nothing.
The only thing I can think of is that there is a setting in mosquitto that differs from the old pi. I might try to recover the mosquitto .CONF file from the pi and see if there's a difference.
I don't know what else it could be. I figured I probably missed something simple, that's why I enlisted the help of people smarter than me!
Then I would suggest putting debug
nodes on the MQTT IN
nodes and make sure they are getting what is needed - to be sure.
And putting debug
nodes on the MQTT OUT
nodes to make sure they are sending stuff.
Beyond that: I have no idea/s.
You haven't given any declarations of how these flows work.
It is likely that you will need to match the configuration with your old pi setup, as a fresh mosquito install doesn't allow connection from remote IPs. You may also have setup passwords etc.
If you cannot access the old config then as a minimum add listener 1883 to your new mosquito config.
No one asked for one of the flows. attached is the test flow that I created to test the broker
This flow works as I mentioned in my last reply. For some reason my tasmota devices are not getting to (or through) the broker the same way as with the pi. Unfortunately, I can't compare the pi mosquitto .conf file to windows because raspbian sets up the file differently. The same .conf file looks completely different. I feel like there is something in the .conf file that is preventing connection. I will attach the .conf file if it will help, but it's pretty much unchanged. I'm pretty sure that every edit I tried was returned to its original state when it didn't solve the problem.
Node Red Test Flow.txt (3.05 KB)
(Attachment mosquitto.conf is missing)
The new setup is not on a remote machine. I am trying to match the pi as closely as possible. So the broker is on the same machine as node red (Node js) with the same IP address, connected to the same network. as in my previous reply, I already set port 1883 to listen. But nothing is getting through. That is what makes me think it's a .conf issue in mosquitto.
I would agree it is a config issue, can you post it here ?
Node red is on same machine so it CAN access, but clients are "remote" and are blocked by default.
Not sure how to attach a file in here. but the .conf file is unchanged. I can look through it again and see if I can change that setting.
click on the </> icon then just copy and paste the text inside the ticks
To many characters.
Did you setup mosquitto passwords on the PI ? If not then you will also need the allow_anonymous setting
listener 1883
allow_anonymous true
Make sure that you have those settings in the config. If they already exist make sure they are not commented out and there is only 1 entry for each.
Restart after making the changes.
You might check this link if you are still having issues
Well, that is useful information you are now sharing.
I am NOT going to import your flow. Sorry. SECURITY issues there for a start.
I fear your problem is beyond my skill set.
Well you need to do some work to determine how/why they are different and how that changes things.
Check what @smcgann99 said. This whole thing has got way beyond me too quickly.
That did it! Thank you!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.