updateWeatherSensors (yet another buienradar script)

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

updateWeatherSensors (yet another buienradar script)

Post by waaren » 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.20180512

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
Attachments
WUS.zip
Setting-, function-, error- and Maincode file
version 20180512
(31.68 KiB) Downloaded 59 times
Last edited by waaren on Monday 14 May 2018 8:00, edited 31 times in total.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Thursday 12 April 2018 18:38

Thank you! I like it very much. No problems anymore with different versions of Python that kill each other.

User avatar
EdwinK
Posts: 1204
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EdwinK » Thursday 12 April 2018 20:24

going to try this.
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Friday 13 April 2018 21:53

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.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
EdwinK
Posts: 1204
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EdwinK » Friday 13 April 2018 22:46

You posted a link to edit your post. Good thing we can't use those.
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Friday 13 April 2018 23:44

Sorry about that. Should be OK now
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Saturday 14 April 2018 7:43

@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.

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Saturday 14 April 2018 9:43

schulpr wrote:
Saturday 14 April 2018 7:43
@waaren what is changed compared with the previous version? Should I update?

Kind regards, Rob
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)
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Saturday 14 April 2018 12:12

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

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Saturday 14 April 2018 13:02

Done,

and thx !
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Sunday 15 April 2018 7:56

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

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Sunday 15 April 2018 8:26

schulpr wrote:
Sunday 15 April 2018 7:56
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
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 ?
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Sunday 15 April 2018 16:13

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

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Sunday 15 April 2018 19:06

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.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Monday 16 April 2018 11:15

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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
EdwinK
Posts: 1204
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EdwinK » Monday 16 April 2018 14:52

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?
Screen Shot 2018-04-16 at 14.49.57.png
Screen Shot 2018-04-16 at 14.49.57.png (38.47 KiB) Viewed 1339 times
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Monday 16 April 2018 19:04

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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
EdwinK
Posts: 1204
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EdwinK » Monday 16 April 2018 19:14

waaren wrote:
Monday 16 April 2018 19:04
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

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 | RFxcom | Dashticz V2 |

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Monday 16 April 2018 20:05

@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?

User avatar
waaren
Posts: 708
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by waaren » Monday 16 April 2018 20:36

schulpr wrote:
Monday 16 April 2018 20:05
@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?
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 ?
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest