Hi,

it doesnt work with localhost. Think, you start your Browser localy so your 
Loca Browser try to mqqt to localhost. And there is no mwtt server.

>From My weewx config (the MQTT part). Think i configured my mqtt and 
Webssite with https.

##################weewx.conf#################
[[MQTT]]
        server_url = mqtt://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

[[Belchertown]]

        [[[Extras]]]


            #--- MQTT Websockets (for Real Time Streaming) Options ---
            mqtt_websockets_enabled = 1
            mqtt_websockets_host = gw.martenhinrichs.de
            mqtt_websockets_port = 9001
            mqtt_websockets_ssl = 1
            mqtt_websockets_topic = weather/loop





#########mosquitto.conf################
allow_anonymous true
password_file /etc/mosquitto/passwd
acl_file /etc/mosquitto/acl
persistence false

# mqtt
listener 1883 
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






Stefan Gliessmann schrieb am Montag, 24. Juli 2023 um 13:51:16 UTC+2:

> Thank you all for providing input / sharing your configurations.
> I made the suggested changes and more, but still belchertown displays 
> Connected. Waiting for data ...
> I have attached all configs / logs / checks I could think of below.
>
> Thanks again for your input in advance!
> Stefan
>
>
> These are my current configs:
>
> *mosquitto*:
> */etc/mosquitto/acl:*
> # Allow anonymous access to the sys
> topic read $SYS/#
>
> # Allow anonymous to read weather
> topic read weather/#
>
> # weewx readwrite to the loop
> user teffi
>
> */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
>
> */etc/mosquitto/conf.d/myconfig.conf *
> persistence false
>
> allow_anonymous true
> password_file /etc/mosquitto/passwd
>
> acl_file /etc/mosquitto/acl
>
> # mqtt
> listener 1883
> protocol mqtt
>
> # websockets
> listener 9001
> protocol websockets
>
> */etc/mosquitto/acl*
> # Allow anonymous access to the sys
> topic read $SYS/#
>
> # Allow anonymous to read weather
> topic read weather/#
>
> # weewx readwrite to the loop
> user teffi
> topic weather/#
>
> *MQTT in WeeWX:*
> [StdRESTful]
>     [[MQTT]]
>
>         # Enable/disable this service
>         enable = true
>
>         # Hostname/IP of MQTT broker
>         host = 192.168.178.190
>         server_url = mqtt://teffi:********@localhost:1883/
>
>
>         # Credentials
>         user = teffi
>         password = ********
>
>         # Prefix for topics
>
>         topic = weather
>         unit_system = METRIC
>         binding = archive,loop
>         aggregation = aggregate
>
> *checking if WeeWX serves mosquitto with info:*
> *mosquitto_sub -h 192.168.178.190 -t weather/#*
> online
> online
> 1690198935
> 24.6
> 23.9
> 53
> 54
> 993.7
> 993.7
> 11377.0
> 8.9
> 0
> 0.0
> 0.0
> 0.0
> 0.0
> 0.3
> 1.46
> 1.46
> 294
> 6.480016105981334
> 9.360023264195261
> 7.1
> 0
> 4
> 89.7947908445146
> 997.3266279778212
> 23.910163208269463
> 997.1205287280834
> 1262.3292207924262
> 14.015863559854884
> 23.75555555555555
> 27.2746765106266
> 14.37423758808152
> 859.4544718145543
> 23.9
> 16
>
> *Belchertown skin receiving MQTT topic /weather/#*
> [StdReport]
>     [[Belchertown]]
>         skin = Belchertown
>         HTML_ROOT = /var/www/html/weewx/belchertown
>         enable = true
>
>         [[[Extras]]]
>             #--- MQTT Websockets (for Real Time Streaming) Options ---
>             #log_failure = True 
>             mqtt_websockets_enabled = 1
>             mqtt_websockets_host = 192.168.178.190
>             mqtt_websockets_port = 9001
>             mqtt_websockets_ssl = 0
>             mqtt_websockets_topic = weather/loop
>             mqtt_websockets_username = teffi
>             mqtt_websockets_password = ********
>             disconnect_live_website_visitor = 1800000
>
> *Checking if it works in webpage:*
> *http://localhost/weewx/belchertown/ <http://localhost/weewx/belchertown/>* 
> or weewxhi.de
>
> Connected. Waiting for data. Last Updated July 24, 2023, 1:20:00 PM
>
> The webpage never receives data.
>
>
> *mosquitto.log shows connections:*
> *sudo more /var/log/mosquitto/mosquitto.log *
>
> 1690197817: mosquitto version 2.0.11 starting
> 1690197817: Config loaded from /etc/mosquitto/mosquitto.conf.
> 1690197817: Opening ipv4 listen socket on port 1883.
> 1690197817: Opening ipv6 listen socket on port 1883.
> 1690197817: Opening websockets listen socket on port 9001.
> 1690197817: mosquitto version 2.0.11 running
> 1690197822: New connection from 192.168.178.190:36367 on port 1883.
> 1690197822: New client connected from 192.168.178.190:36367 as 
> weewx_e353ae0d (p2, c1, k60, u'teffi').
> 1690197840: New client connected from ::ffff:192.168.178.190:59900 as 
> website819759641 (p2, c1, k60, u'teffi').
> 1690197884: Client website819759641 closed its connection.
> 1690197884: Client <unknown> closed its connection.
> 1690197886: New client connected from ::ffff:192.168.178.190:52896 as 
> website398593267 (p2, c1, k60, u'teffi').
> 1690198918: New connection from 192.168.178.190:36078 on port 1883.
> 1690198918: New client connected from 192.168.178.190:36078 as 
> auto-C1ABF6AD-7B82-CBED-2BB0-5DECA756C1BA (p2, c1, k60).
> 1690198939: Client auto-C1ABF6AD-7B82-CBED-2BB0-5DECA756C1BA disconnected.
> 1690199057: New client connected from ::ffff:192.168.178.64:57281 as 
> website924402803 (p2, c1, k60, u'teffi').
> On Sunday, July 23, 2023 at 4:01:07 PM UTC+2 Claudio wrote:
>
>> this is my config, 
>> no ssl / read user = all
>>
>> Belchertown skin.conf
>>
>>
>>  # MQTT Websockets defaults
>>
>>     mqtt_websockets_enabled = 1
>>
>>     mqtt_websockets_host = public IP (no local IP)
>>
>>     mqtt_websockets_port = 9001
>>
>>     mqtt_websockets_ssl = 0
>>
>>     mqtt_websockets_topic = weather/loop
>>
>>     mqtt_websockets_username = ""
>>
>>     mqtt_websockets_password = ""
>>
>>     disconnect_live_website_visitor = 1800000
>>
>> weewx weewx.conf
>>
>> [[MQTT]]
>>
>>
>>         server_url = mqtt://user:password@localhost:1883/
>>
>>         topic = weather
>>
>>         unit_system = METRIC
>>
>>         binding = archive, loop
>>
>>         aggregation = aggregate
>>
>>
>>
>> work on www.pnmeteo.it
>>
>>
>> try.....
>> ciao
>>
>> Il giorno venerdì 21 luglio 2023 alle 15:32:01 UTC+2 Stefan Gliessmann ha 
>> scritto:
>>
>>> I am struggling to understand why the Belchertown skin is not receiving 
>>> weather data even though it is connected to the MQTT broker and user.mqtt 
>>> is publishing weather data.
>>>
>>> TIA,
>>> Stefan
>>>
>>> Here is what I have configured in /etc/weewx/weewx.conf:
>>>
>>> [StdRESTful]
>>>
>>>     [[MQTT]]
>>>
>>>         # Enable/disable this service
>>>         enable = true
>>>
>>>         # Hostname/IP of MQTT broker
>>>         host = 192.168.178.190
>>>         server_url = mqtt://teffi:++++...@192.168.178.190:1883/ 
>>> <http://teffi:++++++++@192.168.178.190:1883/>
>>>
>>>         # Credentials
>>>         user = teffi
>>>         password = ++++++++
>>>
>>>         # Prefix for topics
>>>         topic = weather/weewx
>>>         unit_system = METRIC
>>>         binding = archive,loop
>>>         aggregation = aggregate
>>>         [[[inputs]]]
>>>             [[[[rainRate]]]]
>>>                 units = mm_per_hour
>>>             [[[[rain]]]]
>>>                 units = mm
>>>             [[[[hourRain]]]]
>>>                 units = mm
>>>             [[[[rain24]]]]
>>>                 units = mm
>>>             [[[[dayRain]]]]
>>>                 units = mm
>>>             [[[[ET]]]]
>>>                 units = mm
>>>             [[[[dayET]]]]
>>>                 units = mm
>>>             [[[[ET24]]]]
>>>                 units = mm
>>>
>>> [StdReport]
>>>     [[Belchertown]]
>>>         skin = Belchertown
>>>         HTML_ROOT = /var/www/html/weewx/belchertown
>>>         enable = true
>>>
>>>         [[[Extras]]]
>>>             #--- MQTT Websockets (for Real Time Streaming) Options ---
>>>             log_failure = True
>>>             mqtt_websockets_enabled = 1
>>>             mqtt_websockets_host = 192.168.178.190
>>>             mqtt_websockets_port = 9001
>>> #            mqtt_websockets_ssl = 0
>>>             mqtt_websockets_topic = weather/weewx
>>>             # disconnect_live_website_visitor = 1800000
>>>
>>> and in /var/log/syslog I can see:
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/dateTime_unix_epoch": 1689946202 (unix_epoch)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/inTemp_degree_C": 23.299999999999997 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/outTemp_degree_C": 19.099999999999998 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/inHumidity_percent": 51 (percent)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/outHumidity_percent": 61 (percent)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/pressure_mbar": 1001.4 (mbar)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/relbarometer": 1001.4 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/luminosity": 29620.0 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/uvradiation": 67.8 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/UV_uv_index": 2 (uv_index)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/rain_cm": 0.0 (cm)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/stormRain_cm": 0.0 (cm)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/rainRate_cm_per_hour": 0.0 (cm_per_hour)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/dayRain_cm": 0.0 (cm)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/weekRain": 11.7 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/monthRain_cm": 1.4300000000000004 (cm)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/yearRain_cm": 1.4300000000000004 (cm)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/windDir_degree_compass": 186 (degree_compass)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/windSpeed_km_per_hour": 0.0 (km_per_hour)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/windGust_km_per_hour": 0.0 (km_per_hour)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/daymaxwind": 8.7 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/wh65_batt": 0 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/wh65_sig": 4 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/radiation_watt_per_meter_squared": 233.78058405682714 
>>> (watt_per_meter_squared)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/altimeter_mbar": 1005.049695199262 (mbar)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/appTemp_degree_C": 19.53993189168407 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/barometer_mbar": 1004.9037478077688 (mbar)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/cloudbase_meter": 990.2965356401945 (meter)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/dewpoint_degree_C": 11.397525104151388 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/heatindex_degree_C": 18.658333333333328 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/humidex_degree_C": 21.0515585775138 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/inDewpoint_degree_C": 12.585023979027035 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/maxSolarRad_watt_per_meter_squared": 763.710094175752 
>>> (watt_per_meter_squared)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/windchill_degree_C": 19.099999999999998 (degree_C)
>>> Jul 21 15:30:02 weewx weewx[37286] DEBUG user.mqtt: Publishing 
>>> "weather/weewx/usUnits": 16 (None)
>>> Jul 21 15:30:02 weewx weewx[37286] INFO weewx.restx: MQTT: Published 
>>> record 2023-07-21 15:30:02 CEST (1689946202)
>>>
>>

-- 
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/ee7b160b-3320-423f-879f-9b223916af32n%40googlegroups.com.

Reply via email to