updateWeatherSensors (yet another buienradar script)

User avatar
waaren
Posts: 1350
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 24 April 2018 8:32

New version available (bugfix) ; see first post here Latest version 0.20180424

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

20180424 Rainforecast bugfix and improved lux forecast
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: 623
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 24 April 2018 10:19

Nice !!! we gonna install it, test it, be happy with it !
waaren wrote:
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
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

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 » Tuesday 24 April 2018 12:09

Version 2018-04-24 works fine for me! Thanks!

User avatar
EddyG
Posts: 328
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.9999
Location: Rhenen, Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG » Friday 27 April 2018 19:14

I can not figure out why this does NOT work.

Code: Select all

    local function getUservars()
       require ('weatherSettings')
    end

    if not(pcall(getUservars)) then
But only this WORKS!

Code: Select all

require ('weatherSettings')
Anybody any idea :?:
Regards,
Eddy

User avatar
waaren
Posts: 1350
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 27 April 2018 22:45

Hi EddyG,

It works with my version of dzVents (2.4.5) and on my OS (Debian stretch)


Could you add this

Code: Select all

    if true then
       local status, err = pcall(getUservars)
        print(err) 
        return
    end 
    
directly after

Code: Select all

local function getUservars()
       require ('weatherSettings')
    end
And check if you see any message in the domoticz log ? If not standard then after switch the script and dzVents into debug mode ?

Don't forget to remove this code afterwards :D
Last edited by waaren on Saturday 28 April 2018 8:35, edited 2 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

poudenes
Posts: 623
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 » Friday 27 April 2018 22:58

Here latest script is also working dzVents 2.4.4 / Rasbian Stretch
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
EddyG
Posts: 328
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.9999
Location: Rhenen, Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG » Saturday 28 April 2018 9:47

I raised dzVents logging to debug and put in:

Code: Select all

err = pcall(getUservars)
print(err)
print("OK")
The logging only shows:

Code: Select all

2018-04-28 09:44:00.667 dzVents: Info: WUS: ------ Start external script: updateWeatherSensors.lua:, trigger: every minute
2018-04-28 09:44:00.668 dzVents: OK
2018-04-28 09:44:00.682 dzVents: Info: WUS: ------ Finished updateWeatherSensors.lua
So the codes gets to the OK, but the return of the pcall seems to be nothing. I am using lua 5.2
Regards,
Eddy

User avatar
waaren
Posts: 1350
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 28 April 2018 11:38

EddyG wrote:
Saturday 28 April 2018 9:47
I raised dzVents logging to debug and put in:

Code: Select all

err = pcall(getUservars)
print(err)
print("OK")
The logging only shows:

Code: Select all

2018-04-28 09:44:00.667 dzVents: Info: WUS: ------ Start external script: updateWeatherSensors.lua:, trigger: every minute
2018-04-28 09:44:00.668 dzVents: OK
2018-04-28 09:44:00.682 dzVents: Info: WUS: ------ Finished updateWeatherSensors.lua
So the codes gets to the OK, but the return of the pcall seems to be nothing. I am using lua 5.2
@EddyG,

what you have put in, is something different than what I proposed. The pcall can return two values and you interpret only one.
Can you please put in the code snippet I proposed ?

What do you mean with Lua 5.2 ?
As far as I understand dzVents use the Lua integrated with domoticz but I could be wrong (Would not be the first time either :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

User avatar
EddyG
Posts: 328
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.9999
Location: Rhenen, Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG » Saturday 28 April 2018 13:08

I tried everything, including your code, but the pcall returns nothing.

Code:

Code: Select all

print(tostring(status).." - "..tostring(err))
Result:

Code: Select all

2018-04-28 13:07:01.318 dzVents: true - nil
2018-04-28 13:07:01.318 dzVents: OK
This is some code I found on the Internet about pcall

Code: Select all

function f()
  return 'some text'
end

local status, res = pcall(f)
if pcall succeeded, status is true and res is the return value of f().
if pcall failed, status is false and res is the error message.
About Lua version. I thought it was external.
Regards,
Eddy

poudenes
Posts: 623
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 » Saturday 28 April 2018 18:36

I was scream to fast. I see now 3 times a fatal error pop up. Don't know if this is because of last release of script or just 1 plugin i installed.
Im now testing some things....
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
waaren
Posts: 1350
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 28 April 2018 20:37

poudenes wrote:
Saturday 28 April 2018 18:36
I was scream to fast. I see now 3 times a fatal error pop up. Don't know if this is because of last release of script or just 1 plugin i installed.
Im now testing some things....
@poudenes,
can you please post the fatal errors. If possible I will try to catch these and handle them gracefully in later versions .
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: 623
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 » Saturday 28 April 2018 20:56

EDIT: removed the lines myself
Last edited by poudenes on Saturday 28 April 2018 22:09, edited 1 time in total.
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
EddyG
Posts: 328
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.9999
Location: Rhenen, Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG » Saturday 28 April 2018 21:59

Is not this the same crash from the latest beta. See section Bugs.
Regards,
Eddy

poudenes
Posts: 623
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 » Saturday 28 April 2018 22:08

Yes i see it also. Sorry for the post ... :mrgreen:
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
waaren
Posts: 1350
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 28 April 2018 22:13

poudenes wrote:
Saturday 28 April 2018 20:56
You ask i got the error again:
@poudenes,

this segmentation fault is caused by one of the pull requests from github that were merged into Beta earlier today. It has already been reported at this forum and on github here .

Nothing related to dzVents or my script.
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
EddyG
Posts: 328
Joined: Monday 02 November 2015 6:54
Target OS: Raspberry Pi
Domoticz version: 4.9999
Location: Rhenen, Netherlands
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG » Monday 30 April 2018 12:48

It might be an idea to separate the "Wind+Temp+Chill" device in 2 devices "Wind" and "Chill Temp"
The "Wind+Temp+Chill" is also separated in 2 devices but those have the same name.
So if I call it "Wind" then that device is present on the Temperature an Weather tab with the same name.
Just an idea.
Regards,
Eddy

User avatar
waaren
Posts: 1350
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 30 April 2018 21:43

Hi EddyG,

not quite sure what you propose. The "wind" device is already shown on both the temperature and the weather tab. If I mis-interpret your suggestion please let me know.
Attachments
devicesScreen.PNG
Device screen filtered on text Rotetrdam
devicesScreen.PNG (102.44 KiB) Viewed 1389 times
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: 1350
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 30 April 2018 22:42

New versions posted here Latest version 0.20180430

Use of setting file mandatory now.
Please find detailed information / explanation in files

History since last posting
======================
20180425 Bug in updating rain-rate after forcedUpdateMinutes fixed (did not update when equal)
20180425 Prepared language choice
20180427 Added more translations
20180427 Added 5 and 10 day forecast device and information
20180429 Setting file mandatory now
20180429 Finished translations
20180429 Added location retrieval from domoticz settings
20180430 Adjusted Lux calculation

Have Fun !
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: 1404
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 30 April 2018 23:18

Thanks. Trying out again :)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | RFxcom | Dashticz V2

DannyG
Posts: 3
Joined: Tuesday 17 April 2018 22:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by DannyG » Monday 30 April 2018 23:32

Looks / works great

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest