trying to get live with bootstrap skin

184 views
Skip to first unread message

Δημήτρης Βήχος

unread,
Feb 2, 2025, 12:43:28 AM2/2/25
to weewx-user
allready installed mqtt extension , and sended email to skin author.

trying to get live updates with mqtt and bootstrap skin 


here my settings in weewx.conf , and skik conf reading the install authors file
weewx.conf
    [[MQTT]]
            server_url = broker.hivemq.com
            topic = weather
            binding = loop
            aggregation = aggregate

skin.conf

[JSONGenerator]
    enabled = true
    timespan = 27
    [[MQTT]]
        [[[connections]]]
            #[[[[public_mqtt]]]]
            #                broker_connection = wss://test.mosquitto.org:8081 # wss (encrypted) websocket connection
            #                [[[[[topics]]]]]
            #                      # JSON topics hold their value(s) in a JSON object. Every key can be matched to a gauge/chart dataset will work with weewx-mqtt, see: https://github.com/weewx/weewx/wiki/mqtt
            #                      [[[[[[weather/loop]]]]]]
            #                          type = JSON
            #                      [[[[[[weather/anothertopic]]]]]]
            #                          type = JSON
            #[[[[my_mqtt_with_public_tokens]]]]
            #    broker_connection = wss://mqtt.flespi.io:443 # wss (encrypted)
            #    mqtt_username = my_public_token # data is exposed to frontend! make sure you use data that is not confidential, like tokens with ACL
            #    mqtt_password = my_public_token # data is exposed to frontend! make sure you use data that is not confidential, like tokens with ACL
            #    [[[[[topics]]]]]
            #          # JSON topics hold their value(s) in a JSON object. Every key can be matched to a gauge/chart dataset will work with weewx-mqtt, see: https://github.com/weewx/weewx/wiki/mqtt
            #          [[[[[[weather/loop]]]]]]
            #              type = JSON
            #          [[[[[[weather/anothertopic]]]]]]
            #              type = JSON
            #Example
            [[[[hiveMQ_public]]]]
                broker_connection = ws://broker.hivemq.com:8000/mqtt # unencrypted websocket connection without credentials
            #    [[[[[topics]]]]]
            #         # topic with type plain has just the value as payload, you have to specify a payload_key to match a gauge/chart dataset
            #         [[[[[[example/sensor/temp]]]]]]
            #             type = plain
            #             payload_key = outTemp_C # matches gauge outTemp and outTemp dataset in outTemp chart
            #         [[[[[[example/sensor/humi]]]]]]
            #             type = plain
            #             payload_key = outHumidity # matches gauge outHumidity and outHumidity dataset in outHumidity chart
            #         [[[[[[example/sensor/dewpoint]]]]]]
            #             type = plain
            #             payload_key = dewpoint_C # matches no gauge below but dewpoint dataset in outTemp chart

and the log  after restarting

Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service weewx.restx.StdWOW
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Loading service weewx.restx.StdAWEKAS
Φεβ 02 07:37:55 rania weewxd[6588]: INFO weewx.restx: AWEKAS: Posting not enabled.
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service weewx.restx.StdAWEKAS
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Loading service user.wcloud.WeatherCloud
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.wcloud: service version is 0.13
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.wcloud: Data will be uploaded for id=52ae0148571b19b3
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service user.wcloud.WeatherCloud
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Loading service user.mqtt.MQTT
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.mqtt: service version is 0.24
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.mqtt: binding to loop
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.mqtt: data_binding is wx_binding
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.mqtt: topic is weather
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.mqtt: data will be uploaded to broker.hivemq.com
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service user.mqtt.MQTT
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Loading service weewx.engine.StdPrint
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service weewx.engine.StdPrint
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Loading service weewx.engine.StdReport
Φεβ 02 07:37:55 rania weewxd[6588]: INFO weewx.engine: 'pyephem' detected, extended almanac data is available
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service weewx.engine.StdReport
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Loading service user.rtgd.RealtimeGaugeData
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.rtgd: version is 0.6.7
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.manager: Daily summary version is 4.0
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.manager: Daily summary version is 4.0
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.manager: Daily summary version is 4.0
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.manager: Daily summary version is 4.0
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.rtgd: RealTimeGaugeData scroller text will use a fixed string
Φεβ 02 07:37:55 rania weewxd[6588]: INFO user.rtgd: '/var/www/html/weewx/gauge-data.txt' wil be generated. min_interval is None
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Finished loading service user.rtgd.RealtimeGaugeData
Φεβ 02 07:37:55 rania weewxd[6588]: INFO __main__: Starting up weewx version 5.1.0
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.engine: Station does not support reading the time
Φεβ 02 07:37:55 rania weewxd[6588]: INFO weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb'
Φεβ 02 07:37:55 rania weewxd[6588]: INFO weewx.manager: Starting backfill of daily summaries
Φεβ 02 07:37:55 rania weewxd[6588]: INFO weewx.manager: Daily summaries up to date
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.manager: Daily summary version is 4.0
Φεβ 02 07:37:55 rania weewxd[6588]: DEBUG weewx.manager: Daily summary version is 4.0
Φεβ 02 07:37:56 rania weewxd[6588]: DEBUG weewx.drivers.fousb: get 126 records since 2025-02-02 05:50:00
Φεβ 02 07:37:56 rania weewxd[6588]: INFO weewx.drivers.fousb: synchronising to the weather station (quality=0)
Φεβ 02 07:37:57 rania weewxd[6588]: DEBUG weewx.drivers.fousb: status {'rain_overflow': 0, 'lost_connection': 0, 'unknown': 0} (0)
Φεβ 02 07:38:47 rania weewxd[6588]: DEBUG weewx.drivers.fousb: new data
Φεβ 02 07:38:47 rania weewxd[6588]: DEBUG weewx.drivers.fousb: setting sensor clock 23.3218
Φεβ 02 07:38:47 rania weewxd[6588]: DEBUG weewx.drivers.fousb: live synchronised
Φεβ 02 07:38:47 rania weewxd[6588]: DEBUG weewx.drivers.fousb: packet timestamp is 05:38:47
Φεβ 02 07:38:47 rania weewxd[6588]: DEBUG weewx.drivers.fousb: estimated log time 05:19:17 +/- 30s (05:18:47..05:19:47)
Φεβ 02 07:39:32 rania weewxd[6588]: DEBUG weewx.drivers.fousb: avoid 5.914968967437744
Φεβ 02 07:39:38 rania weewxd[6588]: DEBUG weewx.drivers.fousb: new data
Φεβ 02 07:39:38 rania weewxd[6588]: DEBUG weewx.drivers.fousb: packet timestamp is 05:39:35
Φεβ 02 07:39:38 rania weewxd[6588]: DEBUG weewx.drivers.fousb: estimated log time 05:19:11 +/- 24s (05:18:47..05:19:35)
Φεβ 02 07:40:20 rania weewxd[6588]: DEBUG weewx.drivers.fousb: avoid 5.91399621963501
Φεβ 02 07:40:26 rania weewxd[6588]: DEBUG weewx.drivers.fousb: new data
Φεβ 02 07:40:26 rania weewxd[6588]: DEBUG weewx.drivers.fousb: packet timestamp is 05:40:23
Φεβ 02 07:40:26 rania weewxd[6588]: DEBUG weewx.drivers.fousb: estimated log time 05:19:05 +/- 18s (05:18:35..05:19:23)
Φεβ 02 07:41:08 rania weewxd[6588]: DEBUG weewx.drivers.fousb: avoid 5.920968770980835
Φεβ 02 07:41:14 rania weewxd[6588]: DEBUG weewx.drivers.fousb: new data
Φεβ 02 07:41:14 rania weewxd[6588]: DEBUG weewx.drivers.fousb: packet timestamp is 05:41:11
Φεβ 02 07:41:14 rania weewxd[6588]: DEBUG weewx.drivers.fousb: estimated log time 05:18:59 +/- 12s (05:18:23..05:19:11)
Φεβ 02 07:41:14 rania weewxd[6588]: DEBUG weewx.drivers.fousb: synchronised to 2025-02-02 05:18:59 for ptr 0x08d0
Φεβ 02 07:41:14 rania weewxd[6588]: DEBUG weewx.drivers.fousb: found 0 archive records
Φεβ 02 07:41:14 rania weewxd[6588]: INFO weewx.engine: Starting main packet loop.
Φεβ 02 07:41:14 rania weewxd[6588]: INFO weewx.drivers.fousb: station status {'rain_overflow': 0, 'lost_connection': 0, 'unknown': 0} (0)
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: MQTT: Unexpected exception of type <class 'ValueError'>
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: *** Traceback (most recent call last):
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***   File "/usr/share/weewx/weewx/restx.py", line 384, in run_loop
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***     self.process_record(_record, dbmanager)
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***   File "/etc/weewx/bin/user/mqtt.py", line 522, in process_record
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***     self.get_mqtt_client()
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***   File "/etc/weewx/bin/user/mqtt.py", line 453, in get_mqtt_client
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***     mc.connect(url.hostname, url.port)
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 912, in connect
Φεβ 02 07:41:14 rania weewxd[6588]: Exception in thread MQTT:
Φεβ 02 07:41:14 rania weewxd[6588]: Traceback (most recent call last):
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***     self.connect_async(host, port, keepalive,
Φεβ 02 07:41:14 rania weewxd[6588]:     self.run()
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/usr/share/weewx/weewx/restx.py", line 357, in run
Φεβ 02 07:41:14 rania weewxd[6588]:     self.run_loop(_manager)
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/usr/share/weewx/weewx/restx.py", line 384, in run_loop
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 978, in connect_async
Φεβ 02 07:41:14 rania weewxd[6588]:     self.process_record(_record, dbmanager)
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/etc/weewx/bin/user/mqtt.py", line 522, in process_record
Φεβ 02 07:41:14 rania weewxd[6588]:     self.get_mqtt_client()
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/etc/weewx/bin/user/mqtt.py", line 453, in get_mqtt_client
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: ***     raise ValueError('Invalid host.')
Φεβ 02 07:41:14 rania weewxd[6588]:     mc.connect(url.hostname, url.port)
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 912, in connect
Φεβ 02 07:41:14 rania weewxd[6588]:     self.connect_async(host, port, keepalive,
Φεβ 02 07:41:14 rania weewxd[6588]:   File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 978, in connect_async
Φεβ 02 07:41:14 rania weewxd[6588]:     raise ValueError('Invalid host.')
Φεβ 02 07:41:14 rania weewxd[6588]: ERROR weewx.restx: *** ValueError: Invalid host.
Φεβ 02 07:41:14 rania weewxd[6588]: ValueError: Invalid host.
Φεβ 02 07:41:14 rania weewxd[6588]: CRITICAL weewx.restx: MQTT: Thread terminating. Reason: Invalid host.
Φεβ 02 07:41:15 rania weewxd[6588]: DEBUG user.rtgd: Data may have been posted successfully. Response message was not received but a valid response code was received.


log tell me iivalid host but i was folow the readme file maybe something i do wrong.



michael.k...@gmx.at

unread,
Feb 2, 2025, 3:40:39 AM2/2/25
to weewx-user
Hi, i didn't receive an Email, I'm the author for the MQTT-relevant part for fuzzy-archer. Nick is not an active author for fuzzy-archer anymore. Anyway, the error messages are on the backend and are related to the MQTT extension and it's configuration, so MQTT-related challenges with the skin didn't even begin :D :D :D. Try 

[[MQTT]]
        server_url = mqtt://broker.hivemq.com:1883/

In weewx.conf
But be aware it's en unencrypted connnection.


Δημήτρης Βήχος

unread,
Feb 2, 2025, 5:41:55 AM2/2/25
to weewx-user
thank you for the fast response.
the skin is beatyfull .
after this change i see the log mqtt ulpoads every minute but i page its black gauges not apears

michael.k...@gmx.at

unread,
Feb 2, 2025, 6:38:12 AM2/2/25
to weewx-user
Your Browsers JS console reveals the problem:

Your are trying to load insecure content with content load over https:

Screenshot 2025-02-02 123232.png

According to https://www.hivemq.com/mqtt/public-mqtt-broker/ you should configure the broker connection for the skin to

broker_connection = wss://broker.hivemq.com:8884

Δημήτρης Βήχος

unread,
Feb 2, 2025, 11:46:26 AM2/2/25
to weewx-user
unfortunately again the page its the same

  [[MQTT]]
           server_url = "mqtt://broker.hivemq.com:8883"

            topic = weather
            binding = loop
            aggregation = aggregate

and skin conf

 [[[[hiveMQ_public]]]]

                broker_connection = wss://broker.hivemq.com:8884

trying without quotes in server url  but nothing.

michael.k...@gmx.at

unread,
Feb 2, 2025, 12:29:22 PM2/2/25
to weewx-user
You don't have at least one MQTT topic defined, that's why everything else fails (it shouldn't fail that hard, i'll fix that, but if configured correctly, it won't fail this way)

The missing config is highlighted in red below:

[StdReport]
    [[WhateverYouChoseForYourSkin]]
        [[[JSONGenerator]]]
            [[[[MQTT]]]]
                [[[[[connections]]]]]
                    [[[[[[my_mqtt_with_public_tokens]]]]]]
                        broker_connection = wss://myweatherstation.fr:9001 # wss (encrypted) websocket connection
                        mqtt_username = your_username
                        mqtt_password = your_password
                        [[[[[[[topics]]]]]]]  
                            [[[[[[[[weather/loop]]]]]]]]
                                type = JSON


Message has been deleted

michael.k...@gmx.at

unread,
Feb 2, 2025, 1:05:26 PM2/2/25
to weewx-user
I checked locally with hive mq public server and found the following should work:

For the MQTT extension:
    [[MQTT]]
        server_url = mqtt://broker.hivemq.com:1883
        topic = weather
        binding = loop
        aggregation = aggregate

For the skin:

[[[[MQTT]]]]
    [[[[[connections]]]]]
    [[[[[[my_mqtt_with_public_tokens]]]]]]
    broker_connection = wss://broker.hivemq.com:8884/mqtt
    [[[[[[[topics]]]]]]]
        [[[[[[[[weather/loop]]]]]]]]
            type = JSON

But! You shouldn't use the topic "weather" as your topic on the public server since it is very likely  someone else will interfere. Better try something that's likely to be unique, i.e. a UUID like his:

For the MQTT extension:
    [[MQTT]]
        server_url = mqtt://broker.hivemq.com:1883
        topic = weather_8463cb6f-9eef-4823-85ce-375bb5f4448f
        binding = loop
        aggregation = aggregate

For the skin:

[[[[MQTT]]]]
    [[[[[connections]]]]]
    [[[[[[my_mqtt_with_public_tokens]]]]]]
    broker_connection = wss://broker.hivemq.com:8884/mqtt
    [[[[[[[topics]]]]]]]
        [[[[[[[[weather_8463cb6f-9eef-4823-85ce-375bb5f4448f/loop]]]]]]]]
            type = JSON

michael.k...@gmx.at

unread,
Feb 2, 2025, 2:34:14 PM2/2/25
to weewx-user

I've just observed it doesn't work on your site, I don't know exactly what is misconfigured, but I suspect it's the number of [] brackets not right. The above examples have to be nested in the correct stanzas in weewx.conf. Don't do changes in skin.conf, always do customization in weewx.conf.

Δημήτρης Βήχος

unread,
Feb 2, 2025, 2:42:08 PM2/2/25
to weewx-user
finaly it works!!! thank you!! the wrong was in the number of the []  in skin conf

with this

[JSONGenerator]
    enabled = true
    timespan = 27
  [[MQTT]]
    [[[connections]]]
    [[[[my_mqtt_with_public_tokens]]]]
        broker_connection = wss://broker.hivemq.com:8884/mqtt
        [[[[[topics]]]]]
            [[[[[[weathermoudania/loop]]]]]]
                type = JSON
the skin is trully beatyfull and simple .

michael.k...@gmx.at

unread,
Feb 2, 2025, 2:56:42 PM2/2/25
to weewx-user

Please get yourself familiar how to make these configs in weewx.conf, and leave skin.conf unaltered. It will be such a p.i.t.a. when you update to the next release of the skin, if you don't.


For the MQTT part I'd recommend in weewx.conf:

[StdReport]
#(other stuff might be already there)
    [[Defaults]]
    
    #(and here also, but nested in this stanza put)
   
        [[[JSONGenerator]]]

            enabled = true
            timespan = 27
          [[[[MQTT]]]]
            [[[[[connections]]]]]
            [[[[[[my_mqtt_with_public_tokens]]]]]]
                broker_connection = wss://broker.hivemq.com:8884/mqtt
                [[[[[[[topics]]]]]]]
                    [[[[[[[[weathermoudania/loop]]]]]]]]
                        type = JSON 


Reply all
Reply to author
Forward
0 new messages