Stefan,
Here are a couple of more things you could try.
First, try subscribing via mosquitto_sub to via the host name and the IPV4
and IPV6 addresses.
mosquitto_sub -v -t '#' -h wxvm.bz3gfkrlqtrsc3sv.myfritz.net
mosquitto_sub -v -t '#' -h 77.21.85.171
mosquitto_sub -v -t '#' -h 2a02:8108:9340:757c:efa5:3c2b:a158:b1d9
You could also try to run the attached (python3 connect.py). If I have
read the paho mqtt and socket code correctly, this should simulate what it
does to establish a connection.
rich
On Tuesday 15 October 2024 at 05:11:52 UTC-4 Stefan Gliessmann wrote:
> Hello Rich et al.,
>
> I was a bit busy exploring Spain and, so, did not do a lot of trouble
> shooting on this issue ...
>
> Well - I still have the same issue:
>
> [image: Screenshot 2024-10-15 at 11.05.50.png]
>
> When I run the little socket info py, I get this:
>
> [image: Screenshot 2024-10-15 at 11.05.13.png]
>
> which looks good to me ... I am continued to be puzzled ...
>
> Please throw more stuff at me to see if anything might stick and we have
> an inlay to the problem ...
>
> Cheers,
> Stefan
>
> On Wednesday, October 9, 2024 at 1:28:55 AM UTC+2 [email protected] wrote:
>
>> Well, the fact that MBP is behind the router and connect via websockets
>> (Belchertown) and MQTT (MQTT Explorer) could connect to your broker, makes
>> it seem like it is something with the PI or pahoo mqtt.
>> While not exact, this seems similar
>> https://github.com/eclipse/paho.mqtt.python/issues/154
>> I''d try running mosquitto_sub from the PI and MBP and see if it works on
>> both.
>> You could also try running the attached on both. From my understanding,
>> it is used to get the IP to create the socket. I'm wondering if on the PI
>> it is not returning a 'good' IP.
>> I'm definitely not a network guy and I'm wading deep into pahoo mqtt and
>> the the python socket module. So, yes, I am throwing stuff against the wall
>> to see what will stick...
>> rich
>>
>> On Tuesday 8 October 2024 at 16:45:36 UTC-4 Stefan Gliessmann wrote:
>>
>>> So your RV Router can publish to your MQTT broker? Is this some type of
>>> built in functionality of the router?
>>> - Yes, it is. The RV Router has a ton of features including GPS and
>>> MQTT. For GPS I was able to configure "Modbus TCP Devices" (menu point of
>>> the RV Router) to publish lat & long per MQTT under topic GPS.
>>> This is the router that the PI is behind that cannot publish or
>>> subscribe?
>>> - Yes, the weewx PI is behind the RV Router (Teltonika RUTX11 is the
>>> brand and model)
>>> Are you running MQTT Explorer on the PI. If so, it appears that can
>>> subscribe, correct?
>>> - Ah, no! The MQTT Explorer runs on my MBP. My MBP is also "behind"
>>> the RV Router and can connect to the home MQTT broker!
>>> The browser is also runing on the PI, correct?
>>> - Hmm, no ... You mean the web browser showing "Connected. Waiting for
>>> data ..."? No, that is again on my MBP connected to a web host in the
>>> cloud. There is - at least for me - no way to have a web server on the PI
>>> behind the RV Router which does not get a static IP over 4G ... The PI ftps
>>> to the remote (cloud) web server (the provider is strato.de - I use the
>>> same for my "home" WeeWX).
>>>
>>> Next - probably tomorrow - I will try to VPN my RV Router to my home
>>> router via WireGuard ... Maybe that will solve it temporarily (while I am
>>> on holiday)!
>>>
>>> On Tuesday, October 8, 2024 at 9:58:11 PM UTC+2 [email protected] wrote:
>>>
>>>> A few of questions/clarifications
>>>> So you RV Router can publish to your MQTT broker? Is this some type of
>>>> built in functionality of the router?
>>>> This is the router that the PI is behind that cannot publish or
>>>> subscribe?
>>>> Are you running MQTT Explorer on the PI. If so, it appears that can
>>>> subscribe, correct?
>>>> The browser is also runing on the PI, correct?
>>>> Things are pointing to something in paho mqtt client, used by both
>>>> MQTTSubscribe WeeWX-MQTT… Unfortunately I still don’t have any good ideas
>>>> yet. I was really hoping that the IP address would work…
>>>>
>>>> Note, 1.6.1 is not the latest version. The version installed by apt is
>>>> behind. The version is up to 2.1.0
>>>> BUT, I would be very hesitant to upgrade to that. 2.0 introduced many
>>>> breaking changes and many python clients broke. In theory 2.1.0 ‘fixes’
>>>> this, but since I have updated all my MQTT clients to work with 2.x and
>>>> 1.6, I cannot verify that.
>>>> AND, I do not see anything in the release notes that leads me to think
>>>> this would be fixed.
>>>> rich
>>>>
>>>> On Tuesday 8 October 2024 at 15:37:06 UTC-4 Stefan Gliessmann wrote:
>>>>
>>>>> Continuing to find some more details/hints/breadcrumbs ...
>>>>> For MQTT.Subscribe I used the IP of the broker which gets resolved via
>>>>> ping. Still not reachable.
>>>>> Then I set MQTT.Subcribe enable = false to see if the other client can
>>>>> connect to the same broker. and ... no ...
>>>>>
>>>>> *ERROR user.mqtt: Failed to connect to MQTT server
>>>>> (mqtt://teffi:[email protected]:1883/
>>>>> <http://teffi:[email protected]:1883/>): [Errno 101]
>>>>> Network is unreachable*
>>>>>
>>>>> *ERROR weewx.restx: MQTT: Failed to publish record 2024-10-08 21:18:25
>>>>> CEST (1728415105): MQTT client not available*
>>>>>
>>>>> So it seems to be a "port 1883 issue", but where? Pi, the RV router,
>>>>> the home router, the VM on which the broker runs? (But why would it work
>>>>> in
>>>>> Germany just fine ...?)
>>>>> Can the internet provider limit port 1883?
>>>>> The SIM card in the RV router is from Vodafone Germany ...
>>>>> In the meantime, I rebooted the ubuntu box with my home weewx on which
>>>>> also my MQTT broker resides, too. Still "Errno 101"
>>>>>
>>>>> That the MQTT broker works at home and receives the GPS topic from my
>>>>> RV router and republishes them under RVGPS can be seen below (for
>>>>> real-time
>>>>> weather data, the topic would be RV:
>>>>>
>>>>> [image: Screenshot 2024-10-08 at 21.27.31.png]
>>>>> On Tuesday, October 8, 2024 at 8:50:38 PM UTC+2 Stefan Gliessmann
>>>>> wrote:
>>>>>
>>>>>> Hi gents -
>>>>>>
>>>>>> I did not know that they are using different clients, but I knew the
>>>>>> difference in the port numbers 1883 vs 9001 ;)
>>>>>>
>>>>>> My raspbi runs python3-paho-mqtt is already the newest version
>>>>>> (1.6.1-1).
>>>>>>
>>>>>> I started with restarting weewx, then mosquitto, then the Raspberry
>>>>>> Pi and just for good measure also the internet router ... nothing
>>>>>> resolved
>>>>>> the issue.
>>>>>>
>>>>>> In the meantime I arrived in Spain and I have still the same issue.
>>>>>>
>>>>>> My GPS router is the Teltonika RUTX11 which runs BusyBox v1.34.1 The
>>>>>> GPS coordinates are read from a GPS receiver connected to the router and
>>>>>> send via "Modbus TCP Devices" to my home MQTT broker under the topic
>>>>>> RVGPS
>>>>>> ...
>>>>>> I will now start enabling log = true & debug = 1
>>>>>>
>>>>>> Thanks for the input so far - I will keep you posted ...
>>>>>> Cheers
>>>>>>
>>>>>>
>>>>>> On Tue, Oct 8, 2024 at 1:28 AM [email protected] <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> It is another interesting data point. A couple of things to note.
>>>>>>> 1. The connections are using two different protocols. Belchertown is
>>>>>>> connecting over websockets and MQTTSubscribe is connecting over MQTT.
>>>>>>> 2. It is two different MQTT clients. Belchertown is using a
>>>>>>> javascript client while MQTTSubscribe uses a python client.
>>>>>>> So, it appears that the javascript client/websockets can handle the
>>>>>>> network change and the paho mqtt client/mqtt client cannot. Now to
>>>>>>> figure
>>>>>>> out why…
>>>>>>>
>>>>>>> Out of curiosity, what version of the paho mqtt client are you using?
>>>>>>> rich
>>>>>>>
>>>>>>> On Monday 7 October 2024 at 15:42:20 UTC-4 Stefan Gliessmann wrote:
>>>>>>>
>>>>>>>> Interestingly, rv.stegli.de sees the web socket of my home MQTT
>>>>>>>> broker ...
>>>>>>>>
>>>>>>>> [image: Screenshot 2024-10-07 at 21.39.47.png]
>>>>>>>>
>>>>>>>> On Monday, October 7, 2024 at 9:25:34 PM UTC+2 Stefan Gliessmann
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Thanks, Vince!
>>>>>>>>>
>>>>>>>>> I am puzzled what it could be blocking here in France compared
>>>>>>>>> when it worked just fine in Germany. (rv.stegli.de shows the last
>>>>>>>>> data before crossing over to France).
>>>>>>>>>
>>>>>>>>> On Monday, October 7, 2024 at 9:20:34 PM UTC+2 vince wrote:
>>>>>>>>>
>>>>>>>>>> I can subscribe to your data from the USA too so you must have
>>>>>>>>>> some kind of networking thing going on that is preventing port 1883
>>>>>>>>>> in from
>>>>>>>>>> wherever you are.
>>>>>>>>>>
>>>>>>>>>> On Monday, October 7, 2024 at 12:08:40 PM UTC-7 Stefan Gliessmann
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Yes, I can ping it and it gets resolved correctly ...
>>>>>>>>>>> My internet router in my RV forwards the GPS coordinates per
>>>>>>>>>>> MQTT to my home broker correctly, too ...
>>>>>>>>>>>
>>>>>>>>>>> On Monday, October 7, 2024 at 9:06:15 PM UTC+2 vince wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I can ping that FQDN from the USA if that matters.....
>>>>>>>>>>>>
>>>>>>>>>>>> On Monday, October 7, 2024 at 11:51:31 AM UTC-7 Stefan
>>>>>>>>>>>> Gliessmann wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello -
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am running a mobile WeeWX station in my RV. I use MQTT to
>>>>>>>>>>>>> provide real-time weather data from the basic ecowitt gateway. I
>>>>>>>>>>>>> augment
>>>>>>>>>>>>> the weather data via MQTT every 5 min or so with data from
>>>>>>>>>>>>> OpenWeather.
>>>>>>>>>>>>> Additionally, I share my GPS coordinates and a calculated
>>>>>>>>>>>>> altitude.
>>>>>>>>>>>>>
>>>>>>>>>>>>> WeeWX runs on a raspberry pi in my RV. Internet is provided by
>>>>>>>>>>>>> an internet router via 4G mobile phone network.
>>>>>>>>>>>>>
>>>>>>>>>>>>> All this worked great as long as I was in Germany. The moment
>>>>>>>>>>>>> I crossed boarder to France and the mobile phone network switches
>>>>>>>>>>>>> to the
>>>>>>>>>>>>> other country, I receive this error:
>>>>>>>>>>>>>
>>>>>>>>>>>>> ""*ERROR user.MQTTSubscribe: (Service) Failed to connect to
>>>>>>>>>>>>> wxvm.bz3gfkrlqtrsc3sv.myfritz.net
>>>>>>>>>>>>> <http://wxvm.bz3gfkrlqtrsc3sv.myfritz.net> at 1883. '[Errno 101]
>>>>>>>>>>>>> Network is
>>>>>>>>>>>>> unreachable'*""
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am a bit puzzled why my home MQTT broker's port cannot be
>>>>>>>>>>>>> reached ...
>>>>>>>>>>>>>
>>>>>>>>>>>>> Any clue how I can trouble shoot this?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thank you guys in advance knowing that this isn't a core WeeWX
>>>>>>>>>>>>> problem :)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>> the Google Groups "weewx-user" group.
>>>>>>> To unsubscribe from this topic, visit
>>>>>>> https://groups.google.com/d/topic/weewx-user/K8EABxk8R7o/unsubscribe
>>>>>>> .
>>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>>> [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/weewx-user/3e1117e3-c4d6-4ac9-9613-707141f5d58bn%40googlegroups.com
>>>>>>>
>>>>>>> <https://groups.google.com/d/msgid/weewx-user/3e1117e3-c4d6-4ac9-9613-707141f5d58bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>
--
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/6d9f4c63-2cf8-46b5-be4e-c1bcda193b3an%40googlegroups.com.
import socket
HOST = 'wxvm.bz3gfkrlqtrsc3sv.myfritz.net'
PORT = 1883
TIMEOUT = 5
SOURCE_ADDRESS = ('', 0)
infos = socket.getaddrinfo(HOST, PORT, 0, socket.SOCK_STREAM)
for res in infos:
print(res)
family, socktype, proto, canonname, address = res
sock = None
try:
sock = socket.socket(family, socktype, proto)
sock.settimeout(TIMEOUT)
if SOURCE_ADDRESS:
sock.bind(SOURCE_ADDRESS)
sock.connect(address)
print(f" SUCCESS: {sock}")
except Exception as exception:
print(f" ERROR: {exception}")