I feel like I might not get much sleep this week, this is driving me nuts.  
I installed linux on a VM on my desktop (the one that has working MQTT 
Explorer) and it worked.  The default (oracle virtualbox) was to just 
attach to my NAT, so it got an IP of 10.0.2.15 (which my desktop passes 
through to 192.168.1.185?).  Changing it to a bridge adapter, it picked up 
a DHCP address of 192.168.1.218, and then it did not work.

Here's my full setup:  Router is a stand-alone box running pfsense.  I have 
a server that runs freebsd doing virtualization (static, 192.168.1.30).  
Home Assistant is a VM (static, 192.168.1.35).  Weewx is a raspberry pi 2 
(static, 192.168.1.17).  Desktop windows machine (DHCP, 192.168.1.185).

I have another unrelated VM running on that free bsd machine for a 
minecraft server (static, 192.168.1.36).  Remoting in there gives the same 
problems trying to publish a message.  This machine's network setup is 
almost identical to the Home Assistant machine and it is able to accept 
connections on its minecraft port, 1935 or something.  

I tried moving the Weewx machine to DHCP since it's an easy test, but no 
change.  

So the working tests are: DHCP on 192.168.1.185, windows and linux mint, 
MQTT Explorer and mosquitto-clients

The non-working tests are: static and dynamic on 192.168.1.*, linux mint 
and raspbian, mosquitto-clients

So the answer may be that I should be asking in a home networking forum, or 
possibly a Hass.io forum.  Maybe I'll do some more tests from other 
machines to try and gather some more information.  




On Tuesday, January 26, 2021 at 6:42:25 AM UTC-7 Greg Troxel wrote:

>
> Jeff Beckman <[email protected]> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f110c14d-7351-4c91-bd89-00510d6d6572n%40googlegroups.com.

Reply via email to