bellrichm / WeeWX-MQTTSubscribe

A WeeWX service and driver that receives data from MQTT.
GNU General Public License v3.0
52 stars 13 forks source link

Help needed in configuring JSON #144

Closed willew closed 2 years ago

willew commented 2 years ago

Ubuntu: 20.04.3 WeeWx version: 4.5.1 WeeWX-MQTTSubscribe version: 2.0.0 Telldus weather station connected using rtl_433

I am succesfully receiving JSON formatted messages from the weather station using topic home/rtl_433 , here is one example message

{"time" : "2021-12-25 20:17:09", "model" : "Telldus-FT0385R", "temperature_C" : -8.500, "humidity" : 88, "temperature_2_C" : 22.111, "humidity_2" : 34, "pressure_hPa" : 979.200, "rain_mm" : 162.000, "wind_dir_deg" : 281, "wind_avg_m_s" : 0.100, "wind_max_m_s" : 0.700, "mic" : "CRC"}

weexwx.conf is as follows:

[MQTTSubscribeService]
    enable = false
    host = localhost
    port = 1883
    keepalive = 60
    username = None
    password = None
    binding = loop
    logging_level = TRACE
    logging_filename = /tmp/mqtt.log

    [[message_callback]]
        type = json

    [[topics]]
        unit_system = METRICWX

        [[[home/rtl_433]]]
            [[[[time]]]]
                ignore = true
            [[[[model]]]]
                ingore = true
            [[[[temperature_C]]]]
                name = outTemp
            [[[[humidity]]]]
                name = outHumidity
            [[[[temperature_2_C]]]]
                name = inTemp
            [[[[humidity_2]]]]
                name = inHumidity
            [[[[pressure_hPa]]]]
                name = barometer
            [[[[rain_mm]]]]
                name = rain
            [[[[wind_dir_deg]]]]
                name = windDir
            [[[[wind_avg_m_s]]]]
                name = wind
            [[[[wind_max_m_s]]]]
                name = windGust
            [[[[mic]]]]
                ingore = true

Processing of a message fails and stops when the system tries to convert the timestamp to float, although it has been set to be ignored. The logfiles attached. I have also tried to set conversion_error_to_none = true for the time field, but no help.

What am I doing wrong?

mqttsubscribe.log weewx.log

bellrichm commented 2 years ago

Hi, From the log it looks like you are running MQTTSubscribe as a driver, but the configuration snippit ([MQTTSubscribeService]) is for when running as a service. You also have the service disabled (enable = false). What do you have under [MQTTSubscribeDriver]?

willew commented 2 years ago

What do you have under [MQTTSubscribeDriver] Thanks, this was the problem. The driver section was untouched. I was searching for the config from the end of the file and found the subscribe section. No wonder the type setting had no effect on the behaviour.