updateWeatherSensors (yet another buienradar script) [SOLVED]
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
updateWeatherSensors (yet another buienradar script)
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 )
- Attachments
-
- WUS.zip
- Setting-, function-, error- and Maincode file
version 20190808 - (31.77 KiB) Downloaded 274 times
Last edited by waaren on Wednesday 05 December 2018 12:32, edited 33 times in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Thank you! I like it very much. No problems anymore with different versions of Python that kill each other.
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
going to try this.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
New version available; see first post here Latest version 0.20180413
Last edited by waaren on Friday 13 April 2018 23:43, edited 1 time in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
You posted a link to edit your post. Good thing we can't use those.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Sorry about that. Should be OK now
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
@waaren what is changed compared with the previous version? Should I update?
Kind regards, Rob
Forget my question. I saw your comments in the script.
Kind regards, Rob
Forget my question. I saw your comments in the script.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Hi schulpr,
couple of fixes, additions and improvements. (see below in History). I expect some more to come in the next couple of days / weeks.
todo
====
separate user specific settings from main file
user adjustable interval for logging to domoticz logfile
....
History
========
20180408 Start coding
20180411 First version active and shared on forum
20180412 Added check on text fields (do not overwrite same text)
20180413 Added more checks and logs
20180413 Corrected rain forecast formulas
20180413 Adjusted rain forecast devices
20180413 Added Alert,text and switch rain forecast devices (all optional)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Hi @waaren,
Thanks for your reply.
I think you have to add some underscores in lines 139 en 140.
local rainForecast_1_hour
local rainForecast_2_hours
Regards, Rob
Thanks for your reply.
I think you have to add some underscores in lines 139 en 140.
local rainForecast_1_hour
local rainForecast_2_hours
Regards, Rob
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Done,
and thx !
and thx !
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Hi @waaren,
I get this error: Error (2.4.4): WUS: : Multiple items found for Lang weerbericht (device). Please make sure your names are unique or use ids instead.
Any idea why?
Kind regards, Rob
I get this error: Error (2.4.4): WUS: : Multiple items found for Lang weerbericht (device). Please make sure your names are unique or use ids instead.
Any idea why?
Kind regards, Rob
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
this message is a standard message from dzVents if a devicename is not unique in your database. Can you change to the devicenumber of this device ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
I renamed the device and now it's working correct. Strange, I can't see the other device with the same name.
Thanks for the tip.
Rob
Thanks for the tip.
Rob
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Hi Rob,
it might be related with the problem I reported in another topic. Text devices with a string length > 240 are not shown in the devices or utility tab but are still present in the database.
Until this is fixed by the domoticz developers, I restrict the length of the long forecast text to max. 240 chars. New version will be available late tonight or tomorrow with this and other fixes / mods.
I will also report this as an issue at the domoticz github.
it might be related with the problem I reported in another topic. Text devices with a string length > 240 are not shown in the devices or utility tab but are still present in the database.
Until this is fixed by the domoticz developers, I restrict the length of the long forecast text to max. 240 chars. New version will be available late tonight or tomorrow with this and other fixes / mods.
I will also report this as an issue at the domoticz github.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
New version available; see first post here Latest version 0.20180416
User specific settings (including your devices) can now be separated from main code file. Both files in the attached zip
History
========
20180408 Start coding
20180411 First version active and shared on forum
20180412 Added check on text fields (do not overwrite same text)
20180413 Added more checks and logs
20180413 Corrected rain forecast formulas
20180413 Adjusted rain forecast devices
20180413 Added Alert,text and switch rain forecast devices (all optional)
20180414 User adjustable interval for Info logging to domoticz logfile
20180414 User adjustable interval for updating unchanged sensors/switches
20180414 Shortened long forecast string to 240 chars because of bug in domoticz
20180415 Separated user specific settings from main codefile
20180416 Improved layout text to logfile
User specific settings (including your devices) can now be separated from main code file. Both files in the attached zip
History
========
20180408 Start coding
20180411 First version active and shared on forum
20180412 Added check on text fields (do not overwrite same text)
20180413 Added more checks and logs
20180413 Corrected rain forecast formulas
20180413 Adjusted rain forecast devices
20180413 Added Alert,text and switch rain forecast devices (all optional)
20180414 User adjustable interval for Info logging to domoticz logfile
20180414 User adjustable interval for updating unchanged sensors/switches
20180414 Shortened long forecast string to 240 chars because of bug in domoticz
20180415 Separated user specific settings from main codefile
20180416 Improved layout text to logfile
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Thanks. I like settings to be separated so you don't have to add them time and time again.
Is it default that the alert tile and the alert txt give the same message? Shouldn't one text be enough?
Is it default that the alert tile and the alert txt give the same message? Shouldn't one text be enough?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
One choice should be enough but from the alert device you can also get the alert level.
Just pick the one you like and ignore the other one. eg comment one in the setting file
Just pick the one you like and ignore the other one. eg comment one in the setting file
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Thanks. Thought so, but better to ask before killing thngs.
Last edited by EdwinK on Monday 16 April 2018 20:44, edited 1 time in total.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
-
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
@waaren I get a lot of log input. Most important: Info: WUS: no Uservars file available.
The file is the the correct folder. Any idea?
The file is the the correct folder. Any idea?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: updateWeatherSensors (yet another buienradar script)
Hi Rob,
thanks for testing. I do not really have an idea yet. I run domoticz as root so that might be a reason why I don't see the problem but I am not sure.
could it be an access rights problem ?
On what version of dzVents are you ?
Are you on the Synology or on PI ?
what OS ?
if you run with option debug in the script and on dzVents general level (setup -> settings -> other -> dzvents -> debug ) do you get more relevant info ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: Google [Bot] and 1 guest