Hi, I am relatively new to Openhab but I thought I’d share something here to inspire others.
A few months ago I really didn’t know anything about Openhab, Javascript or any programming, and still don’t . I don’t know much about Linux either nor am I comfortable with and console commands; but nevertheless with a lot of reading and support here I achieved something I am rather pleased with. So I’d thought I’d share and say thank you.
The screen shot below is taken from Grafana but the dials also shows dynamically in Habpanel. I also have the usual plots and charts for all my room thermostats (Openwebnet binding) but here I show some nice Grafana gauges displaying the dynamic data from my Mobile-Alerts wireless rain ,wind, temperature and humidity sensors. These sensors enable a relatively inexpensive wireless weather station to be built or monitor things like garage, fridges, fish tank, pools and ponds etc. They can be found under various brand names. Discussion: mobile-alerts-and-openhab
The dial pointers are animated and move in a nice slow steady manner to their position. I get email alerts and push notifications if its very windy or it started to rain.
I did it all using Openhabian on a Raspberry Pi 3b.
I got the sensor data from the internet using a combination of Mobile-Alerts REST API query and HTML caching of the Mobile-Alerts sensor web page. Which method I used depends on the sensor type. Only the pro-sensors have the option of the REST API.
In Grafana I used the D3 Gauge panel plugin and implemented Value and Tick mapping for the wind direction gauges. The rain total gauge is, like the charts, also dynamic and adjusts its value depending on the time period selected. To achieve this I used SELECT mean, difference and cumulative sum in the metrics as the mobile-alerts data is just a running total of rain fall since the sensor was activated.
So, thank you again everyone who helped me achieve this.
ps Just noticed an issue with the average wind direction. North directions are around 15, 0, 1 in number terms. So, when the wind is northerly and flipping between 0 and 15 results in average of 8 ie south grrr. Should work for other wind directions but North is a problem. Any ideas how to fix that would be appreciated. …Looks like I have to some maths and convert the wind angle to x and y components. Then average these x and y values and convert back to angle. I could use JavaScript to compute the x and Y using SIN and COS. Persist these values into influx and get influx to transform the average back to angle using ATAN I don’t see ATAN appearing in Grafana metrics options but there is talk of it for Influx … hmmmm.
That’s for unweighted average. For weighted then I need to factor in the speed. I think unweighted would be OK now .
Edited to add … it seems I can’t compute accurately the average wind direction due to Openhab and Influx limitations. Influx can’t do calculations with different measurements and Openhab can’t combine items into one measurement for persistence. I got most working but can’t compute the final part avgX / avgY