WeeWX, MQTT and how to import Data

Please read this topic, especially point 11 regarding the correct formatting of code in the forum.

You can use a value_template to round your value.

Try this:

sensor:
  - platform: mqtt
    name: “OutTemperature1”
    state_topic: “weather/outTemp_C”
    unit_of_measurement: ‘°C’
    value_template: "{{ (value | round(2)) | float }}"

I’m not sure if the last float filter is needed, you can probably remove it, can’t test at the moment.

2 Likes

Thank you @Burningstone for help and hints regarding correct formatting.
and no problem, i´ll play around and will inform if this thing works.

works like a charme.
thp-display

i had to adapt the quotation marks and reduced to 1 decimal, now this is working fine:

sensor:
    - platform: mqtt
      name: "OutTemperature_101"
      state_topic: "weather/outTemp_C"
      unit_of_measurement: '°C'
      value_template: "{{ (value | round(1)) | float }}"

Thx for helping a silversurfer :wink:

Posting a complete list of weewx entities here to make it easier for others.
Enjoy!

Beware: Apprarently there were some changes with WeeWX 5.0:

Config for weewx 4.8:

mqtt:
  sensor:
    - name: weather_station_outtemp_c
      unique_id: uniqueid__weather_outtemp_c
      icon: mdi:thermometer
      state_topic: "weather/outTemp_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_intemp_c
      unique_id: uniqueid__weather_intemp_c
      icon: mdi:thermometer
      state_topic: "weather/inTemp_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_dewpoint_c
      unique_id: uniqueid__weather_dewpoint_c
      icon: mdi:thermometer
      state_topic: "weather/dewpoint_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_indewpoint_c
      unique_id: uniqueid__weather_indewpoint_c
      icon: mdi:thermometer
      state_topic: "weather/inDewpoint_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_windchill_c
      unique_id: uniqueid__weather_windchill_c
      icon: mdi:thermometer
      state_topic: "weather/windchill_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_apptemp_c
      unique_id: uniqueid__weather_apptemp_c
      icon: mdi:thermometer
      state_topic: "weather/appTemp_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_heatindex_c
      unique_id: uniqueid__weather_geatindex_c
      icon: mdi:thermometer
      state_topic: "weather/heatindex_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_humidex_c
      unique_id: uniqueid__weather_humindex_c
      icon: mdi:thermometer
      state_topic: "weather/humidex_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°C"
      device_class: temperature

    #############################################################################

    - name: weather_station_outhumidity
      unique_id: uniqueid__weather_outhumidity
      icon: mdi:water-percent
      state_topic: "weather/outHumidity"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "%"
      device_class: humidity

    - name: weather_station_inhumidity
      unique_id: uniqueid__weather_inhumidity
      icon: mdi:water-percent
      state_topic: "weather/inHumidity"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "%"
      device_class: humidity

    - name: weather_station_altimeter_mbar
      unique_id: uniqueid__weather_altimeter_atmospheric
      icon: mdi:gauge
      state_topic: "weather/altimeter_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    - name: weather_station_pressure_mbar
      unique_id: uniqueid__weather_pressure_atmospheric
      icon: mdi:gauge
      state_topic: "weather/pressure_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    - name: weather_station_barometer_mbar
      unique_id: uniqueid__weather_barometer_atmospheric
      icon: mdi:gauge
      state_topic: "weather/barometer_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    #############################################################################
    - name: weather_station_windspeed_kph
      unique_id: uniqueid__weather_windspeed_kph
      icon: mdi:weather-windy
      state_topic: "weather/windSpeed_kph"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "km/h"
      device_class: wind_speed

    - name: weather_station_windgust_kph
      unique_id: uniqueid__weather_windgust_kph
      icon: mdi:weather-windy-variant
      state_topic: "weather/windGust_kph"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "km/h"
      device_class: wind_speed

    - name: weather_station_winddir
      unique_id: uniqueid__weather_winddir
      icon: mdi:wind-turbine
      state_topic: "weather/windDir"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°"

    - name: weather_station_windgustdir
      unique_id: uniqueid__weather_windgustdir
      icon: mdi:wind-turbine
      state_topic: "weather/windGustDir"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "°"

    - name: weather_station_windrun_km
      unique_id: uniqueid__weather_windrun_km
      icon: mdi:wind-turbine
      state_topic: "weather/windrun_km"
      value_template: "{{ value | round(3) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "km"
      device_class: distance

    - name: weather_station_rainrate_mm_per_hour
      unique_id: uniqueid__weather_rainrate_mm_per_hour
      icon: mdi:umbrella-outline
      state_topic: "weather/rainRate_cm_per_hour"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mm/h"
      device_class: precipitation_intensity

    - name: weather_station_rain_mm
      unique_id: uniqueid__weather_rain_mm
      icon: mdi:umbrella
      state_topic: "weather/rain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mm"
      device_class: precipitation
      force_update: true # important!

    - name: weather_station_rain24_mm
      unique_id: uniqueid__weather_rain24_mm
      icon: mdi:umbrella
      state_topic: "weather/rain24_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mm"
      device_class: precipitation

    - name: weather_station_hourrain_mm
      unique_id: uniqueid__weather_hourrain_mm
      icon: mdi:umbrella
      state_topic: "weather/hourRain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mm"
      device_class: precipitation

    - name: weather_station_dayrain_mm
      unique_id: uniqueid__weather_dayrain_mm
      icon: mdi:umbrella
      state_topic: "weather/dayRain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mm"
      device_class: precipitation

    - name: weather_station_evapotranspiration_mm
      unique_id: uniqueid__evapotranspiration_mm
      icon: mdi:water-opacity
      state_topic: "weather/ET_cm"
      value_template: "{{ (value | float * 10) | round(5) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "mm"
      device_class: precipitation
      force_update: true # important!

    #############################################################################

    - name: weather_station_radiation_wpm2
      unique_id: uniqueid__weather_radiation_irradiance
      icon: mdi:radioactive
      state_topic: "weather/radiation_Wpm2"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "W/m²"
      device_class: irradiance

    - name: weather_station_maxsolarrad_wpm2
      unique_id: uniqueid__weather_maxsolarrad_irradiance
      icon: mdi:radioactive
      state_topic: "weather/maxSolarRad_Wpm2"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "W/m²"
      device_class: irradiance

    - name: weather_station_cloudbase_meter
      unique_id: uniqueid__weather_cloudbase_distance
      state_topic: "weather/cloudbase_meter"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: "m"
      device_class: distance

    - name: weather_station_uv
      unique_id: uniqueid__weather_uv
      icon: mdi:sunglasses
      state_topic: "weather/UV"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/availability"
      unit_of_measurement: ""

    #############################################################################

    - name: weather_station_weewx_update_datetime
      unique_id: uniqueid__weather_datetime
      icon: mdi:calendar-clock
      state_topic: "weather/dateTime"
      value_template: "{{ value | int | timestamp_local() }}"
      availability_topic: "weather/availability"
      device_class: timestamp

template:
  - binary_sensor:
      - name: weather_station_weewx_connected
        unique_id: uniqueid__weather_connected
        icon: mdi:calendar-sync-outline
        state: >
          {%- set seconds = (now() - states.sensor.weather_station_weewx_update_datetime.last_changed).total_seconds() -%}
          {{ seconds < 120 }}
        availability: >
          {{ has_value('sensor.weather_station_weewx_update_datetime') }}
        device_class: connectivity

  #############################################################################

homeassistant:
  customize:
    sensor.weather_station_outtemp_c:
      friendly_name: "Ventus W830 Temperatur"
    sensor.weather_station_intemp_c:
      friendly_name: "Ventus W830 Temperatur (innen)"
    sensor.weather_station_dewpoint_c:
      friendly_name: "Ventus W830 Taupunkt"
    sensor.weather_station_indewpoint_c:
      friendly_name: "Ventus W830 Taupunkt (innen)"
    sensor.weather_station_windchill_c:
      friendly_name: "Ventus W830 Windkühle"
    sensor.weather_station_apptemp_c:
      friendly_name: "Ventus W830 gefühlte Temperatur"
    sensor.weather_station_heatindex_c:
      friendly_name: "Ventus W830 Hitzeindex"
    sensor.weather_station_humidex_c:
      friendly_name: "Ventus W830 Luftfeuchte-Index"
    sensor.weather_station_outhumidity:
      friendly_name: "Ventus W830 Luftfeuchte"
    sensor.weather_station_inhumidity:
      friendly_name: "Ventus W830 Luftfeuchte (innen)"
    sensor.weather_station_altimeter_mbar:
      friendly_name: "Ventus W830 Luftdruck (Altimeter, QNH)"
    sensor.weather_station_pressure_mbar:
      friendly_name: "Ventus W830 Luftdruck (Absolut, QFE)"
    sensor.weather_station_barometer_mbar:
      friendly_name: "Ventus W830 Luftdruck (Meeresspiegel, Temperatur, QFF)"
    sensor.weather_station_windspeed_kph:
      friendly_name: "Ventus W830 Windgeschwindigkeit"
    sensor.weather_station_windgust_kph:
      friendly_name: "Ventus W830 Böengeschwindigkeit"
    sensor.weather_station_winddir:
      friendly_name: "Ventus W830 Windrichtung"
    sensor.weather_station_windgustdir:
      friendly_name: "Ventus W830 Böenrichtung"
    sensor.weather_station_windrun_km:
      friendly_name: "Ventus W830 Windlauf"
    sensor.weather_station_rainrate_mm_per_hour:
      friendly_name: "Ventus W830 Regenrate"
    sensor.weather_station_rain_mm:
      friendly_name: "Ventus W830 Regen"
    sensor.weather_station_rain24_mm:
      friendly_name: "Ventus W830 Regen (24h)"
    sensor.weather_station_hourrain_mm:
      friendly_name: "Ventus W830 Regen (Stunde)"
    sensor.weather_station_dayrain_mm:
      friendly_name: "Ventus W830 Regen (Tag)"
    sensor.weather_station_evapotranspiration_mm:
      friendly_name: "Ventus W830 EvapoTranspiration (ET)"
    sensor.weather_station_radiation_wpm2:
      friendly_name: "Ventus W830 Sonnenstrahlung"
    sensor.weather_station_maxsolarrad_wpm2:
      friendly_name: "Ventus W830 Sonnenstrahlung Maximum"
    sensor.weather_station_cloudbase_meter:
      friendly_name: "Ventus W830 Wolkenuntergrenze"
    sensor.weather_station_uv:
      friendly_name: "Ventus W830 UV-Index"
    sensor.weather_station_weewx_update_datetime:
      friendly_name: "Ventus W830 Letzte Aktualisierung"
    binary_sensor.weather_station_weewx_connected:
      friendly_name: "Ventus W830 Regelmäßige Aktualisierungen"
1 Like

Hello all
I am trying to bring this example into the MQTT format for version 2022.12.0.
Unfortunately I have absolutely no idea how and all attempts to bring the upper into a mqtt.yaml fail.

I hope you can help me with this as I don’t really understand the new format.

Many thanks in advance
Guido

Hey, was confused as you are talking about changes in 2022.12. I believe these changes came some releases ago BUT the old format was deprecated with 2022.12.

Anyhow, it’s not that complicated of a change. I’ve just updated my post above with the working weewx.yaml configuration. Hope it works for you as well!

Hello ThomDietrich

Thanks for the change

I was able to save the file mqtt.yaml successfully with your information.
However, I still get an error message.
I have this entry in configuration.yaml:

mqtt: !include mqtt.yaml

and I get the following error message:

Invalid config for [mqtt]: [mqtt] is an invalid option for [mqtt]. Check: mqtt->mqtt->mqtt. (See /config/configuration.yaml, line 10)

Do I have to make another entry in configuration.yaml?

You need to learn about packages. I always felt that the concept and a base configuration should be part of the default configuration! Anyhow, please read here: Packages - Home Assistant

  1. In your configuration.yaml add:
    homeassistant:
      packages: !include_dir_named packages
    
  2. Create the folder packages
  3. Create and fill packages/weewx.yaml with the content above.

In parallel you can create all kinds of yaml files, for topics. Here is a random example I found via google: home-assistant-config/packages at master · aneisch/home-assistant-config · GitHub

Thank you for your help with my problem.
Everything is now working as it should.

I wish you all a merry and healthy christmas.
Guido

Hello,

Is it possible to send the MQTT section of your weewx.conf file ?
I have problems with reading the values ?

Grtz

hi, this is the section in the weewx.conf

[[MQTT]]
    server_url = mqtt://username:[email protected]:1883
    topic = weather
    unit_system = METRIC
    retain = True

username & password have to be defined in the config of the mosquitto broker @homeassistant in the config tab. hope it helps.

greez

Have Problems to receive data of my weewx station.

i installed the addon in weewx and add this to my config:

    [[MQTT]]
        server_url = mqtt://mqtt_user:[email protected]:1883
        topic = weather
        unit_system = METRIC

i also added this to my configuration.yaml in HA.

#-------------------------------------------------------------
# Weatherstation WEEWX-MQTT
#-------------------------------------------------------------
mqtt:
  sensor:
    - state_topic: "weather/outTemp_C"
      name: "Outdoor Temperature"
      unit_of_measurement: "C"
      device_class: "temperature"
      value_template: "{{ value | round(1) }}"
      icon: "mdi:thermometer"
    - state_topic: "weather/windSpeed_kmh"
      name: "Wind Speed"
      unit_of_measurement: "kmh"
      value_template: "{{ value | round(1) }}"
      icon: "mdi:weather-windy-variant"
    - state_topic: "weather/windGust_kmh"
      name: "Wind Gust"
      unit_of_measurement: "kmh"
      value_template: "{{ value | round(1) }}"
      icon: "mdi:weather-windy"

in the LOG of the Mosquitto Broker i see only

...
023-08-18 07:25:43: New connection from 192.168.1.215:36185 on port 1883.
2023-08-18 07:25:43: New client connected from 192.168.1.215:36185 as weewx_e7f53078 (p2, c1, k60, u'mqtt_user').
2023-08-18 07:26:45: New connection from 172.30.32.2:54454 on port 1883
....

Log in weewx looks ok…

....
Aug 18 08:36:42 raspberrypi weewx[874] INFO user.mqtt: data will be uploaded to mqtt://mqtt_user:[email protected]:1883
...
...
Aug 18 08:40:37 raspberrypi weewx[874] INFO user.mqtt: client established for mqtt://mqtt_user:[email protected]:1883
Aug 18 08:40:37 raspberrypi weewx[874] INFO weewx.restx: MQTT: Published record 2023-08-18 08:40:00 CEST (1692340800)
...

@noxx - try

    - name: My Temperature
      state_topic: "weather/loop"
      unit_of_measurement: '°C'
      value_template: '{{ value_json.outTemp_C | round(1) }}'

Hello @noxx,

First thing that immediately catches my eye: in MQTT Explorer we can see windSpeed_kph but you are trying to subscribe to windSpeed_kmh in HA. Please check your definitions.

It looks like the names have changed again, possibly due to the WeeWX 5.x update. Or at least ThomDietrich’s very useful config doesn’t work any more with the current version. Here’s a partial list of what currently works, if it’s useful I’ll post the full thing.

mqtt:
  sensor:
    # Temperature

    - name: weather_station_outtemp_c
      unique_id: uniqueid__weather_outtemp_c
      icon: mdi:thermometer
      state_topic: "weather/outTemp_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_intemp_c
      unique_id: uniqueid__weather_intemp_c
      icon: mdi:thermometer
      state_topic: "weather/inTemp_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_dewpoint_c
      unique_id: uniqueid__weather_dewpoint_c
      icon: mdi:thermometer
      state_topic: "weather/dewpoint_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_indewpoint_c
      unique_id: uniqueid__weather_indewpoint_c
      icon: mdi:thermometer
      state_topic: "weather/inDewpoint_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_windchill_c
      unique_id: uniqueid__weather_windchill_c
      icon: mdi:thermometer
      state_topic: "weather/windchill_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_apptemp_c
      unique_id: uniqueid__weather_apptemp_c
      icon: mdi:thermometer
      state_topic: "weather/appTemp_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_heatindex_c
      unique_id: uniqueid__weather_geatindex_c
      icon: mdi:thermometer
      state_topic: "weather/heatindex_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_humidex_c
      unique_id: uniqueid__weather_humindex_c
      icon: mdi:thermometer
      # Note spelling mistake in the topic.
      state_topic: "weather/humidex_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Humidity

    - name: weather_station_outhumidity
      unique_id: uniqueid__weather_outhumidity
      icon: mdi:water-percent
      state_topic: "weather/outHumidity_percent"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "%"
      device_class: humidity

    ##
    - name: weather_station_inhumidity
      unique_id: uniqueid__weather_inhumidity
      icon: mdi:water-percent
      state_topic: "weather/inHumidity_percent"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "%"
      device_class: humidity

    - name: weather_station_altimeter_mbar
      unique_id: uniqueid__weather_altimeter_atmospheric
      icon: mdi:gauge
      state_topic: "weather/altimeter_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    - name: weather_station_pressure_mbar
      unique_id: uniqueid__weather_pressure_atmospheric
      icon: mdi:gauge
      state_topic: "weather/pressure_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    - name: weather_station_barometer_mbar
      unique_id: uniqueid__weather_barometer_atmospheric
      icon: mdi:gauge
      state_topic: "weather/barometer_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

[...]

One caveat is that some of those entries aren’t available for all station types, so you may need to add or remove pieces depending on what you’ve got available.

Hey Dave, thanks for this! I am still on v4.8 and seems like I should update eventually. I will update my config above as soon as I tested it. Will link yours in the meantime.

In that case here’s the full config for anyone who might find it useful. Note that I’ve commented out some entries that my setup doesn’t have, and also added some new ones for various soil sensor readings.

There’s also a few where WeeWX provides the data but it’s not coming through via MQTT, e.g. wind direction and wind gust, I need to play with that, probably by setting the retained flag on the messages if that’s where the problem lies.

Another note, for the WeeWX integration I’m using Michael Schantl’s WeeWX-MQTT, so this may also depend on which WeeWX extension you’re using to get the data into mosquitto.

# To see what the WeeWX MQTT topics are called:
#
# mosquitto_sub -v -t "weather/#" -h localhost

mqtt:
  sensor:
    # Temperature

    - name: weather_station_outtemp_c
      unique_id: uniqueid__weather_outtemp_c
      icon: mdi:thermometer
      state_topic: "weather/outTemp_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Not terribly useful because the reading is affected by heat from the
    # electronics.
    - name: weather_station_intemp_c
      unique_id: uniqueid__weather_intemp_c
      icon: mdi:thermometer
      state_topic: "weather/inTemp_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_dewpoint_c
      unique_id: uniqueid__weather_dewpoint_c
      icon: mdi:thermometer
      state_topic: "weather/dewpoint_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Not present on this station
    #- name: weather_station_indewpoint_c
    #  unique_id: uniqueid__weather_indewpoint_c
    #  icon: mdi:thermometer
    #  state_topic: "weather/inDewpoint_degree_C"
    #  value_template: "{{ value | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "°C"
    #  device_class: temperature

    - name: weather_station_windchill_c
      unique_id: uniqueid__weather_windchill_c
      icon: mdi:thermometer
      state_topic: "weather/windchill_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Not present on this station
    #- name: weather_station_apptemp_c
    #  unique_id: uniqueid__weather_apptemp_c
    #  icon: mdi:thermometer
    #  state_topic: "weather/appTemp_degree_C"
    #  value_template: "{{ value | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "°C"
    #  device_class: temperature

    - name: weather_station_heatindex_c
      unique_id: uniqueid__weather_geatindex_c
      icon: mdi:thermometer
      state_topic: "weather/heatindex_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Not present on this station
    #- name: weather_station_humidex_c
    #  unique_id: uniqueid__weather_humindex_c
    #  icon: mdi:thermometer
    #  # Note spelling mistake in the topic.
    #  state_topic: "weather/humidex_degree_C"
    #  value_template: "{{ value | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "°C"
    #  device_class: temperature

    # Humidity

    - name: weather_station_outhumidity
      unique_id: uniqueid__weather_outhumidity
      icon: mdi:water-percent
      state_topic: "weather/outHumidity_percent"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "%"
      device_class: humidity

    # Not present on this station
    #- name: weather_station_inhumidity
    #  unique_id: uniqueid__weather_inhumidity
    #  icon: mdi:water-percent
    #  state_topic: "weather/inHumidity_percent"
    #  value_template: "{{ value | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "%"
    #  device_class: humidity

    # Present but gives same readings as atmospheric pressue
    #- name: weather_station_altimeter_mbar
    #  unique_id: uniqueid__weather_altimeter_atmospheric
    #  icon: mdi:gauge
    #  state_topic: "weather/altimeter_mbar"
    #  value_template: "{{ value | round(0) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mbar"
    #  device_class: atmospheric_pressure

    - name: weather_station_pressure_mbar
      unique_id: uniqueid__weather_pressure_atmospheric
      icon: mdi:gauge
      state_topic: "weather/pressure_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    - name: weather_station_barometer_mbar
      unique_id: uniqueid__weather_barometer_atmospheric
      icon: mdi:gauge
      state_topic: "weather/barometer_mbar"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    # Wind

    - name: weather_station_windspeed_kph
      unique_id: uniqueid__weather_windspeed_kph
      icon: mdi:weather-windy
      state_topic: "weather/windSpeed_km_per_hour"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "km/h"
      device_class: wind_speed

    - name: weather_station_windgust_kph
      unique_id: uniqueid__weather_windgust_kph
      icon: mdi:weather-windy-variant
      state_topic: "weather/windGust_km_per_hour"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "km/h"
      device_class: wind_speed

    - name: weather_station_winddir
      unique_id: uniqueid__weather_winddir
      icon: mdi:wind-turbine
      state_topic: "weather/windDir_degree_compass"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°"

    # Not present on this station
    #- name: weather_station_windgustdir
    #  unique_id: uniqueid__weather_windgustdir
    #  icon: mdi:wind-turbine
    #  state_topic: "weather/windGustDir"
    #  value_template: "{{ value | round(0) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "°"

    # Not present on this station
    #- name: weather_station_windrun_km
    #  unique_id: uniqueid__weather_windrun_km
    #  icon: mdi:wind-turbine
    #  state_topic: "weather/windrun_km"
    #  value_template: "{{ value | round(3) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "km"
    #  device_class: distance

    - name: weather_station_rainrate_cm_per_hour
      unique_id: uniqueid__weather_rainrate_cm_per_hour
      icon: mdi:umbrella-outline
      state_topic: "weather/rainRate_cm_per_hour"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "cm/h"
      device_class: precipitation_intensity

    - name: weather_station_rain_cm
      unique_id: uniqueid__weather_rain_cm
      icon: mdi:umbrella
      state_topic: "weather/rain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "cm"
      device_class: precipitation
      force_update: true # important!

    # Not present on this station
    #- name: weather_station_rain24_mm
    #  unique_id: uniqueid__weather_rain24_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/rain24_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    # Not present on this station
    #- name: weather_station_hourrain_mm
    #  unique_id: uniqueid__weather_hourrain_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/hourRain_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    # Not present on this station
    #- name: weather_station_dayrain_mm
    #  unique_id: uniqueid__weather_dayrain_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/dayRain_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    # Not present on this station
    #- name: weather_station_weekrain_mm
    #  unique_id: uniqueid__weather_weekrain_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/weekRain_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    # Not present on this station
    #- name: weather_station_monthrain_mm
    #  unique_id: uniqueid__weather_monthrain_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/monthRain_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    - name: weather_station_evapotranspiration_mm
      unique_id: uniqueid__evapotranspiration_mm
      icon: mdi:water-opacity
      state_topic: "weather/ET_cm"
      value_template: "{{ (value | float * 10) | round(5) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "mm"
      device_class: precipitation
      force_update: true # important!

    # Solar

    - name: weather_station_radiation_wpm2
      unique_id: uniqueid__weather_radiation_irradiance
      icon: mdi:radioactive
      state_topic: "weather/radiation_watt_per_meter_squared"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "W/m²"
      device_class: irradiance

    - name: weather_station_maxsolarrad_wpm2
      unique_id: uniqueid__weather_maxsolarrad_irradiance
      icon: mdi:radioactive
      state_topic: "weather/maxSolarRad_watt_per_meter_squared"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "W/m²"
      device_class: irradiance

    - name: weather_station_cloudbase_meter
      unique_id: uniqueid__weather_cloudbase_distance
      state_topic: "weather/cloudbase_meter"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "m"
      device_class: distance

    - name: weather_station_uv
      unique_id: uniqueid__weather_uv
      icon: mdi:sunglasses
      state_topic: "weather/UV_uv_index"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: ""

    # Soil

    - name: weather_station_soiltemp1_c
      unique_id: uniqueid__weather_soiltemp1_c
      icon: mdi:thermometer
      state_topic: "weather/soilTemp1_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_soilMoist1_centibar
      unique_id: uniqueid__soilMoist1_centibar
      icon: mdi:water-opacity
      state_topic: "weather/soilMoist1_centibar"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "cbar"
      device_class: precipitation

    - name: weather_station_leafWet1_count
      unique_id: uniqueid__leafWet1_count
      icon: mdi:water-opacity
      state_topic: "weather/leafWet1_count"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: ""
      device_class: precipitation

    - name: weather_station_soiltemp2_c
      unique_id: uniqueid__weather_soiltemp2_c
      icon: mdi:thermometer
      state_topic: "weather/soilTemp2_degree_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_soilMoist2_centibar
      unique_id: uniqueid__soilMoist2_centibar
      icon: mdi:water-opacity
      state_topic: "weather/soilMoist2_centibar"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: "cbar"
      device_class: precipitation

    - name: weather_station_leafWet2_count
      unique_id: uniqueid__leafWet2_count
      icon: mdi:water-opacity
      state_topic: "weather/leafWet2_count"
      value_template: "{{ value | round(0) }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      unit_of_measurement: ""
      device_class: precipitation

    # Misc

    - name: weather_station_weewx_update_datetime
      unique_id: uniqueid__weather_datetime
      icon: mdi:calendar-clock
      state_topic: "weather/dateTime_unix_epoch"
      value_template: "{{ value | int | timestamp_local() }}"
      availability_topic: "weather/connection_status"
      payload_available: "online"
      payload_not_available: "offline"
      device_class: timestamp

template:
  - binary_sensor:
      - name: weather_station_weewx_connected
        unique_id: uniqueid__weather_connected
        icon: mdi:calendar-sync-outline
        state: >
          {%- set seconds = (now() - states.sensor.weather_station_weewx_update_datetime.last_changed).total_seconds() -%}
          {{ seconds < 120 }}
        availability: >
          {{ has_value('sensor.weather_station_weewx_update_datetime') }}
        device_class: connectivity

I just noticed, from a comment on Matthew Wall’s WeeWX-MQTT, that you may be using that instead of Michael Schantl’s one. So the naming difference may be due to the different code base… both of them are a bit of a headache, they were written for now out-of-date versions of WeeWX and paho-mqtt and it looks like neither are taking updates. I went with the MS version rather than the MW version because it was easier to get going with WeeWX 5.x and HA, but it doesn’t seem to honour the persistence flag, possibly because the version of paho-mqtt it’s using is too old to support it.

In the interests of sacrifice for the communal good :upside_down_face: I’ve uninstalled the MS WeeWX-MQTT and instead installed the MW WeeWX-MQTT, which exposes the missing topics. So you need a different HA YAML config depending on whether you use the MS WeeWX-MQTT or the MW WeeWX-MQTT.

For those just joining us, there are two things called WeeWX-MQTT, one by Michael Schantl (MS), one by Matthew Wall (MW). Both date from about the same time and haven’t been updated for awhile, which means they’re tied to old versions of the paho-mqtt library so you’ll need to pip install paho-mqtt==$old_version, as well as change the install command from wee_extension --install to weectl extension install for WeeWX 5.x.

In terms of which one to go with, MW-WeeWX-MQTT is slightly more configurable than MS-WeeWX-MQTT, as well as exposing a few more topics (actually synthetic topics like rainfall in the last 24 hours). For that one the paho-mqtt version needed is 1.6.1, so pip install paho-mqtt==1.6.1.

Here’s the final updated config, currently set up for MW WeeWX-MQTT but with comments indicating what to change for MS WeeWX-MQTT, there are also comments for other sensors/topics that have special considerations. This also includes soil/leaf sensors if you have those.

Tested to work with WeeWX 5.x up to the latest release, 5.1.0, with credit to @ThomDietrich whose work this is based on.

# To see what the WeeWX MQTT topics are called:
#
# mosquitto_sub -v -t "weather/#" -h localhost
#
# Michael Schantl's WeeWX-MQTT provides "weather/connection_status" but
# Matthew Wall's WeeWX-MQTT doesn't, or at least its status is always
# reported as "offline" so the availability check is commented out for
# this version.

mqtt:
  sensor:
    # Temperature

    # MW also makes this available as outTemp_C
    - name: weather_station_outtemp_c
      unique_id: uniqueid__weather_outtemp_c
      icon: mdi:thermometer
      state_topic: "weather/outTemp_degree_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # MW has inTemp_C, MS has inTemp_degree_C.
    # Not terribly useful because the reading is affected by heat from the
    # electronics.
    - name: weather_station_intemp_c
      unique_id: uniqueid__weather_intemp_c
      icon: mdi:thermometer
      state_topic: "weather/inTemp_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_dewpoint_c
      unique_id: uniqueid__weather_dewpoint_c
      icon: mdi:thermometer
      state_topic: "weather/dewpoint_degree_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Not present on this station
    #- name: weather_station_indewpoint_c
    #  unique_id: uniqueid__weather_indewpoint_c
    #  icon: mdi:thermometer
    #  state_topic: "weather/inDewpoint_degree_C"
    #  value_template: "{{ value | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "°C"
    #  device_class: temperature

    # MW also makes this available as windchill_C.
    - name: weather_station_windchill_c
      unique_id: uniqueid__weather_windchill_c
      icon: mdi:thermometer
      state_topic: "weather/windchill_degree_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Present in MW, not present in MS.
    - name: weather_station_apptemp_c
      unique_id: uniqueid__weather_apptemp_c
      icon: mdi:thermometer
      state_topic: "weather/appTemp_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_heatindex_c
      unique_id: uniqueid__weather_geatindex_c
      icon: mdi:thermometer
      state_topic: "weather/heatindex_degree_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Present in MW, not present in MS.
    - name: weather_station_humidex_c
      unique_id: uniqueid__weather_humindex_c
      icon: mdi:thermometer
      # Note spelling mistake in the topic.
      state_topic: "weather/humidex_degree_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    # Humidity

    # MW also makes this available as outHumidity.
    - name: weather_station_outhumidity
      unique_id: uniqueid__weather_outhumidity
      icon: mdi:water-percent
      state_topic: "weather/outHumidity_percent"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "%"
      device_class: humidity

    # Not present on this station
    #- name: weather_station_inhumidity
    #  unique_id: uniqueid__weather_inhumidity
    #  icon: mdi:water-percent
    #  state_topic: "weather/inHumidity_percent"
    #  value_template: "{{ value | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "%"
    #  device_class: humidity

    # Present but gives same readings as atmospheric pressue
    #- name: weather_station_altimeter_mbar
    #  unique_id: uniqueid__weather_altimeter_atmospheric
    #  icon: mdi:gauge
    #  state_topic: "weather/altimeter_mbar"
    #  value_template: "{{ value | round(0) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mbar"
    #  device_class: atmospheric_pressure

    - name: weather_station_pressure_mbar
      unique_id: uniqueid__weather_pressure_atmospheric
      icon: mdi:gauge
      state_topic: "weather/pressure_mbar"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    - name: weather_station_barometer_mbar
      unique_id: uniqueid__weather_barometer_atmospheric
      icon: mdi:gauge
      state_topic: "weather/barometer_mbar"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "mbar"
      device_class: atmospheric_pressure

    # Wind

    # MW also makes this available as windSpeed_kph.
    - name: weather_station_windspeed_kph
      unique_id: uniqueid__weather_windspeed_kph
      icon: mdi:weather-windy
      state_topic: "weather/windSpeed_km_per_hour"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "km/h"
      device_class: wind_speed

    - name: weather_station_windgust_kph
      unique_id: uniqueid__weather_windgust_kph
      icon: mdi:weather-windy-variant
      # windGust_kph in MW, windGust_km_per_hour in MS
      # state_topic: "weather/windGust_km_per_hour"
      state_topic: "weather/windGust_kph"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "km/h"
      device_class: wind_speed

    - name: weather_station_winddir
      unique_id: uniqueid__weather_winddir
      icon: mdi:wind-turbine
      state_topic: "weather/windDir_degree_compass"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°"

    # Present in MW, not present in MS.
    - name: weather_station_windgustdir
      unique_id: uniqueid__weather_windgustdir
      icon: mdi:wind-turbine
      state_topic: "weather/windGustDir"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°"

    # Present in MW, not present in MS.
    - name: weather_station_windrun_km
      unique_id: uniqueid__weather_windrun_km
      icon: mdi:wind-turbine
      state_topic: "weather/windrun_km"
      value_template: "{{ value | round(3) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "km"
      device_class: distance

    - name: weather_station_rainrate_cm_per_hour
      unique_id: uniqueid__weather_rainrate_cm_per_hour
      icon: mdi:umbrella-outline
      state_topic: "weather/rainRate_cm_per_hour"
      value_template: "{{ (value | float * 10) | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "cm/h"
      device_class: precipitation_intensity

    - name: weather_station_rain_cm
      unique_id: uniqueid__weather_rain_cm
      icon: mdi:umbrella
      state_topic: "weather/rain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "cm"
      device_class: precipitation
      force_update: true # important!

    # Present in MW, not present in MS.
    - name: weather_station_rain24_mm
      unique_id: uniqueid__weather_rain24_mm
      icon: mdi:umbrella
      state_topic: "weather/rain24_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "mm"
      device_class: precipitation

    # Present in MW, not present in MS.
    - name: weather_station_hourrain_mm
      unique_id: uniqueid__weather_hourrain_mm
      icon: mdi:umbrella
      state_topic: "weather/hourRain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "mm"
      device_class: precipitation

    # Present in MW, not present in MS.
    - name: weather_station_dayrain_mm
      unique_id: uniqueid__weather_dayrain_mm
      icon: mdi:umbrella
      state_topic: "weather/dayRain_cm"
      value_template: "{{ (value | float * 10) | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "mm"
      device_class: precipitation

    # Not present on this station
    #- name: weather_station_weekrain_mm
    #  unique_id: uniqueid__weather_weekrain_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/weekRain_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    # Not present on this station
    #- name: weather_station_monthrain_mm
    #  unique_id: uniqueid__weather_monthrain_mm
    #  icon: mdi:umbrella
    #  state_topic: "weather/monthRain_cm"
    #  value_template: "{{ (value | float * 10) | round(1) }}"
    #  availability_topic: "weather/connection_status"
    #  payload_available: "online"
    #  payload_not_available: "offline"
    #  unit_of_measurement: "mm"
    #  device_class: precipitation

    - name: weather_station_evapotranspiration_mm
      unique_id: uniqueid__evapotranspiration_mm
      icon: mdi:water-opacity
      state_topic: "weather/ET_cm"
      value_template: "{{ (value | float * 10) | round(5) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "mm"
      device_class: precipitation
      force_update: true # important!

    # Solar

    # MW also makes this available as radiation_Wpm2
    - name: weather_station_radiation_wpm2
      unique_id: uniqueid__weather_radiation_irradiance
      icon: mdi:radioactive
      state_topic: "weather/radiation_watt_per_meter_squared"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "W/m²"
      device_class: irradiance

    # MW also makes this available as maxSolarRad_Wpm2
    - name: weather_station_maxsolarrad_wpm2
      unique_id: uniqueid__weather_maxsolarrad_irradiance
      icon: mdi:radioactive
      state_topic: "weather/maxSolarRad_watt_per_meter_squared"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "W/m²"
      device_class: irradiance

    - name: weather_station_cloudbase_meter
      unique_id: uniqueid__weather_cloudbase_distance
      state_topic: "weather/cloudbase_meter"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "m"
      device_class: distance

    # MW also makes this available as UV.
    - name: weather_station_uv
      unique_id: uniqueid__weather_uv
      icon: mdi:sunglasses
      state_topic: "weather/UV_uv_index"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: ""

    # Soil

    # MW has soilTemp1_C, MS has soilTemp1_degree_C.
    - name: weather_station_soiltemp1_c
      unique_id: uniqueid__weather_soiltemp1_c
      icon: mdi:thermometer
      state_topic: "weather/soilTemp1_C"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_soilMoist1_centibar
      unique_id: uniqueid__soilMoist1_centibar
      icon: mdi:water-opacity
      state_topic: "weather/soilMoist1_centibar"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "cbar"
      device_class: precipitation

    # There's also a matching leafTemp1_C but this is just a copy of
    # soilTemp1_C.
    - name: weather_station_leafWet1_count
      unique_id: uniqueid__leafWet1_count
      icon: mdi:water-opacity
      state_topic: "weather/leafWet1_count"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: ""
      device_class: precipitation

    # MW has soilTemp2_C, MS has soilTemp2_degree_C.
    - name: weather_station_soiltemp2_c
      unique_id: uniqueid__weather_soiltemp2_c
      icon: mdi:thermometer
      state_topic: "weather/soilTemp2_C"
      value_template: "{{ value | round(1) }}"
      availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
    # unit_of_measurement: "°C"
      device_class: temperature

    - name: weather_station_soilMoist2_centibar
      unique_id: uniqueid__soilMoist2_centibar
      icon: mdi:water-opacity
      state_topic: "weather/soilMoist2_centibar"
      value_template: "{{ value | round(1) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: "cbar"
      device_class: precipitation

    # There's also a matching leafTemp2_C but this is just a copy of
    # soilTemp2_C.
    - name: weather_station_leafWet2_count
      unique_id: uniqueid__leafWet2_count
      icon: mdi:water-opacity
      state_topic: "weather/leafWet2_count"
      value_template: "{{ value | round(0) }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      unit_of_measurement: ""
      device_class: precipitation

    # Misc

    - name: weather_station_weewx_update_datetime
      unique_id: uniqueid__weather_datetime
      icon: mdi:calendar-clock
      state_topic: "weather/dateTime_unix_epoch"
      value_template: "{{ value | int | timestamp_local() }}"
    # availability_topic: "weather/connection_status"
    # payload_available: "online"
    # payload_not_available: "offline"
      device_class: timestamp

template:
  - binary_sensor:
      - name: weather_station_weewx_connected
        unique_id: uniqueid__weather_connected
        icon: mdi:calendar-sync-outline
        state: >
          {%- set seconds = (now() - states.sensor.weather_station_weewx_update_datetime.last_changed).total_seconds() -%}
          {{ seconds < 120 }}
        availability: >
          {{ has_value('sensor.weather_station_weewx_update_datetime') }}
        device_class: connectivity

homeassistant:
  customize:
    sensor.weather_station_outtemp_c:
      friendly_name: "Temperature"
    sensor.weather_station_intemp_c:
      friendly_name: "Temperature (indoors)"
    sensor.weather_station_dewpoint_c:
      friendly_name: "Dew Point"
    sensor.weather_station_windchill_c:
      friendly_name: "Wind Chill"
    sensor.weather_station_apptemp_c:
      friendly_name: "Apparent Temperature"
    sensor.weather_station_heatindex_c:
      friendly_name: "Heat Index"
    sensor.weather_station_humidex_c:
      friendly_name: "Humidity Index"
    sensor.weather_station_outhumidity:
      friendly_name: "Humidity"
    sensor.weather_station_pressure_mbar:
      friendly_name: "Pressure"
    sensor.weather_station_barometer_mbar:
      friendly_name: "Barometer"
    sensor.weather_station_windspeed_kph:
      friendly_name: "Wind Speed"
    sensor.weather_station_windgust_kph:
      friendly_name: "Wind Gust"
    sensor.weather_station_winddir:
      friendly_name: "Wind Direction"
    sensor.weather_station_windgustdir:
      friendly_name: "Wind Gust Direction"
    sensor.weather_station_windrun_km:
      friendly_name: "Wind Run"
    weather_station_rainrate_cm_per_hour:
      friendly_name: "Rain Rate"
    sensor.weather_station_rain_cm:
      friendly_name: "Rain"
    sensor.weather_station_rain24_mm:
      friendly_name: "Rain (24 hours)"
    sensor.weather_station_hourrain_mm:
      friendly_name: "Rain (hour)"
    sensor.weather_station_dayrain_mm:
      friendly_name: "Rain (day)"
    sensor.weather_station_evapotranspiration_mm:
      friendly_name: "Evapotranspiration"
    weather_station_radiation_wpm2:
      friendly_name: "Solar Radiation"
    sensor.weather_station_maxsolarrad_wpm2:
      friendly_name: "Solar Radiation (max)"
    sensor.weather_station_cloudbase_meter:
      friendly_name: "Cloud Base"
    sensor.weather_station_uv:
      friendly_name: "UV Index"
    sensor.weather_station_soiltemp1_c:
      friendly_name: "Soil Temperature 1"
    sensor.weather_station_soilMoist1_centibar:
      friendly_name: "Soil Moisture 1"
    weather_station_leafWet1_count:
      friendly_name: "Leaf Wetness 1"
    sensor.weather_station_soiltemp2_c:
      friendly_name: "Soil Temperature 2"
    sensor.weather_station_soilMoist2_centibar:
      friendly_name: "Soil Moisture 2"
    sensor.weather_station_leafWet2_count:
      friendly_name: "Leaf Wetness 2"
2 Likes

Amazing work. Thanks Dave!