No, the “problem” is the RPI and NOT using DHCP.
Also the RPI is NOT my main gateway.
I have a network with FIXED IP addresses. That connects to a ROUTER. And I prefer FIXED IP addresses on my LAN.
I have a RPI as a “WAP” (not really the right term I think) as its WiFi addresses are different to the LAN. There is NAT in there somewhere but read on.
It is … what ever.
When I connect to the RPI WAP, I get full access to the LAN - and web. That part works. Though it doesn’t work 100% as it should.
THAT RPI can surf the net, access all other devices on the LAN, save one. The gateway/modem.
I just won’t ping it. But that’s another story.
So, back to the WAP thing.
If I connect to the RPI - for which I only found notes to do it with DHCP - the connection works.
If I program the Arduino with a FIXED IP - even in the DHCP range - it (the Arduino) can’t see the MQTT broker/server. Which is on that RPI.
I’ve tried for hours/days trying to get it working and have given up.
SO, when the Arduino connects, it has to get a dynamic IP.
Granted I set the lease as long as I want, but the thing is if the IP is dynamic, I don’t want to use the IP allocated by DHCP because one day it may change. Then I have to go and change the IP addresses used to detect it being connected to the new one.
Does that help?
I would like to get FIXED IP addresses working on the WiFi side as well, but it just isn’t going to happen now.
It is handy having DHCP on it as well, as now and then I connect to it to control things with my phone and so the IP is not relevant and it saves messing about with setting the IP when it doesn’t really matter in that case.
The RPI is running Jessie. Not Stretch and I don’t want to update to Stretch as there are a lot of things to do and I just don’t need the hassle just now. (Enough Yaks to shave as it is.)
End of back-back story.
That’s about it.
So what I am wanting to do is get something happening (MQTT LWT would do it) but reading the Arduino MQTT docs I can’t see where/how to add LWT to the connection, so if the connection is abruptly terminated, the program knows.
As stated, I have a couple of tricks working in NR now so when it connects, it is identified. But I haven’t tried it with multiple DHCP devices that are Arduinos and have that trick at their end to make it all work.