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

Support configuring/adding units and observations #118

Closed bellrichm closed 3 years ago

bellrichm commented 3 years ago

Since MQTT messages may have units and observations not in base WeeWX, it would be nice if these could be configured. For additional information see, https://groups.google.com/g/weewx-user/c/_ysq-eyjJrM/m/0EsYtkPdCwAJ

Possible configuration:

    [[weewx]]
        [[[units]]]
            [[[[cubic_foot_per_second]]]]
                unit_system = us
                group = group_flow
                format = '%.1f'
                label = u" ft³/s"
                [[[[[conversion]]]]]
                    cubic_meter_per_second = lambda x : x / 35.3147 
            [[[[cubic_meter_per_second]]]]
                unit_system = metric, metricwx
                group = group_flow
                format = '%.0f'
                label = u" m³/s"
                [[[[[conversion]]]]]
                    cubic_foot_per_second = lambda x : x * 35.3147 
            [[[[foot]]]]
                unit_system = us
                group = group_level
                [[[[[conversion]]]]]
                    cm = lambda x : x * 30.48
            [[[[cm]]]]
                unit_system = metric, metricwx
                group = group_level
                [[[[[conversion]]]]]
                    foot = lambda x : x / 30.48
        [[[observations]]]
            Q566055v = group_flow
            W566055v = group_level
            W566055a = group_count
            Q567470v = group_flow
            W567470v = group_level
            W567470a = group_count
roe-dl commented 3 years ago

I extended the observations by trend values. See attached file. roedl.py.txt

bellrichm commented 3 years ago

Thanks for the additional example. I know you don’t it, but I am just finishing up the code to configure this data.