Outputting Max and min daily temperatures over MQTT

99 views
Skip to first unread message

Tim Shepherd

unread,
Feb 8, 2023, 11:15:42 AM2/8/23
to weewx-user
Hi,

Is there any way to add parameters to those output via mqtt ?
I would like to record the Max and Min daily temperatures to Home assistant but they are not available.

The parameters highOutTemp_C and lowOutTemp_c are output but these are some sort of statistical variation on the current temperature not the daily max/min , and hence not what I want.

Thanks

Karen K

unread,
Feb 8, 2023, 3:10:39 PM2/8/23
to weewx-user
https://github.com/roe-dl/weewx-mqtt/tree/aggregate_values
https://github.com/matthewwall/weewx-mqtt/pull/33

Unfortunately, Matthew Wall does not like the approach. But you can download this branch of the MQTT extension and add an [[[augmentations]]] section to your configuration like this:

    [[MQTT]]

        ...

        [[[augmentations]]]

            dayRain = day.rain.sum

            maxTemp = day.outTemp.max

            minTemp = week.outTemp.min

            avgTemp = month.outTemp.avg




Warren Gill

unread,
Feb 8, 2023, 6:16:16 PM2/8/23
to weewx...@googlegroups.com
You can create a weewx template that outputs the statistics as a JSON file, then setup a REST sensor in your homeassistant config. You can set the scan interval to update more or less frequently. For me this seems more efficient than putting them in MQTT (which I also do with loop packets).

My weewx template, weather.json.tmpl looks like:

{  "stationInfo" :
    {
    "stationType" : "$station.hardware",
    "stationCity" : "Austin",
    "stationState" : "TX",
    "stationElevation" : "$station.altitude",
    "stationLatitude" : "$station.latitude[0] $station.latitude[1]' $station.latitude[2]",
    "stationLongitude" : "$station.longitude[0] $station.longitude[1]' $station.longitude[2]"
    },
  "highs" :
   {
    "temperature" : "$day.outTemp.max.format(add_label=False)",
    "temperature_time" : "$day.outTemp.maxtime.raw",
        "humidity" : "$day.outHumidity.max.format(add_label=False)",
    "humidity_time" : "$day.outHumidity.maxtime.raw",
    "dewpoint" : "$day.dewpoint.max.format(add_label=False)",
    "dewpoint_time" : "$day.dewpoint.maxtime.raw",
    "windspeed" : "$day.wind.max.format(add_label=False)",
    "windspeed_time" : "$day.wind.maxtime.raw",
    "barometer" : "$day.barometer.max.format(add_label=False)",
    "barometer_time" : "$day.barometer.maxtime.raw",
    "rain_rate" : "$day.rainRate.max.format(add_label=False)",
    "rain_rate_time" : "$day.rainRate.maxtime.raw",
    "heat_index" : "$day.heatindex.max.format(add_label=False)",
    "heat_index_time" : "$day.heatindex.maxtime.raw"
  },
"lows" :
        {
    "temperature" : "$day.outTemp.min.format(add_label=False)",
        "temperature_time" : "$day.outTemp.mintime.raw",
        "humidity" : "$day.outHumidity.min.format(add_label=False)",
    "humidity_time" : "$day.outHumidity.mintime.raw",
    "dewpoint" : "$day.dewpoint.min.format(add_label=False)",
    "dewpoint_time" : "$day.dewpoint.mintime.raw",
    "barometer" : "$day.barometer.min.format(add_label=False)",
    "barometer_time" : "$day.barometer.mintime.raw",
    "wind_chill" : "$day.windchill.min.format(add_label=False)",
    "wind_chill_time" : "$day.windchill.mintime.raw"
    }
}

Then I put in to HA, in packages/weather.yaml:

# Example configuration.yaml entry
rest:
  - resource: http://weather.local/weather.json
    method: GET
    scan_interval: 600
    sensor:
      - name: "Weather station information"
        json_attributes_path: "$.stationInfo"
        value_template: "OK"
        json_attributes:
          - "stationType"
          - "stationCity"
          - "stationState"
          - "stationElevation"
          - "stationLatitude"
          - "stationLongitude"
      - name: "Weather highs today"
        json_attributes_path: "$.highs"
        value_template: "OK"
        json_attributes:
          - "temperature"
          - "temperature_time"
          - "humidity"
          - "humidity_time"
          - "dewpoint"
          - "dewpoint_time"
          - "windspeed"
          - "windspeed_time"
          - "barometer"
          - "barometer_time"
          - "rain_rate_"
          - "rain_rate_time"
          - "heat_index"
          - "heat_index_time"
      - name: "Weather lows today"
        json_attributes_path: "$.lows"
        value_template: "OK"
        json_attributes:
          - "temperature"
          - "temperature_time"
          - "humidity"
          - "humidity_time"
          - "dewpoint"
          - "dewpoint_time"
          - "windspeed"
          - "windspeed_time"
          - "barometer"
          - "barometer_time"
          - "rain_rate_"
          - "rain_rate_time"
          - "heat_index"
          - "heat_index_time"




--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/b07932dd-4219-4a19-a678-ab74b1504a76n%40googlegroups.com.

Tim Shepherd

unread,
Feb 11, 2023, 6:28:40 AM2/11/23
to weewx-user
Thank you both for your comprehensive replies and ideas .
I will have a go and see what happens

Reply all
Reply to author
Forward
0 new messages