What links an Ecowitt Weather Station, Cumulus MX, and Home Assistant? MQTT
This is absolutely the type of blog post that is written only for those that come behind trying to solve the same problem, and searching the web for help. Or to remind me how I did it. If you don't understand the title, you can safely ignore this one.
The Problem
I have an Ecowitt (HP2551) Weather Station in my back garden, that uses Cumulus MX as software to capture and log my data to my website here. That means the weather station console is uploading the data to my local server running Cumulux MX, as well as to ecowitt.net - which is a top tip to help prevent data loss by the way. If you have such a weather station the information to do this is easy enough to find in the documentation.
The downside of sending the data to Cumulus MX is that I couldn't also send it to my Home Assistant server. Home Assistant is software to let you do home automation in - well - your home, rather than relying entirely on other people's cloud services. Home Assistant has an Ecowitt integration but this relies on it being the endpoint for sending data to instead of, in my case, Cumulus MX.
MQTT to the rescue
But the neat thing is that Cumulus MX can use MQTT - a light weight messaging protocol - to send the weather data it has received from the weather station in such a way that Home Assistant can receive it.
The first thing you will need to do is install the MQTT integration in your Home Assistant configuration.
Next you'll need an actual MQTT server somewhere, if you don't already have one in your network or somwhere. I'm running a Debian GNU/Linux server to do all this, with Cumulus MX and Home Assistant in containers. So I set up mosquitto, a Debian packaged MQTT server in the Home Assistant container, figuring it might be useful for other MQTT stuff in the future too. Here's a guide for installing mosquitto under Debian if that would be useful. Note the username and password details you use in the configuration, because you will be using these in the CumulusMX MQTT settings.
For me the big headache was the file for sending the actual data. Some sample files exist that send the data under MQTT topics with very little info. I wanted much more. I found this great gist on GitHub from rafal83 (hat top to you Raph) which is long, because it does the hard work in CumulusMX for the sensors to be straightforward in Home Assistant. It's also in French.
Anyway, I translated the file to English so you don't have to, and published my own gist here.
Configuration
I simply dropped this file with name CumulusMX_HomeAssistant.english.json into the MQTT directory in my Cumulus MX configuration, and then used the web configuration in Cumulus to tell it to use this file for updates.

I expected to do a bit more work in Home Assistant, but no, the new sensors were picked up right away for me.

So, if you have found this in a Google search trying to do the same thing, good luck, bon chance, and thanks to Raph on Github who saved me a lot of time.