-
Notifications
You must be signed in to change notification settings - Fork 8
JSON formatted data file
Since the creation of the weeWX Weather App and the Inigo plugin for weeWX, the Cheetah template was a CSV based format that had increasingly been expanded over the years from a simple way to pass data relevant to my PHP based hobby weather website, at some point this even included a time period included twice by accident.
With recent app development for temperature notifications there was a real need to predict the peak temperature of the day in real time, this required a major shift in how the data was output from weeWX for the app.
It had become painfully obvious that a major redesign of both the output of the plugin and data handling in the app was the only way forward.
A flexible JSON based formatted file has long been an ideal goal and as of v2.0.0 of the Inigo plugin and v2.0.0 of the weeWX Weather App all the old CSV code is now gone.
The JSON templates makes use of loops to create predictable names to reference each item of data, previously it was based on the position of the CSV column which was meaningless to people.
During the process of re-writing the Cheetah template, timestamps are now used instead of trying to manipulate date/time strings.
The big benefit is on the stats screen where text dates previously overlapped, no longer!
The good news is you won't lose any data or statistics as that's all held in your weeWX database.
However v1.99.108beta and later versions of the app aren't compatible with the old file format and you will need to install the new version of the Inigo plugin.
Another piece of good news is that weeWX now has global default units and labels, an option that previously wasn't available, previous Inigo plugin versions required packaging multiple variants with metric or imperial defaults for the Cheetah template.
It's surprisingly difficult to calculate when the daily peak temperature has been reached in real time, as passing clouds and other weather phenomenon can temporarily cause the temperatures to decrease before increasing again and given the right set of circumstances this can prematurely trigger notifications in the app.
A possible way to detect peak daily temperature in real time is by using a z-score algorithm and to supply temperature data from loop packets to the algorithm.
The peak detection algorithm uses the Python numpy library, both to synthesise loop packet temperature data from archive records on startup, and for the z-score algorithm, to install numpy do one of the following:
sudo apt update
sudo apt -y install python3-numpy
or for PIP based installs:
pip install numpy
To install the new Inigo plugin version just run the following command:
sudo weectl extension install --yes --config /etc/weewx/weewx.conf https://github.com/evilbunny2008/InigoPlugin/archive/master.zip
If you have an offset time for rainfall reset, use the --since-hour command line argument on first install.
For 9am use --since-hour 9
sudo weectl extension install --yes --config /etc/weewx/weewx.conf https://github.com/evilbunny2008/InigoPlugin/archive/master.zip --since-hour 9
You need to update the inigo-settings.txt file to have a jsondata= line and the url doesn't need to end in .json.
As with previous versions of the app the URL can be any valid URL that serves the JSON data, such as PHP scripts that enable password protection of your weather data.
Then you will need to re-save the settings in the app again as the app caches settings provided by the settings file.