A program to receive updates from the ecowitt GW1000 wireless gateway and forward them on to an MQTT broker for consumption. Initial use case is to get data into Homeassistant.
0BSD License
There is now an official Ecowitt Home Assistant integration: https://www.home-assistant.io/integrations/ecowitt/ which works really well. You should probably use that instead.
A program to receive updates from the ecowitt GW1000 wireless gateway, and format them to send along to Home Assistant via MQTT.
I needed some cheap temperature sensors to track the temperature in my chicken coop over the winter. I wanted something that didn't rely on a hosted cloud solution but that I could use stand alone at my own house. The ecowitt weather station was inexpensive and could handle up to 8 remote temperature sensors. You could also configure it to send data to a server of your chosing. This made it a good enough choice to try out. Ideally I'd have found something that was open source, but I wasn't able to. Once I had the temperature data, I wanted to be able to take action based on the current temperature, for example to send myself an alert if it went too low in the chicken coop. As I was already using Home Assistant for home automation, it made sense to try and get the data there.
After researching sensors on Home Assistant, and how they work, it seemed like the easiest and most flexible approach would be to create MQTT messages that I could send to a listening MQTT server that Home Assistant would read from.
GW100 -> ecowitt: POST sensor data
ecowitt --> GW100: 200 OK
ecowitt -> "MQTT Broker": Configuration Messsage
ecowitt -> "MQTT Broker": State Updates
"MQTT Broker" -> "Home Assistant": Configuration Message
"MQTT Broker" -> "Home Assistant": State Updates
The GW1000 collects the data from connected sensors and sends it to a server that you specify. It sends it as a POST request over HTTP. This program (currently named ecowitt, but I'll probaby rename this as it seems to generic) listens for a connection from the weather station, interprets it, and reformats it into MQTT messages that Home Assistant can understand.
I found a pre-existing solution to this problem: https://github.com/iz0qwm/ecowitt_http_gateway
But it did not quite fit my use-case since it doesn't directly put information into Home Assistant.
ecowitt
binary for your systemIn order to build the ecowitt
binary from source, you will need the Go
Programming Language installed on your system. (You
can check if it's already installed by typing: go version
on your system.
Once you have Go installed, you can download, build, and install the ecowitt
binary using the go get
command:
$ go get gitlab.com/gabeguz/ecowitt
ecowitt -server tcp://<IP ADDRESS OF MQTT SERVER>:<PORT> -retained true
ecowitt -username mqtt -password mypassword -server tcp://<IP ADDRESS OF MQTT SERVER>:1883
Using the WSView application, configure the GW1000 to send data to this binary (ecowitt). In the WSView app, navigate to the 'Weather Services' page:
From there, click/press through the 'Next' buttons until you reach the 'Customized' page:
Leave the Protocol Type as "Ecowitt"
Set the Server IP of the IP of the host running the ecowitt binary.
Leave the Path as "/"
Set the port to 3210
The default interval of 60 can be used or you can customize it.