updateWeatherSensors (yet another buienradar script)  [SOLVED]

Moderator: leecollings

User avatar
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)

Post by waaren »

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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes »

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 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Bufoto
Posts: 4
Joined: Thursday 10 November 2016 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by Bufoto »

Version 2018-04-24 works fine for me! Thanks!
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG »

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 :?:
User avatar
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)

Post by waaren »

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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes »

Here latest script is also working dzVents 2.4.4 / Rasbian Stretch
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG »

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
User avatar
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)

Post by waaren »

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 )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG »

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.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes »

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 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
User avatar
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)

Post by waaren »

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 .
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes »

EDIT: removed the lines myself
Last edited by poudenes on Saturday 28 April 2018 22:09, edited 1 time in total.
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG »

Is not this the same crash from the latest beta. See section Bugs.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by poudenes »

Yes i see it also. Sorry for the post ... :mrgreen:
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
User avatar
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)

Post by waaren »

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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: updateWeatherSensors (yet another buienradar script)

Post by EddyG »

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.
User avatar
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)

Post by waaren »

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
Device screen filtered on text Rotetrdam
Device screen filtered on text Rotetrdam
devicesScreen.PNG (102.44 KiB) Viewed 3091 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
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)

Post by waaren »

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 !
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
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)

Post by EdwinK »

Thanks. Trying out again :)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
DannyG
Posts: 3
Joined: Tuesday 17 April 2018 22:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: updateWeatherSensors (yet another buienradar script)

Post by DannyG »

Looks / works great
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest