Hi Gary,
thanks a lot for your help. Everything works now as it should. I adopted 
the weewx.conf and the mqtt uploader formats the values as desired.
br.

Alex

gjr80 schrieb am Freitag, 30. August 2024 um 01:32:25 UTC+2:

> Alex, you have the correct uploader installed. Compare your current 
> installed extension list:
>
> pi@RPi-Weewx:/etc/weewx $ sudo weectl extension list
> Using configuration file /etc/weewx/weewx.conf
> Extension Name    Version   Description
> mqtt              0.24      Upload weather data to MQTT server.
>
> to your old list:
>
> weectl extension list
> Using configuration file /etc/weewx/weewx.conf
> Extension Name    Version   Description
> MQTT              0.2.0     Extension for uploading LOOP data to an MQTT 
> broker
>
> Matthew's uploader is at v0.24.
>
> As Vince said the uploader formatting works. The next thing to do is look 
> at your config. Unfortunately the uploader does not log the upload format 
> settings so you will need to provide that manually. I suggest you use weectl 
> debug <http://weewx.com/docs/5.1/utilities/weectl-debug/> to generate a 
> debug report and post that report. Check the report output carefully, weectl 
> debug should obfuscate sensitive information but it is not perfect.
>
> Gary
> On Friday 30 August 2024 at 07:17:14 UTC+10 [email protected] wrote:
>
>> Hi Gary,
>> I repeated the mqtt precedure and
>> ##########################
>> pi@RPi-Weewx:/etc/weewx $ sudo weectl extension list
>>
>> Using configuration file /etc/weewx/weewx.conf
>> Extension Name    Version   Description
>> mqtt              0.24      Upload weather data to MQTT server.
>> ##########################
>> That seems to be also not Matthew's version.
>> The log (see attachment) and a trace in the broker reveals, that my 
>> desired behavior is not fullfilled.
>> So I'm still unhappy.
>>
>> br.
>>
>> Alex
>>
>>
>>
>> gjr80 schrieb am Dienstag, 27. August 2024 um 06:23:03 UTC+2:
>>
>>> A bit of googling suggests that this:
>>>
>>> Extension Name    Version   Description
>>> MQTT              0.2.0     Extension for uploading LOOP data to an MQTT 
>>> broker
>>>
>>> refers to the extension in this repo: 
>>> https://github.com/michael-slx/weewx-mqtt. Looking through the code for 
>>> this extension it does not support formatting the MQTT output as you wish 
>>> to. I'm not sure what if any advantages the Michael-six uploader offers 
>>> over the matthewwall uploader.
>>>
>>> As for your re-installlation problem. You appear to be using a package 
>>> install of WeeWX v5. I know the instructions say to use pip to install 
>>> paho-mqtt, but I find when you are not using a virtual python 
>>> environment it is all to easy to end up with a non-functional install when 
>>> using pip to install some packages. Try using apt to install paho-mqtt:
>>> $ sudo apt update
>>> $ sudo apt-cache policy python3-paho-mqtt
>>>
>>> this should show what version of paho-mqtt will be installed, something 
>>> like:
>>> python3-paho-mqtt:
>>>   Installed: (none)
>>>   Candidate: 1.6.1-1
>>>   Version table:
>>>      1.6.1-1 500
>>>         500 http://deb.debian.org/debian bookworm/main arm64 Packages
>>>         500 http://deb.debian.org/debian bookworm/main armhf Packages
>>>
>>> Provided the candidate version is 1.6.1 or lower (ie it is not v2.x.y) 
>>> install paho-mqtt using:
>>> $ sudo apt install python3-paho-mqtt
>>>
>>> You should be able to complete the rest of the uploader install/setup. 
>>> If it does not work as expected edit weewx.conf, set debug = 2 and 
>>> restart WeeWX. Post a log extract showing the complete WeeWX startup and 
>>> the first few MQTT uploads. Also post the output from weectl debug as 
>>> per instructions in my earlier post.
>>>
>>> Whether you previously installed paho-mqtt using pip or apt makes no 
>>> difference to what WeeWX MQTT uploader was installed/used; somehow you 
>>> separately installed the Michael-six uploader rather than the matthewwall 
>>> uploader.
>>>
>>> Gary
>>> On Monday 26 August 2024 at 22:09:38 UTC+10 [email protected] wrote:
>>>
>>>> Hi Gary,
>>>>
>>>> I checked your hint regarding MQTT version:
>>>>
>>>> First time, I installed step by step the instruction of the mentioned 
>>>> link
>>>> a list in weewx control tells me:
>>>> weectl extension list
>>>> Using configuration file /etc/weewx/weewx.conf
>>>> Extension Name    Version   Description
>>>> MQTT              0.2.0     Extension for uploading LOOP data to an 
>>>> MQTT broker
>>>> So I checked the installed packages regarding mqtt:
>>>>  apt list | grep mqtt
>>>>
>>>> WARNING: apt does not have a stable CLI interface. Use with caution in 
>>>> scripts.
>>>>
>>>> golang-github-eclipse-paho.mqtt.golang-dev/stable 1.1.1-1.1 all
>>>> kamailio-mqtt-modules/stable 5.6.3-2+rpi1+b1 armhf
>>>> libmqtt-client-java/stable 1.16-1 all
>>>> libpaho-mqtt-dev/stable 1.3.12-1 armhf
>>>> libpaho-mqtt1.3/stable 1.3.12-1 armhf
>>>> libpaho-mqttpp-dev/stable 1.2.0-2 armhf
>>>> libpaho-mqttpp3-1/stable 1.2.0-2 armhf
>>>> node-mqtt-connection/stable 4.1.0-4 all
>>>> node-mqtt-packet/stable 8.1.2-2 all
>>>> node-mqtt/stable 4.3.7-2 all
>>>> paho.mqtt.c-examples/stable 1.3.12-1 armhf
>>>> prometheus-mqtt-exporter/stable 0.1.7-1 armhf
>>>> python3-asyncio-mqtt/stable 0.16.1-3 all
>>>> python3-hbmqtt/stable 0.9.6-1.2 all
>>>> python3-paho-mqtt/stable,now 1.6.1-1 all  [installiert]
>>>>
>>>> To repeat the install process, I removed MQTT in weewx and removed 
>>>> paho-mqtt in apt
>>>> Reinstall according the instruction:
>>>> wget -O weewx-mqtt.zip 
>>>> https://github.com/matthewwall/weewx-mqtt/archive/master.zip
>>>> sudo pip install paho-mqtt==1.6.1
>>>> error: externally-managed-environment
>>>>
>>>> × This environment is externally managed
>>>> ╰─> To install Python packages system-wide, try apt install
>>>>     python3-xyz, where xyz is the package you are trying to
>>>>     install.
>>>>
>>>>     If you wish to install a non-Debian-packaged Python package,
>>>>     create a virtual environment using python3 -m venv path/to/venv.
>>>>     Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
>>>>     sure you have python3-full installed.
>>>>
>>>>     For more information visit http://rptl.io/venv
>>>>
>>>> note: If you believe this is a mistake, please contact your Python 
>>>> installation or OS distribution provider. You can override this, at the 
>>>> risk of breaking your Python installation or OS, by passing 
>>>> --break-system-packages.
>>>> hint: See PEP 668 for the detailed specification.
>>>>
>>>> => This error occured also at primary installation, so I installed the 
>>>> paho-mqtt with apt.
>>>> Maybe thats the key, why weewx mapped to a complete other version of 
>>>> mqtt?
>>>> Finally the list in apt reveals also other mqtt 
>>>>
>>>> So, what to do?
>>>>
>>>> br
>>>>
>>>> Alex
>>>>
>>>> gjr80 schrieb am Montag, 26. August 2024 um 04:05:25 UTC+2:
>>>>
>>>>> So exactly what MQTT service are you using? Your initial post includes 
>>>>> the link https://github.com/weewx/weewx/wiki/mqtt (which in turn 
>>>>> links to Matthew's RESTful MQTT uploader) and the instructions on that 
>>>>> page 
>>>>> are specific to Matthew's uploader. The log extract just provided shows 
>>>>> user.mqtt.MqttService being loaded:
>>>>>
>>>>> 2024-08-25T19:43:39.786798+02:00 RPi-Weewx weewxd[3614]: DEBUG 
>>>>> weewx.engine: Loading service user.mqtt.MqttService
>>>>> 2024-08-25T19:43:39.862785+02:00 RPi-Weewx weewxd[3614]: DEBUG 
>>>>> user.mqtt: Initializing MQTT service
>>>>> 2024-08-25T19:43:39.863826+02:00 RPi-Weewx weewxd[3614]: DEBUG 
>>>>> user.mqtt: Creating MQTT client with id "weewx_21680fb1"
>>>>> 2024-08-25T19:43:39.881839+02:00 RPi-Weewx weewxd[3614]: DEBUG 
>>>>> user.mqtt: Starting MQTT client
>>>>> 2024-08-25T19:43:39.882861+02:00 RPi-Weewx weewxd[3614]: DEBUG 
>>>>> weewx.engine: Finished loading service user.mqtt.MqttService
>>>>>
>>>>>  but Matthew's uploader has no class named MqttService (it has class 
>>>>> MQTT). So it is clear you are not using Matthew's MQTT uploader.
>>>>>
>>>>> You might want to look up the instructions for use for whatever MQTT 
>>>>> service you are using, or post details of the MQTT service you are using 
>>>>> and we will see what we can work out.
>>>>>
>>>>> Gary
>>>>>
>>>>> On Monday 26 August 2024 at 04:05:46 UTC+10 [email protected] wrote:
>>>>>
>>>>>> Hi Gary,
>>>>>>
>>>>>> I took an exploit from syslog with debug-level 2, see attachment.
>>>>>> As I mentioned, the observation data for wind, gust and outtemp are 
>>>>>> still transmitted unformated, I also realiezed that rain values ( 
>>>>>> "weather/rain_mm": 0.0 (mm)" ) have always zero values although the 
>>>>>> website 
>>>>>> tells me the correct rain of today  = 2.6 mm, also the rain_hour value 
>>>>>> isn't okay with mqtt.
>>>>>>
>>>>>> br.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>> gjr80 schrieb am Dienstag, 20. August 2024 um 22:29:48 UTC+2:
>>>>>>
>>>>>>> I suggest you edit weewx.conf, set debug = 2, save weewx.conf and 
>>>>>>> restart WeeWX. Let WeeWX run for at least two archive periods then take 
>>>>>>> a 
>>>>>>> log extract showing the full WeeWX startup through until the two 
>>>>>>> archive 
>>>>>>> periods have elapsed. Post the unaltered log extract here. Also 
>>>>>>> worthwhile 
>>>>>>> posting the output of weectl debug 
>>>>>>> <http://weewx.com/docs/5.1/utilities/weectl-debug/> (or wee_debug 
>>>>>>> <http://weewx.com/docs/4.10/utilities.htm#wee_debug_utility> if 
>>>>>>> using WeeWX v4 or earlier). Check the output for sensitive data (eg 
>>>>>>> passwords, user names, keys etc) before posting, weectl debug 
>>>>>>> should obfuscate these but it is not perfect. 
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>> On Tuesday 20 August 2024 at 22:19:55 UTC+10 [email protected] wrote:
>>>>>>>
>>>>>>>> Hi Gary,
>>>>>>>> thanks for your advice. After the modification of weewx.conf mqtt 
>>>>>>>> data is still delivered (so tha's positive), but no change in the 
>>>>>>>> number of 
>>>>>>>> decimal places.
>>>>>>>> My config:
>>>>>>>> #########################
>>>>>>>>  [[MQTT]]
>>>>>>>>
>>>>>>>>        enable = true
>>>>>>>>         unit_system = METRICWX
>>>>>>>>         # Hostname/IP of MQTT broker
>>>>>>>>         host = 192.168.2.22
>>>>>>>>         topic = weather
>>>>>>>> #        append_units_label = false
>>>>>>>>
>>>>>>>>         [[[inputs]]]
>>>>>>>>             [[[[outTemp]]]]
>>>>>>>>                 format = %.2f                # use two decimal 
>>>>>>>> places of precision
>>>>>>>>                 name = outside_temperature    # use label other 
>>>>>>>> than inTemp
>>>>>>>>             [[[[windSpeed]]]]
>>>>>>>>                 units = meter_per_second
>>>>>>>>                 format = %.1f
>>>>>>>>                 name = windSpeed_m_s
>>>>>>>>             [[[[windGust]]]]
>>>>>>>>                 units = meter_per_second
>>>>>>>>                 format = %.1f
>>>>>>>>                 name = gust_m_s
>>>>>>>> ###########################
>>>>>>>>
>>>>>>>> and the result in the broker:
>>>>>>>> ###########################
>>>>>>>> weather/inTemp_degree_C 27.29999999999999
>>>>>>>> weather/inHumidity_percent 67
>>>>>>>> weather/outTemp_degree_C 24.700000000000003
>>>>>>>> weather/outHumidity_percent 64
>>>>>>>> weather/pressure_mbar 1012.8
>>>>>>>> weather/windSpeed_meter_per_second 0.40000099419637863
>>>>>>>> weather/windGust_meter_per_second 0.6000014912945679
>>>>>>>> weather/windDir_degree_compass 112.5
>>>>>>>> weather/windGustDir_degree_compass 112.5
>>>>>>>> weather/rainRate_mm_per_hour 0.0
>>>>>>>> weather/rain_mm (null)
>>>>>>>> weather/rxCheckPercent_percent 100
>>>>>>>> weather/windBatteryStatus 0
>>>>>>>> weather/rainBatteryStatus 0
>>>>>>>> weather/outTempBatteryStatus 0
>>>>>>>> weather/inTempBatteryStatus 0
>>>>>>>> weather/altimeter_mbar 1056.8811153752754
>>>>>>>> weather/appTemp_degree_C 26.97221024879724
>>>>>>>> weather/barometer_mbar 1055.5080297221955
>>>>>>>> weather/cloudbase_meter 1267.4829583543142
>>>>>>>> weather/dewpoint_degree_C 17.422122081623723
>>>>>>>> weather/ET_mm (null)
>>>>>>>> weather/heatindex_degree_C 24.89666666666667
>>>>>>>> weather/humidex_degree_C 30.293088441750406
>>>>>>>> weather/inDewpoint_degree_C 20.621737268345424
>>>>>>>> weather/maxSolarRad_watt_per_meter_squared 813.5477625196611
>>>>>>>> weather/windchill_degree_C 24.700000000000003
>>>>>>>> weather/windrun_km (null)
>>>>>>>> weather/usUnits 17
>>>>>>>> ###########################
>>>>>>>>
>>>>>>>> Something goes wrong, but I've no idea
>>>>>>>>
>>>>>>>> br
>>>>>>>>
>>>>>>>> Alex
>>>>>>>>
>>>>>>>> gjr80 schrieb am Dienstag, 20. August 2024 um 11:02:39 UTC+2:
>>>>>>>>
>>>>>>>>> Your config stanza format is incorrect; you cannot just insert 
>>>>>>>>> sub-stanzas in the middle of an existing stanza, the sub-stanzas need 
>>>>>>>>> to be 
>>>>>>>>> added to the end. In the case of a WeeWX config file indents don't 
>>>>>>>>> matter 
>>>>>>>>> but order does. Try something like:
>>>>>>>>>
>>>>>>>>>  [[MQTT]]        # Enable/disable this service
>>>>>>>>>         enable = true
>>>>>>>>>         unit_system = METRICWX
>>>>>>>>>         # Hostname/IP of MQTT broker
>>>>>>>>>         host = 192.168.2.22
>>>>>>>>>         topic = weather
>>>>>>>>>         [[[inputs]]]
>>>>>>>>>             [[[[outTemp]]]]
>>>>>>>>>                 format = %.2f                # use two decimal 
>>>>>>>>> places of precision
>>>>>>>>>                 name = outside_temperature    # use label other 
>>>>>>>>> than inTemp
>>>>>>>>>             [[[[windSpeed]]]]
>>>>>>>>>                 units = meter_per_second
>>>>>>>>>                 format = %.2f
>>>>>>>>>                 name = wind_m_s
>>>>>>>>>
>>>>>>>>> The order you had meant the MQTT uploader was never seeing the 
>>>>>>>>> host and topic config entries.
>>>>>>>>>
>>>>>>>>> If that doesn't work post a log extract showing the error.
>>>>>>>>>
>>>>>>>>> Gary
>>>>>>>>> On Tuesday 20 August 2024 at 06:40:46 UTC+10 [email protected] wrote:
>>>>>>>>>
>>>>>>>>>> With this config, the weather values are puplished, but (i guess) 
>>>>>>>>>> due to convert from US (within db) to Metricwx with up to 16 decimal 
>>>>>>>>>> places. 
>>>>>>>>>> ###############
>>>>>>>>>>  [[MQTT]]        # Enable/disable this service
>>>>>>>>>>         enable = true
>>>>>>>>>>         unit_system = METRICWX
>>>>>>>>>>         # Hostname/IP of MQTT broker
>>>>>>>>>>         host = 192.168.2.22
>>>>>>>>>>         # Prefix for topics
>>>>>>>>>>         topic = weather
>>>>>>>>>> #################
>>>>>>>>>> I took one exemple from https://github.com/weewx/weewx/wiki/mqtt 
>>>>>>>>>> to reduce the
>>>>>>>>>> decimal places of the published values, but with this config, 
>>>>>>>>>> mqtt stops working.
>>>>>>>>>> #################
>>>>>>>>>>  [[MQTT]]        # Enable/disable this service
>>>>>>>>>>         enable = true
>>>>>>>>>>         unit_system = METRICWX
>>>>>>>>>>         [[[inputs]]]
>>>>>>>>>>             [[[[outTemp]]]]
>>>>>>>>>>                 format = %.2f                # use two decimal 
>>>>>>>>>> places of precision
>>>>>>>>>>                 name = outside_temperature    # use label other 
>>>>>>>>>> than inTemp
>>>>>>>>>>             [[[[windSpeed]]]]
>>>>>>>>>>                 units = meter_per_second
>>>>>>>>>>                 format = %.2f
>>>>>>>>>>                 name = wind_m_s
>>>>>>>>>>
>>>>>>>>>>         # Hostname/IP of MQTT broker
>>>>>>>>>>         host = 192.168.2.22
>>>>>>>>>>         topic = weather 
>>>>>>>>>> #################
>>>>>>>>>>
>>>>>>>>>> What could be wrong in the configuration?
>>>>>>>>>> My aim ist to limit all published values to a max. of 2 digits 
>>>>>>>>>> behind the dot
>>>>>>>>>> e. g. instead 
>>>>>>>>>> weather/windSpeed_meter_per_second 0.40000099419637863
>>>>>>>>>> is should be:
>>>>>>>>>> weather/windSpeed_meter_per_second 0.4
>>>>>>>>>>
>>>>>>>>>> br
>>>>>>>>>> Alex
>>>>>>>>>>
>>>>>>>>>

-- 
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/36e1e9c7-3f24-4f61-ab24-c233a0203c74n%40googlegroups.com.

Reply via email to