updateWeatherSensors (yet another buienradar script)

schulpr
Posts: 123
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Monday 16 April 2018 21:18

@waaren,

Properties of the file: 0644
dzVents version 2.4.4
I'm on a PI2
Domoticz beta 3.9227

schulpr
Posts: 123
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Monday 16 April 2018 21:42

Hi waaren,

When I put the settings directly in the dzVents script it works flawless :-)

Kind regards, Rob

User avatar
waaren
Posts: 1226
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 21:47

Hi Rob,

thx. but if devices are entered as numbers it will also work using the setting file.

Again many thanks for testing.
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: 123
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Tuesday 17 April 2018 6:28

Oeps, I missed that. I just copied my settings into the new settings file. Thus wrong :roll: . Everything works fine now.

Thank you for this great script. Maybe you should consider to make the settings file the only method for the parameters.

Keep up the great work!

Kind regards, Rob

poudenes
Posts: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes » Tuesday 17 April 2018 14:13

hi All,

I have add the sensor types. But don't know that type of sensor "Rain Rate" will be?

Code: Select all

settings =                                                                                                                                              
{                                                                                                                                                       
        --- Name of Weatherstation. REQUIRED !! not of the city/location  as this is not unique                                                         
        myWeatherStation      = "Schiphol" ;                                                                                                            
                                                                                                                                                        
        -- your weather devices as defined in domoticz (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)  
        
        barometer             = nn;                        -- Sensor Type: Barometer                                                                    
        wind                  = nn;                        -- Sensor Type: Wind                                                                         
        sight                 = nn;                        -- Sensor Type: visibility                                                                   
        sunlight              = nn;                        -- Sensor Type: solar                                                                       
        rainRate              = nn;                        -- Sensor Type: ???                                                                         
        tempHumidity          = nn;                        -- Sensor Type: Temperature + Humidity                                                       
        weatherForecastLong   = nn;                        -- Sensor Type: Text (Long weather forecast text)                                            
        weatherForecastShort  = nn;                        -- Sensor Type: Text (Short weather forecast text)                                          
        rainForecast_1_hour   = nn;                        -- Sensor Type: Custom Sensor (Axis Label: mm/h)                                              
        rainForecast_2_hours  = nn;                        -- Sensor Type: Custom Sensor (Axis Label: mm/h)                                             
        rainAlarmText         = nn;                        -- Sensor Type: Text                                                                         
        rainAlarm             = nn;                        -- Sensor Type: Alert                                                                       
        rainAlarmSwitch       = nn;                        -- Sebsor Type: Switch 
        
                                                                                                                                                                
        --other user settings                                                                                                                           
        rainAlertTime         = 20;                         -- Check rain in the next rainAlertTime minutes                                             
        rainAlertAmount       = 0.02;                       -- mm Rain to take serious                                                                  
        forcedUpdateMinutes   = 360;                        -- Update sensors even when no change after nnn minutes (0 ===> never, 99 ===> always)      
        displayInfoLogMinutes = 99;                         -- Show info in domoticz logfile every nnn minutes (0 ===> never, 99 ==> always)            
 } 
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
waaren
Posts: 1226
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 » Tuesday 17 April 2018 14:21

rainRate is type rain (regen) :D
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

poudenes
Posts: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes » Tuesday 17 April 2018 14:41

Thanks :D

I see that the Rain / Rain Device is not updated. Now its red.

And moved the weatherSettings.lua file to

/home/pi/domoticz/scripts/dzVents/modules
instead
/home/pi/domoticz/scripts/modules

When using the last one i get a error that my weather station was not set.
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

poudenes
Posts: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes » Tuesday 17 April 2018 22:59

Will you also add Solar Data? i have a script running to get the LUX level. Would be nice to have this in your script as well. So i can use 1 script for Weather forecast, Rain Forecast, Sun Lux level etc etc. :)
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
waaren
Posts: 1226
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 » Wednesday 18 April 2018 0:26

poudenes wrote:
Tuesday 17 April 2018 22:59
Will you also add Solar Data? i have a script running to get the LUX level. Would be nice to have this in your script as well. So i can use 1 script for Weather forecast, Rain Forecast, Sun Lux level etc etc. :)
if solar data is available from buienradar or any other public website I can/will add it.
location/name for setting file is "domoticz dir"/scripts.dzVents/scripts/modules/weatherSettings.lua
Time between device updates even when no change is set by forcedUpdateMinutes in weatherSettings.lua
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: 123
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Friday 20 April 2018 18:04

Hi,

I would like to use the value of the rain prediction in another script but I can't see what type of value that it is.

local buienkans = domoticz.devices('Regenhoeveelheid 1u').value I also tried other parameters like level, rate.

Does anyone have an idea? (Or even better, a solution :-) )

Kind regards, Rob

User avatar
waaren
Posts: 1226
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 20 April 2018 19:34

@schulpr

hi Rob,

the device is a custom sensor. You must use .state to read its value.

So for you:

local buienkans = domoticz.devices('Regenhoeveelheid 1u').state
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: 123
Joined: Thursday 01 January 2015 10:10
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by schulpr » Friday 20 April 2018 20:20

Hi waaren,

Thank you. That was the only one I didn't tried... :?

Regards, Rob

User avatar
waaren
Posts: 1226
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 20 April 2018 22:01

schulpr wrote:
Friday 20 April 2018 20:20
Hi waaren,

Thank you. That was the only one I didn't tried... :?

Regards, Rob
:D
you can always use the dump() method to find out what to use

domoticz.devices('Regenhoeveelheid 1u').dump() will give a lot of information
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

Bufoto
Posts: 12
Joined: Thursday 10 November 2016 22:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Bufoto » Monday 23 April 2018 10:04

Hi Waaren,
Thanks for sharing this great script.
I installed it and it works fine for Rotterdam and Schiphol.
But when I use IJmuiden or Wijk aan Zee I get an error message:
-----------------------------
2018-04-23 09:52:43.367 User: Admin initiated a switch command (34/XButton-2/Off)
2018-04-23 09:52:43.489 dzVents: Info: Handling events for: "XButton-2", value: "Off"
2018-04-23 09:52:43.489 dzVents: Info: WUS: ------ Start external script: updateWeatherSensors_ori.lua: Device: "XButton-2 (Buienradar)", Index: 34
2018-04-23 09:52:43.492 dzVents: Debug: WUS: Processing device-adapter for Barometer: Barometer device adapter
2018-04-23 09:52:43.494 dzVents: Debug: WUS: Processing device-adapter for Wind_Temp_Chill: Wind device adapter
2018-04-23 09:52:43.494 dzVents: Debug: WUS: Processing device-adapter for Zicht: Visibility device
2018-04-23 09:52:43.495 dzVents: Debug: WUS: Processing device-adapter for Zonkracht: Solar radiation device adapter
2018-04-23 09:52:43.496 dzVents: Debug: WUS: Processing device-adapter for Rain: Rain device
2018-04-23 09:52:43.497 dzVents: Debug: WUS: Processing device-adapter for Temp_Hum: Temperature+humidity device adapter
2018-04-23 09:52:43.497 dzVents: Debug: WUS: Processing device-adapter for Voorspelling: Text device
2018-04-23 09:52:43.498 dzVents: Debug: WUS: Processing device-adapter for RainForecast_2h: Custom sensor device adapter
2018-04-23 09:52:43.499 dzVents: Debug: WUS: Processing device-adapter for Regenwaarschuwing: Alert sensor adapter
2018-04-23 09:52:43.499 dzVents: Debug: WUS: Processing device-adapter for Regenvoorspeld: Switch device adapter
2018-04-23 09:52:43.500 dzVents: Debug: WUS: OpenURL: url = https://api.buienradar.nl/data/public/1.1/jsonfeed
2018-04-23 09:52:43.500 dzVents: Debug: WUS: OpenURL: method = GET
2018-04-23 09:52:43.500 dzVents: Debug: WUS: OpenURL: post data = nil
2018-04-23 09:52:43.500 dzVents: Debug: WUS: OpenURL: headers = nil
2018-04-23 09:52:43.500 dzVents: Debug: WUS: OpenURL: callback = buienradarResponse
2018-04-23 09:52:43.501 dzVents: Info: WUS: ------ Finished updateWeatherSensors_ori.lua
2018-04-23 09:52:43.567 EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-04-23 09:52:49.386 dzVents: Info: Handling httpResponse-events for: "buienradarResponse
2018-04-23 09:52:49.386 dzVents: Info: WUS: ------ Start external script: updateWeatherSensors_ori.lua: HTTPResponse: "buienradarResponse"
2018-04-23 09:52:49.494 dzVents: Debug: WUS: Processing device-adapter for Barometer: Barometer device adapter
2018-04-23 09:52:49.495 dzVents: Debug: WUS: Processing device-adapter for Wind_Temp_Chill: Wind device adapter
2018-04-23 09:52:49.496 dzVents: Debug: WUS: Processing device-adapter for Zicht: Visibility device
2018-04-23 09:52:49.496 dzVents: Debug: WUS: Processing device-adapter for Zonkracht: Solar radiation device adapter
2018-04-23 09:52:49.497 dzVents: Debug: WUS: Processing device-adapter for Rain: Rain device
2018-04-23 09:52:49.498 dzVents: Debug: WUS: Processing device-adapter for Temp_Hum: Temperature+humidity device adapter
2018-04-23 09:52:49.499 dzVents: Debug: WUS: Processing device-adapter for Voorspelling: Text device
2018-04-23 09:52:49.500 dzVents: Debug: WUS: Processing device-adapter for RainForecast_2h: Custom sensor device adapter
2018-04-23 09:52:49.500 dzVents: Debug: WUS: Processing device-adapter for Regenwaarschuwing: Alert sensor adapter
2018-04-23 09:52:49.501 dzVents: Debug: WUS: Processing device-adapter for Regenvoorspeld: Switch device adapter
2018-04-23 09:52:49.502 dzVents: Debug: WUS: Meetstation IJmuiden found
2018-04-23 09:52:49.502 dzVents: Info: WUS: -------------------------------------------------------------------------------------------------------------------------------------------------
2018-04-23 09:52:49.502 dzVents: Debug: WUS: Barometer is of type: Barometer
2018-04-23 09:52:49.502 dzVents: Error (2.4.4): WUS: An error occured when calling event handler updateWeatherSensors_ori
2018-04-23 09:52:49.502 dzVents: Error (2.4.4): WUS: ...icz/scripts/dzVents/scripts/updateWeatherSensors_ori.lua:409: attempt to concatenate a nil value
2018-04-23 09:52:49.502 dzVents: Info: WUS: ------ Finished updateWeatherSensors_ori.lua
2018-04-23 09:52:49.502 EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
------------------------------
I cannot find what is wrong; do you have a suggestion what might be the problem?
I run Domoticz V3.9208 on a Pi3B, booting from an SSD.

User avatar
waaren
Posts: 1226
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 23 April 2018 10:42

Bufoto wrote:
Monday 23 April 2018 10:04
Hi Waaren,

I installed it and it works fine for Rotterdam and Schiphol.
But when I use IJmuiden or Wijk aan Zee I get an error message:
------------------------------
I cannot find what is wrong; do you have a suggestion what might be the problem?

The problem starts with that this weather station does not provide a value for "luchtdruk" (barometer)
Having said that the script should check that and at least present you with a message when LOG_DEBUG is active.

I will post an update later today with this and other checks and more user controllable settings.
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

Bufoto
Posts: 12
Joined: Thursday 10 November 2016 22:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Bufoto » Monday 23 April 2018 11:15

Hi Waaren,
thanks for your quick reply.
The strange thing is that the Buienradar site does give the 'Luchtdruk': https://www.buienradar.nl/weer/ijmuiden/nl/2753376
I will wait for your update and test it again.

User avatar
waaren
Posts: 1226
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 23 April 2018 12:34

Bufoto wrote:
Monday 23 April 2018 11:15
...
The strange thing is that the Buienradar site does give the 'Luchtdruk': https://www.buienradar.nl/weer/ijmuiden/nl/2753376
...
@Bufoto, I get the data to feed into the script from https://api.buienradar.nl/data/public/1.1/jsonfeed
For IJmuiden it returns

"@id": "6225",
"stationcode": "6225",
"stationnaam": {
"@regio": "IJmuiden",
"#text": "Meetstation IJmuiden"
},
"lat": "52.47",
"lon": "4.57",
"datum": "04/23/2018 11:10:00",
"luchtvochtigheid": "-",
"temperatuurGC": "-",
"windsnelheidMS": "6.82",
"windsnelheidBF": "4",
"windrichtingGR": "240",
"windrichting": "WZW",
"luchtdruk": "-",
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

Bufoto
Posts: 12
Joined: Thursday 10 November 2016 22:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Bufoto » Monday 23 April 2018 13:47

@Waaren: Strange that the info is available on the buienradar website, but omitted in the jsonfeed.
I will send them a message and ask them if they can add that data in the feed.

User avatar
waaren
Posts: 1226
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 23 April 2018 18:40

New version available; see first post here Latest version 0.20180423

Some additional user specific settings. Both files (main code and user settings) are in the attached zip
Added experimental Lux (based on Solar Power) this one still need a lot of work so do not rely on it.
Execution frequency controlled by user settings. Read the comments in the usersetting file


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
20180420 Day-/night frequency now controlled by user-setting
20180423 Added experimental lux based on Solar Power
20180423 Added checks on empty returns
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: 1382
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 23 April 2018 20:14

Thanks again. Like the Lux stuff, so I hope it will stay in.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | RFxcom | Dashticz V2

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest