Jeff Beckman <
jeffrey...@gmail.com> writes:
> OK, that produced some interesting results. For your first suggestion, my
> broker computer is running Hass.io (Home Assistant), which doesn't have the
> ss command. I'll keep digging there to see if there's another way to
> double check that the port is open, but the log seems to indicate it's
> listening on 1883.
>
> I installed mosquitto-clients on a raspberry pi that I'm not using for
> Weewx or my broker. So far everything I try there results in the same
> connection refused error. I've tried both as anonymous and as a user.
> Here's an example of an attempt:
> pi@piopolis:~ $ mosquitto_sub -h 192.168.1.35 -t test -u homeassistant -P
> reallylongpassword
> Error: Connection refused
That's great progress; you have shown that your MQTT setup is troubled
without even involving weewx.
It's time to:
check the config file for the broker to see if it is listening on
localhost only (which doesn't make a lot of sense) or to *:* or to
that address specifically. Setup questions for a
hass.io broker are
probably best posed to some HA forum.
check all your firewall configurations. Firewalls are notorious for
breaking intended communication, and the fun you have fixing that is
the tradeoff for whatever protection you get. I would do this by:
reading the firewall configs
querying the firewall stats and logs of filtered packets
running tcpdump on both the weewx computer and the
hass.io computer.
If either is some kind of container, also add the computer hosting
that container.
> Checking the log on the broker, I see no evidence of the attempt, which
> would point to the port not actually being open. But then I try to connect
No, it points to the operating system not doing all of receiving a SYN and
successfully completing the TCP 3-way handshake. Brokers more or less
all just use accept(2) to listen for connections and don't process TCP.
> from my windows machine using MQTT Explorer and everything works. I can
> publish messages and see them pop up on my broker machine. The log looks
> normal.
That's an intersting clue that perhaps the problem is a firewall that
affects the weewx machine and not the windows machine.
You might also try basic things like ping of the broker from the weewx machine.
> 1611639012: New connection from 172.30.32.1 on port 1883. [INFO] found
> homeassistant on local database
> 1611639012: New client connected from 172.30.32.1 as 5yoX9kmQROmBbxG2B0yAct
> (p2, c1, k60, u'homeassistant').
> 1611639366: New connection from 192.168.1.185 on port 1883. [INFO] found
> homeassistant on local database
> 1611639366: New client connected from 192.168.1.185 as
> mqtt-explorer-a18267b6 (p2, c1, k60, u'homeassistant').
That certainly looks like it is accepting connections from off machine.
An interesting mix of RFC1918 addresses, but maybe that's intended.
Make sure your entire home LAN setup has a consistent addressing plan,
with no reuse.