Self-Hosted Weather Station Data Visualization
My dad bought a weather station. Since I don’t like relying on cloud services that might go away at any point in time or request monthly fees from you, I made sure he gets a model that can send it’s data to a local hosted service.
The basic steps to achieve that are shown here
Emulate an ecowitt compatible API endpoint on-premises
I wrote a small web-server ecowitt2db in Rust that accepts the POST form data in ecowitt format. It converts the silly units to metric, stores them into InfluxDB. It is very specialized to the “Sainlogic WS3500” my dad bought, but I guess a good enough starting point for someone else looking to do the same.
Configure the EasyWeatherPro based weather-station
The station in question runs EasyWeatherPro_V5.2.2
as firmware, which is used by many differently brand-named stations too.
It allows to set a customized server endpoint in it’s Web-UI.
I chose
- “Customized”: “Enable”
- “Protocol Type Same As”: “Ecowitt”
- “Server IP”: “192.168.1.2”
- “Path”: “/data/report”
- “Port”: 9876
- “Upload Interval”: 60 Seconds
As you can see it reports to a service running on the LAN.
Install and configure InfluxDB
This was very easy, I run a TrueNAS SCALE server for backups of my parents and my stuff already. This platform offers InfluxDB as an application installable via the TrueNAS Web-UI. In the InfluxDB Web-UI I configured a bucket called “weather” and two tokens. One with read/write access, for the ecowitt2db tool, the other with read-only access for grafana.
Install and configure Grafana
On TrueNAS I run a virtual-machine based on Debian. I followed the install instructions of grafana for Debian. Again on the grafana Web-UI I configured the data-source to be InfluxDB and built a custom dashboard. Here’s an example flux query for the outdoor temperature time-series:
from(bucket: "weather")
|> range(start: -1d)
|> filter(fn: (r) => r._measurement == "outdoor" and r._field == "temperature")
|> yield(name: "_results")
To make it accessible to my dad, I shared the dashboard “externally” which has the least friction - no authentication needed, just open the URL.
Conclusion
All in all a fairly straight forward endeavor: no complicated config file formats to learn, only very simple Rust code needed and, after a few hours of work, a very pretty dashboard.