I have just released a new version of the template – Meteotemplate 12.0 Orange! Some of you might think this is a rather very small update, however, in reality it is actually a major one and it was very difficult this time to prepare it – mostly because it did not depend just on me and I had to make sure everything is well co-ordinated and synchronized.
This update includes practically just bug fixes and one major new thing – a new API. If you want to read what the bug fixes are, they are listed at the bottom of this post, now I will talk about the API.
This new API now allows developers of software to built-in Meteotemplate updates into their SW. In practice this means you will only select Meteotemplate in the corresponding SW, specify your update password and that´s it. No CRON jobs, no set up in Meteotemplate, all working automatically.
In addition there are some other major advantages, so let´s just briefly look at those:
- the API supports many extra sensors and parameters including unlimited number of extra temperature sensors, humidity sensors, leaf wetness, soil temperature, soil moisture, sunshine duration, levels of various gases, noise level, lightning etc etc. This can now all be optionally sent to the API and I can create blocks/plugins that will use this information
- no CRON jobs – updates will be triggered by the SW directly using HTTP GET request (note: this is dealing with the updates, if you are using any extra plugins that require cron jobs, eg. webcam, notifications etc, you will still need a CRON job for that)
- much higher reliability – using FTP is always problematic, it is unreliable and slow. HTTP GET request, which is what this API uses, is much faster and reliable. For example, this new API also supports sending data in packages (each sensor can send separately at different intervals and the data will be available in real-time as well as cached for the database) and this interval can be as short as 2 seconds (tested).
- higher accuracy – the api script has been improved and for example precipitation is now calculated more accurately (the update script is slightly problematic when logging rain during the last 5 minutes of the day), wind gust should now exactly match the real maximum
- nicely rounded times – the api will save data to the database in nicely rounded times, eg: 11:00:00, 11:05:00, 11:10:00 etc.
- error handling – improved data validation and error handling
- API uses standardized units and variable names and is well documented in the wiki now, so any developer can easily create a script to update Meteotemplate or integrate it into their SW. People who know how to program and use some own system of getting data from their PWS can easily update the template now too.
These were just some of the advantages. One very important thing – after you update to v12, the original scripts for updates are still available so it is up to you when you decide to switch from update to API if whatever SW you use supports this.
As you can imagine, this time it was not just up to me, but I have already been in touch with several developers and we were working together on this, so here is some information about software support for SW whose developer I have been in touch with:
- Meteobridge – full support of the API, an update to your MB device is available, reboot your device
- Weather Display – full support of the API, an update of WD should be available now
- WeeWx – full support of the API using an extra package, already available for download
- WeatherCat – full support of the API (an update of WC will be available whenever Stu has time for this, the scripts are ready and it should be in a matter of weeks or max one month)
- Cumulus – I have been in touch with Steve, but unfortunately Cumulus will not support the new API scripts
I have not contacted anyone else, but as mentioned above, the API is now fully documented in the WIKI so if you are using some other means of updates or getting data from your PWS, you can contact the developer and discuss it with them and of course also let me know so that I can add this information to the wiki for others.
If you are using one of the SW that will support the new API, then until an update is available and you install it, just leave everything as it is now. The template will be updated using the original update.php.
Then, once you switch to the api script, all you will have to provide is the API URL and update password.
- API URL – is simply api.php and this file is in your template root folder, alongside indexDesktop, so the URL is something like …../api.php.
- UPDATE PASSWORD – the update password specified in the Main settings.
After you do this MAKE SURE YOU DISABLE the CRON job. The updates will be triggered automatically by the SW and if you use the update.php it will make a mess in your database updates. Again, as mentioned above, we are talking about the CRON job that is updating your database (either update.php or the corresponding update script if you are using any of the plugins for updates – WeatherCat etc.). Do not disable any other CRON jobs you might have – the cron.php, updating your webcam plugin, notifications plugin etc. That should stay as it is now!
If you are using Meteobridge, you can then disable the original HTTP requests.
ONE LAST VERY IMPORTANT THING!
The API opens much wider potential for future blocks, plugins etc. This however required some changes in the way it saves data. What this means is that I will need to update those blocks and plugins, which use the realtime files – in particular I am talking about clientraw, mbLive and realtimeMT (WD, MB, WeatherCat). After you switch to this new API script, you need to change the update type of these blocks and plugins to “db”, so that they use your database.
This of course will only be temporary, I will update all the blocks and plugins as soon as I can, hopefully in a matter of days or a week max.
Bug fixes/improvements in v12:
- menu check for available pages fixed
- climate/index.php – bug fixes for missing values
- install/setup.php – prevent autocomplete of the fields by the browser, which often overwritten the original MySQL details
- annual report – fixed max values, fixed monthly rain values
- climate analysis – optimization to prevent data overflow
- mobile header – bug fixes
- trends page – sparkline graphs fix
- install/setup.php – improved compatibility with https pages
- indexDesktop.php – fixed font color for menu blocks when using light theme
- icons – added Davis Vantage Vue
- header.php – fixed sunrise/sunset calculations
- pages/astronomy/sun – fixed graphs (due to Highcharts update)
- daily report – fixed number of decimal places for pressure when using inHg
- update/testUpdate.php – fixed an issue when using custom file type update
As I said above, this was a difficult update, changing the update scripts is always potentially problematic and one has to make absolutely sure it works fine. Hopefully it will as it has been tested by several users, at this point I would like to thank (in particular order) to Luc, Brian (WD), Stu (WeatherCat), Matt (WeeWx), Arthur, Reinhard and Boris (MB) for their cooperation and help.
I have a full list of features to add, based on the January questionnaire, but I will leave those for v13. In this update I wanted to concentrate on the API to make sure it works perfectly.
Pretty simple – go through each folder and replace the existing scripts with the corresponding new ones. Make sure you do not delete the entire folders! Each folder in the update package only includes the updated files, which must be replaced individually.
Then lastly, copy the api.php into your server root folder (do this even if you cannot use the api at this point, it will not in any way influence your db updates and will be ready for the future). Also copy the .htaccess file (if you have not done so already as part of the bug fixes package), which will make sure your icons are working fine.
If you are using any of the above mentioned SW, which should support the API, first check if the update has already been implemented and if so, disable the CRON job, set the updates to the api script and hopefully the api will then start updating your db. If not, quickly change back to update.php and let me know and I will look at what the problem could be.
Meteobridge – once the update is available, you will need to reboot your device so that it loads it! You should then see Meteotemplate in the Weather Networks tab.
Make sure that the directory “cache” in template root is writable!
As I mentioned yesterday, for downloading the update you will need a token. I will get back to you within 24 hours so please be patient. First come, first serve, but I have to make sure I do this in batches so that there is not too many people trying to download this at the same time and I also work every day so in case I just don´t see your email immediately, please be patient, I will definitely get back to you.
The other reason for this is that this update is potentially problematic, updates is something that just has to work, so in case I see any issues, I will immediately stop issuing the download tokens until the problem is resolved.