updateWeatherSensors (yet another buienradar script)
Posted: Wednesday 11 April 2018 23:51
Because of size limitations on this forum I can no longer post the script in text format. Please download the attached zip.
This script is based on various other scripts and plugins found on the Domoticz forum. I gracefully borrowed code and solutions from many contributors over here. It is by no means perfect or even complete. I hope that if you use it or get some ideas out of it, you will enjoy it as much as I had when writing it.
I welcome all constructive comments, improvements and ideas. New versions will be posted here Latest version 0.20190808
Detailed explanation and History can be found inside the leesmij.txt, script and setting file.
All settings are to be done in weatherSettings.lua
There should be no need to change something in updateWeatherSensors.lua
First rows in weatherSettings.lua are your weather devices as defined in domoticz identified by their device number
(Note: You only have to define the sensors / switches you want to use and can comment the other ones by typing
-- in front of the line )
If you already defined devices for previous versions of this script and you don't need them any longer
you can also comment them with the two -- in front an delete them in domoticz
Last but not least: Many thanks to dannybloe and others for dzVents.
History since last posting
======================
20180429 Added location retrieval from domoticz settings
20180430 Adjusted Lux calculation
20180430 Fixed bug in Barometer setting (wrong dz.constants) and
20180430 Add setting for significant decimals in barometer
20180501 Get domoticzurl from system no longer required to give IP / Port in setting
20180502 Add option to separate windchill from wind device
20180504 More adjustments to Lux calculation based on SolarPower (thanks to poudeness)
20180504 Add file with Curle errors (Will be loaded in debug mode only)
20180505 Set weatherstation is now optional. Script gets nearby weatherstation based on longitude / latitude from domoticz
20180505 Script will get home address based on longitude / latitude from domoticz
20180506 Script will dump json Returns to file on request, -significant errors and when dz.LOG_DEBUG is active.
20180506 Script will load data from files in test-mode
20180507 Add option to get data from other nearby stations when getting specific data from initial station failed
20180508 Moved local vars to tables.
20180510 Moved functions to separate file
20180511 Made load data from files in test mode and dump json Returns to file mutual exclusive
20180512 Loglevel now in settings
20181204 Add possibility to use google API key ( https://cloud.google.com/maps-platform/ ... t-changes/" ) for address resolution
20181205 Bugfix: use choice between domoticz location or weatherstation also for rainforecast.
20190808 Made script more resilient if dzVents does not recognize HTTP response as JSON ( forum link )
This script is based on various other scripts and plugins found on the Domoticz forum. I gracefully borrowed code and solutions from many contributors over here. It is by no means perfect or even complete. I hope that if you use it or get some ideas out of it, you will enjoy it as much as I had when writing it.
I welcome all constructive comments, improvements and ideas. New versions will be posted here Latest version 0.20190808
Detailed explanation and History can be found inside the leesmij.txt, script and setting file.
All settings are to be done in weatherSettings.lua
There should be no need to change something in updateWeatherSensors.lua
First rows in weatherSettings.lua are your weather devices as defined in domoticz identified by their device number
(Note: You only have to define the sensors / switches you want to use and can comment the other ones by typing
-- in front of the line )
If you already defined devices for previous versions of this script and you don't need them any longer
you can also comment them with the two -- in front an delete them in domoticz
Last but not least: Many thanks to dannybloe and others for dzVents.
History since last posting
======================
20180429 Added location retrieval from domoticz settings
20180430 Adjusted Lux calculation
20180430 Fixed bug in Barometer setting (wrong dz.constants) and
20180430 Add setting for significant decimals in barometer
20180501 Get domoticzurl from system no longer required to give IP / Port in setting
20180502 Add option to separate windchill from wind device
20180504 More adjustments to Lux calculation based on SolarPower (thanks to poudeness)
20180504 Add file with Curle errors (Will be loaded in debug mode only)
20180505 Set weatherstation is now optional. Script gets nearby weatherstation based on longitude / latitude from domoticz
20180505 Script will get home address based on longitude / latitude from domoticz
20180506 Script will dump json Returns to file on request, -significant errors and when dz.LOG_DEBUG is active.
20180506 Script will load data from files in test-mode
20180507 Add option to get data from other nearby stations when getting specific data from initial station failed
20180508 Moved local vars to tables.
20180510 Moved functions to separate file
20180511 Made load data from files in test mode and dump json Returns to file mutual exclusive
20180512 Loglevel now in settings
20181204 Add possibility to use google API key ( https://cloud.google.com/maps-platform/ ... t-changes/" ) for address resolution
20181205 Bugfix: use choice between domoticz location or weatherstation also for rainforecast.
20190808 Made script more resilient if dzVents does not recognize HTTP response as JSON ( forum link )