hi all,

at  https://mqtt-explorer.com i can see data coming in, also i can test by 
publishing "hello world"

i've downloaded the latest version from the mosquitto developer

if i change the localhost to 192.168.0.125 i get a wss error, the 
connection doesn't fail anymore but is trying to connect endlessly.

if I change even the weewx.conf with
 log_success = False
        log_failure = True
 
my weewx will not start

i tried to set up a domain with duckdns.org with suces but can't create a 
ssl certificate.

please advise, i'm lost now.

please find all the logs in the attached txt file.

i guess my paid server will not allow websockets?

also i'm running a ubuntu in a virtual box, and is bridged with my windows 
machine
my windows ip is 192.168.0.189
my ubuntu local is 127.0.0.1
my bridged ubuntu is 192.168.0.125

chrome, edge, firefox give the same error

thank you so much!!



Op zondag 27 november 2022 om 16:54:14 UTC+1 schreef gary....@gmail.com:

> I'll agree that localhost can't be used, for testing I use the LAN 
> address. For me it  is 10.10.10.15
> It's how I run my test server instance which has no SSL certs.
> http://tester.lan/jas/ for example brings up the jas skin with websockets 
> functioning from any device on my LAN.
> But, if you have no local DNS resolver, http://10.10.100.15/jas would be 
> needed.
>
>
> On Sunday, November 27, 2022 at 5:05:10 AM UTC-5 mh081...@gmail.com wrote:
>
>> Hi,
>>
>> you  shouldn't use "localhost" in your config.If you connect to your 
>> website with your browser, then locahlost are used to connect to the mqtt 
>> server.
>> This failed if you try to connect from your client. I think it will only 
>> be possible when you start the browser from the mqtt server direct.
>>
>> From my Config (i use ssl):
>>
>> ##### weewx.conf####all configs from belchertown are in my weewx.conf 
>> because of possible update of weewx#
>>     [[MQTT]]
>>         server_url = mqtt://pi:pass...@gw.martenhinrichs.de:8883/ 
>> <http://pi:passw...@gw.martenhinrichs.de:8883/>
>>
>>         topic = weather
>>         unit_system = METRIC
>>         binding = archive, loop
>>         aggregation = aggregate
>>         log_success = False
>>         log_failure = True
>>         [[[tls]]]
>>             tls_version = tlsv12
>>             ca_certs = /etc/ssl/certs/ca-certificates.crt
>>         [[[inputs]]]
>>             [[[[dayRain]]]]
>>                 name = dayRain_mm
>>                 units = mm
>>             [[[[rainRate]]]]
>>                 name = rainRate_mm_per_hour
>>                 units = mm_per_hour
>> #####
>>
>> #####/etc/mosquitto/conf.d/myconfig.conf####
>> allow_anonymous true
>> password_file /etc/mosquitto/passwd
>> acl_file /etc/mosquitto/acl
>> persistence false
>>
>> # mqtt
>> listener 1883 localhost
>> listener 8883
>> certfile /etc/letsencrypt/live/gw.martenhinrichs.de/cert.pem
>> cafile /etc/letsencrypt/live/gw.martenhinrichs.de/chain.pem
>> keyfile /etc/letsencrypt/live/gw.martenhinrichs.de/privkey.pem
>> protocol mqtt
>>
>> # websockets
>> listener 9001
>> certfile /etc/letsencrypt/live/gw.martenhinrichs.de/cert.pem
>> cafile /etc/letsencrypt/live/gw.martenhinrichs.de/chain.pem
>> keyfile /etc/letsencrypt/live/gw.martenhinrichs.de/privkey.pem
>> protocol websockets
>> #####
>>
>> ##### /etc/mosquitto/mosquitto.conf
>> pid_file /run/mosquitto/mosquitto.pid
>>
>> persistence true
>> persistence_location /var/lib/mosquitto/
>>
>> log_dest file /var/log/mosquitto/mosquitto.log
>> log_type error
>> log_type warning
>> connection_messages false
>> #####
>>
>> gary....@gmail.com schrieb am Sonntag, 27. November 2022 um 03:38:46 
>> UTC+1:
>>
>>> What are you using to try the connection?
>>> I'd recommend https://mqtt-explorer.com/ to see what the mosquitto 
>>> server is showing. MQTT Explorer has the option to look at websockets as 
>>> well as MQTT. But first you want to see the loop values in MQTT.
>>>
>>> If you are using Firefox, you should also get the latest mosquitto 
>>> server direct from the developer by using the repository. Once I did that, 
>>> my Firefox issues went away. Depending on distro, version, etc your distro 
>>> may not have a current/new enough mosquitto server to solve the FF issue.
>>>
>>> We'd also need to see your mosquitto.conf including if you followed 
>>> Pat's guide, myconfig.conf. It could also be your acl file, or that the 
>>> password is not correct, but if weewx is sending data and it is accepted, 
>>> unlikely it is that.
>>>
>>> On Saturday, November 26, 2022 at 2:38:32 PM UTC-5 vanuxe...@gmail.com 
>>> wrote:
>>>
>>>> I installed mqtt as an wee_extensions,
>>>> And followed the instructions.
>>>>
>>>> I installed the mqtt broker as instructed, mosquito, as instructed on 
>>>> the belchertown wiki. 
>>>>
>>>> Both portsaus 1883 and 9001 are open in my ubuntu running in a virtual 
>>>> box environment.
>>>>
>>>> I checked your links, thx for that. But that also was followed.
>>>>
>>>> By glad if you had more specifics 
>>>>
>>>>
>>>> Thx
>>>>
>>>>
>>>>
>>>> Op za 26 nov. 2022 20:17 schreef vince <vince...@gmail.com>:
>>>>
>>>>> Connection refused means the computer you specified (localhost) is not 
>>>>> listening on the port you specified (9001).   So you have more software 
>>>>> to 
>>>>> install and configure in addition to weewx and the skin.
>>>>>
>>>>> Reread 
>>>>> https://github.com/poblabs/weewx-belchertown#mqtt-and-mqtt-websockets-optional
>>>>>  
>>>>> and https://github.com/poblabs/weewx-belchertown#mqtt-brokers for 
>>>>> what is needed and how to do it.
>>>>>
>>>>> On Saturday, November 26, 2022 at 5:52:55 AM UTC-8 vanuxe...@gmail.com 
>>>>> wrote:
>>>>>
>>>>>> Hi 
>>>>>>
>>>>>> I'm trying to set mqtt inside the belchertown skin.
>>>>>>
>>>>>> i can see that my data is getting published in the syslog.
>>>>>>
>>>>>> however the connection fails in my website
>>>>>>
>>>>>> in the developer i get this: 
>>>>>>
>>>>>> WebSocket connection to 'ws://localhost:9001/mqtt' failed: Error in 
>>>>>> connection establishment: net::ERR_CONNECTION_REFUSED
>>>>>>
>>>>>> my set in the belchertown skin.conf is this
>>>>>>
>>>>>> # MQTT Websockets defaults
>>>>>>     mqtt_websockets_enabled = 1
>>>>>>     mqtt_websockets_host = "localhost"
>>>>>>     mqtt_websockets_port = 9001
>>>>>>     mqtt_websockets_ssl = 0
>>>>>>     mqtt_websockets_topic = "weather"
>>>>>>     disconnect_live_website_visitor = 1800000
>>>>>>
>>>>>> in weewx.conf its this
>>>>>>
>>>>>> [[MQTT]]
>>>>>>         server_url = mqtt://alex:passwd@localhost:1883/
>>>>>>         topic = weather
>>>>>>         unit_system = METRIC
>>>>>>         binding = archive, loop
>>>>>>         aggregation = aggregate
>>>>>>
>>>>>> can somebody point me in the direct direction, please?
>>>>>>
>>>>>> thank you!!
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>> 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 weewx-user+...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/weewx-user/841ec5a0-f416-45db-938b-74753ccd645an%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/weewx-user/841ec5a0-f416-45db-938b-74753ccd645an%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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/6a4d65e6-edd0-4bfb-b483-c016cab1a3a0n%40googlegroups.com.
/etc/mosquitto/conf.d/myconfig.conf

persistence false

# mqtt
listener 1883
protocol mqtt

# websockets
listener 9001
protocol websockets

allow_anonymous true
password_file /etc/mosquitto/passwd

acl_file /etc/mosquitto/acl

/etc/moosquitto/acl


# Allow anonymous access to the sys
topic read $SYS/#

# Allow anonymous to read weather
topic read weather/#

# weewx readwrite to the loop
user alex
topic weather/#

/etc/mosquitto/mosquitto.conf

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /run/mosquitto/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

belchertown skin.conf


    # MQTT Websockets defaults
    mqtt_websockets_enabled = 1
    mqtt_websockets_host = "192.168.0.125"
    mqtt_websockets_port = 9001
    mqtt_websockets_ssl = 0
    mqtt_websockets_topic = "weather"
    disconnect_live_website_visitor = 1800000


MQTT: Connecting to MQTT Websockets: 192.168.0.125 9001 (SSL Disabled)
paho-mqtt.min.js:37 
        
       Mixed Content: The page at 
'https://www.sint-katelijne-waver-meteo.be/weewx/' was loaded over HTTPS, but 
attempted to connect to the insecure WebSocket endpoint 
'ws://192.168.0.125:9001/mqtt'. This request has been blocked; this endpoint 
must be available over WSS.
d._doConnect @ paho-mqtt.min.js:37
belchertown.js?1669582041:37 Updating weewx data
jquery.min.js:2 
        
       Uncaught DOMException: Failed to construct 'WebSocket': An insecure 
WebSocket connection may not be initiated from a page loaded over HTTPS.
    at d._doConnect 
(https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.1.0/paho-mqtt.min.js:37:251)
    at d.connect 
(https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.1.0/paho-mqtt.min.js:31:233)
    at Client.connect 
(https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.1.0/paho-mqtt.min.js:70:506)
    at connect 
(https://www.sint-katelijne-waver-meteo.be/weewx/js/belchertown.js?1669582041:1305:12)
    at HTMLDocument.<anonymous> 
(https://www.sint-katelijne-waver-meteo.be/weewx/:148:13)
    at l 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29375)
    at c 
(https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29677)
         
         192.168.0.125
$SYS
broker
load
messages
publish
bytes
sockets
connections
publish
clients
messages
store
bytes
version = mosquitto version 2.0.11
uptime = 3641 seconds
subscriptions
heap
retained messages
weather
loop = {"dateTime": "1669582213.0", "outTemp_C": "7.555555555555556", 
"outHumidity": "91.6", "dewpoint_C": "6.277777777777776", "heatindex_C": 
"7.555555555555556", "windchill_C": "7.3888888888888875", "txBatteryStatus": 
"0.0", "UV": "0.0", "radiation_Wpm2": "0.0", "windSpeed_kph": "1.609344", 
"windDir": "178.0", "windGust_kph": "11.265408", "windGustDir": "102.0", 
"inTemp_C": "22.88888888888889", "inHumi…
test = hello world

weewx conf


    [[MQTT]]
        server_url = mqtt://alex:kleenex@localhost:1883/
        topic = weather
        unit_system = METRIC
        binding = archive, loop
        aggregation = aggregate


1669578116: Client <unknown> closed its connection.
1669578122: New connection from 127.0.0.1:56571 on port 1883.
1669578122: Client <unknown> closed its connection.
1669578128: New connection from 127.0.0.1:35383 on port 1883.
1669578128: Client <unknown> closed its connection.
1669578142: New connection from 127.0.0.1:33623 on port 1883.
1669578142: New client connected from 127.0.0.1:33623 as weewx_b417fb72 (p2, 
c1, k60, u'alex').
1669578287: Client mqtt-explorer-a548b358 disconnected.
1669578563: mosquitto version 2.0.11 starting
1669578563: Config loaded from /etc/mosquitto/mosquitto.conf.
1669578563: Opening ipv4 listen socket on port 1883.
1669578563: Opening ipv6 listen socket on port 1883.
1669578563: Opening websockets listen socket on port 9001.
1669578563: mosquitto version 2.0.11 running
1669578588: New connection from 127.0.0.1:57299 on port 1883.
1669578588: New client connected from 127.0.0.1:57299 as weewx_22830a3a (p2, 
c1, k60, u'alex').
1669578832: Client weewx_22830a3a closed its connection.
1669578840: New connection from 127.0.0.1:47195 on port 1883.
1669578840: New client connected from 127.0.0.1:47195 as weewx_8c5bf1f1 (p2, 
c1, k60, u'alex').
1669580662: Client weewx_8c5bf1f1 closed its connection.
1669580670: New connection from 127.0.0.1:34285 on port 1883.
1669580670: New client connected from 127.0.0.1:34285 as weewx_718908c6 (p2, 
c1, k60, u'alex').
1669581509: New connection from 192.168.0.189:51740 on port 1883.
1669581509: New client connected from 192.168.0.189:51740 as 
mqtt-explorer-a548b358 (p2, c1, k60).
1669581630: Client mqtt-explorer-a548b358 closed its connection.
1669581655: New connection from 192.168.0.189:51766 on port 1883.
1669581655: New client connected from 192.168.0.189:51766 as 
mqtt-explorer-a548b358 (p2, c1, k60).
1669581888: New connection from 127.0.0.1:44480 on port 1883.
1669581888: New client connected from 127.0.0.1:44480 as 
auto-003BE02E-DB76-FFF1-9BD6-31DAC5F2DF7F (p2, c1, k60, u'alex').
1669581888: Client auto-003BE02E-DB76-FFF1-9BD6-31DAC5F2DF7F disconnected.
1669581995: Client weewx_718908c6 closed its connection.
1669581998: New connection from 127.0.0.1:44021 on port 1883.
1669581998: New client connected from 127.0.0.1:44021 as weewx_cf6a1abf (p2, 
c1, k60, u'alex').
1669582333: Client weewx_cf6a1abf closed its connection.
1669582766: Client mqtt-explorer-a548b358 disconnected.
1669582785: New connection from 192.168.0.189:51886 on port 1883.
1669582785: New client connected from 192.168.0.189:51886 as 
mqtt-explorer-a548b358 (p2, c1, k60).
1669582815: New connection from 127.0.0.1:33183 on port 1883.
1669582815: New client connected from 127.0.0.1:33183 as weewx_a93509da (p2, 
c1, k60, u'alex').


alex@alex:~$ sudo certbot certonly -a webroot --webroot-path=/var/www/html -d 
ht                                                                              
                               tp://myhomeweewx.duckdns.org
Requested name http://myhomeweewx.duckdns.org appears to be a URL, not a FQDN. 
T                                                                               
                              ry again without the leading "http://";.
Ask for help or search for solutions at https://community.letsencrypt.org. See 
t                                                                               
                              he logfile /tmp/tmpajcjnjk1/log or re-run Certbot 
with -v for more details.
alex@alex:~$ sudo certbot certonly -a webroot --webroot-path=/var/www/html -d 
myhomeweewx.duckdns.org
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for myhomeweewx.duckdns.org

Certbot failed to authenticate some domains (authenticator: webroot). The 
Certificate Authority reported these problems:
  Domain: myhomeweewx.duckdns.org
  Type:   dns
  Detail: no valid A records found for myhomeweewx.duckdns.org; no valid AAAA 
records found for myhomeweewx.duckdns.org

Hint: The Certificate Authority failed to download the temporary challenge 
files created by Certbot. Ensure that the listed domains serve their content 
from the provided --webroot-path/-w and that files created there can be 
downloaded from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See 
the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for 
more details.
alex@alex:~$

Reply via email to