I have two gateways each with their own network. When they run by themselves, they connect fine with MQTT & OpenHAB.
When I power up both & connect them to my home ethernet network, they rapidly connect & disconnect from MQTT as if bumping each other.
With progressive things I've tried, the two gateways/networks have different gateway id, different network id, different encryption key, & different MQTT topics.
Is it possible to have two networks? If yes, what am I missing?
Thanks
Quote from: TechDad on June 24, 2016, 10:17:07 PM
I have two gateways each with their own network. When they run by themselves, they connect fine with MQTT & OpenHAB.
When I power up both & connect them to my home ethernet network, they rapidly connect & disconnect from MQTT as if bumping each other.
With progressive things I've tried, the two gateways/networks have different gateway id, different network id, different encryption key, & different MQTT topics.
Is it possible to have two networks? If yes, what am I missing?
Thanks
ISTM that the problem is on the LAN/MQTT side of the gateways. I've had three gateways with different network IDs, same encryption, same frequency, running for a couple of years at my site. Collisions on the RFM69 side occur but don't show up in the recvd data and seem to iron themselves out with no more than 3 tries.
Tom
Thanks, Tom, I think you may be right "that the problem is on the LAN/MQTT side of the gateways," esp. the MQTT side. Both nodes successfully show up with a different MAC address & different IP addresses on my network router. But then they don't seem to let each other have a stable connection with MQTT.
You said, you've "had three gateways with different network IDs, same encryption, same frequency, running for a couple of years at my site." Please share the sketch you use to program your gateways. Maybe I can glean something by comparing with mine.
Quote from: TechDad on June 25, 2016, 09:53:23 PM
Please share the sketch you use to program your gateways. Maybe I can glean something by comparing with mine.
There's nothing magic in my gateway code to manage this. Even the Moteino example code is able to handle multiple gateways if you change the network ID (you don't even have to change the gateway ID if network ID is unique - but I would). The bulk of my Gateway code is related to how I manage my nodes and packetized data, which is too specific to my setup and servers and I won't be publishing that.
Tom
Tom, from what you said, I can understand how you would not want to share all of your gateway code.
My/our version of the gateway uses PubSubClient library to communicate with MQTT. Our version works fine with one gateway, but so far for me, with two gateways, they rapidly connect & disconnect from MQTT & communication with nodes drastically suffers even if both gateways have different MACs, IPs, Gateway ID, Network Id, & MQTT topic.
I just took another look at https://raw.githubusercontent.com/LowPowerLab/RFM69/master/Examples/Gateway/Gateway.ino
Is that what you mean by the Moteino Example code? or do you mean something else?
In Gateway.ino, I see no code that relates to MQTT.
However, it sounds like you are using MQTT with your gateways.
I am asking a more senior person with our gateway version to look at the MQTT code.
However, I would also appreciate if you could share just the part of your gateway code that relates to MQTT & any settings that might affect having more than one gateway. Maybe I/we can get a clue from that.
Thanks in advance for your patience & help.
Quote from: TechDad on June 26, 2016, 12:30:49 PM
Tom, from what you said, I can understand how you would not want to share all of your gateway code.
My/our version of the gateway uses PubSubClient library to communicate with MQTT. Our version works fine with one gateway, but so far for me, with two gateways, they rapidly connect & disconnect from MQTT & communication with nodes drastically suffers even if both gateways have different MACs, IPs, Gateway ID, Network Id, & MQTT topic.
Are your two gateways using the same MQTT login parameters? Or are they unique?
Quote
I just took another look at https://raw.githubusercontent.com/LowPowerLab/RFM69/master/Examples/Gateway/Gateway.ino
Is that what you mean by the Moteino Example code?
Yes, but I was referring to how to set the Moteino network parameters, not MQTT.
Quote
In Gateway.ino, I see no code that relates to MQTT.
However, it sounds like you are using MQTT with your gateways.
I am not using MQTT, I rolled my own messaging/posting protocol, which is why I'm not sharing. It wouldn't be much use to anyone and I'd get beaucoup questions.
Tom
I suggest capturing packets on the broker using tcpdump or wireshark to see what is happening at the packet level. Sounds like duplicate Ethernet MAC addresses but could be something else.
OK, I solved it. It should be pretty simple to solve if one knows what they are doing about MQTT, which I don't know much. I just knew somethings connect, then something subscribes & some things publish.
I'm getting to know the node code possibilities much more, but I have not done much with gateway code because to this point (after a few settings covered), it has worked.
However I am dogged about analyzing, asking help, & trying things until I often find a solution or a dead end.
There were clues embedded in our communications about my problem on this forum & a couple others:
I kept saying it seemed like a problem mainly with MQTT from the two gateways fighting each other & knocking each other off.
In a general sense, some of you would talk about MQTT clients.
So the solution came down to the one necessary MQTT thing that I did not have different on the two gateways.
I needed to give the second gateway ... a different clientName. The gateways were fighting because they kept trying to connect with the same clientName.
Now I have a one Gateway plus its several nodes AND a new second Gateway plus its one node both connected to the same MQTT server & the same openHAB UI & its all working together just fine.
Now I see that one can spread the load of node communication & expand the network capability by using more than one gateway. (That's why I tried to solve this.)
Followup: Sometimes, maybe even often in my experience, it is the simplest thing that blocks success. Then again, it's not simple UNTIL we or someone else notices it.
I'm still getting a good crisp response between the new gateway & its one node & between the original gateway & its several nodes (no degradation noticed from the added gateway) AND both gateways are reliably bridging their communications between their nodes & MQTT/OpenHAB.
Awesome, persistence pays great dividends.