Thanks to @jgoakley Jeff for the inspiration on this!
I have a significant collection of weather and environmental sensors that all eventually report to weewx (https://weewx.com/) and so wanted to get data from that into Home Assistant. After “overthinking” this for a few hours, turns out it REALLY easy. This is still a work-in-progress, doing things like adding IDs and building some dashboards; but hopefully this will get someone else started,
weewx can be configured to generate MQTT messages - and Home Assistant can easily read those messages. I’m sure others will embellish this and show even better ways; but here are the basics:
Download Mosquitto (https://mosquitto.org/) or use a broker of your choice and get it running somewhere. I ran it on my weewx host.
Configure weewx for MQTT by downloading Matt Wall’s weewx-mqtt from here (GitHub - matthewwall/weewx-mqtt: upload data to mqtt broker) and follow the directions to install. Here’s the appropriate entries in my weewx.config
[[MQTT]]
server_url = mqtt://@localhost:1883/
retain = True
Add the MQTT integration (settings/Devices and Services) to Home Assistant and follow the documentation to configure it and point it to your broker,
Add the weewx topics to your configruation.yaml file. Here’s a snippet of mine:
mqtt:
sensor:
- state_topic: “weather/outTemp_F”
name: “Outdoor Temperature”
unit_of_measurement: ‘F’
device_class: ‘temperature’
value_template: “{{ value | round(1) }}”
icon: “mdi:thermometer”
- state_topic: “weather/windSpeed_mph”
name: “Wind Speed”
unit_of_measurement: ‘mph’
value_template: “{{ value | round(1) }}”
icon: “mdi:weather-windy-variant”
- state_topic: “weather/windGust_mph”
name: “Wind Gust”
unit_of_measurement: ‘mph’
value_template: “{{ value | round(1) }}”
icon: “mdi:weather-windy”
- state_topic: “weather/outTemp_F”
name: “Outdoor Temperature”
unit_of_measurement: ‘F’
device_class: ‘temperature’
value_template: “{{ value | round(1) }}”
icon: “mdi:thermometer”
Restart Home Assistant and look for the names of the topics as entities that you can use in Dashboards or Automations.