buienradar lua script

Moderator: leecollings

User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Ok...that sounds all fine to me so far.
The script should be triggered every minute at the start of the new minute. Every 5 minutes it should actually do something, so do you see anything in de domoticz log page about that?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

in the LOG i see allmost every 5 minutes:

2020-06-26 19:35:00.142 Status: LUA: BuienRadar module

most recent:


2020-06-26 23:15:00.056 Status: LUA: BuienRadar module
2020-06-26 23:15:00.323 Error: EventSystem: in Buienradar: [string "-- BuienRadar Module ..."]:121: attempt to index a nil value (field '?')
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Ok... now we are getting somewhere. :)
Assuming this is line 121:

Code: Select all

			local rainTot = tonumber(otherdevices_svalues[myBuienRadarMeter]:match("[^;]+;([^;]+)")) + rainNowAvg / 12 -- /12 to acount for 5min measurements ?? ..
My guess is that this device name is wrong:

Code: Select all

local myBuienRadarMeter = 'BuienRadarMeter'
Is this the exact spelling of the name ? Also considering Caps and lowercase characters?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Hello, thanks for helping (again):

When i go to devices i see the next name:

144 Virtueel 140E0 1 BuienRadarMeter Rain TFA

When i open the LOG of this device it looks like it checked for rain, i see an grap which shows rain on 22-06

So it looks allright to me?!

In the script it says the following at line 121:

local rainTot = tonumber(otherdevices_svalues[myBuienRadarMeter]:match("[^;]+;([^;]+)")) + rainNowAvg/12 -- /12 to acount for 5min measurements ?? ..

Do i have to rename it to: myBuienRadarMeter ?
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

No that is the name of the variable (red)!
local myBuienRadarMeter = 'BuienRadarMeter'

I have just copied your script in my VM test domoticz and setup the 3 devices as you mentioned.... and all is running nicely without any issues or errors.
the BuienRadarMeter updates nicely each 5 minutes and the others (Switch/Text) will only update when the script has another value for them.
brd.jpg
brd.jpg (16.77 KiB) Viewed 1762 times
What is the value of the Device?
brd2.jpg
brd2.jpg (5.45 KiB) Viewed 1759 times
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Thanks!!
I see there.s an "0".
Last seen in yesterday.
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Not sure what you are telling me now... or answered my question? ;)
That device should update each 5 minutes and in the device view should contain information like I shown.
Is that the case?

Jos

PS: One other "stab in the dark": You do only have 1 device with that name right and not accidentally created 2 devices with the same name?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Sorry :-)

When i go to devices (filter on 'buien')

I see:

https://www.flickr.com/photos/186210101 ... /datetaken

Image
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Oepsie...

Now i see flgbuienradar was OFF ....should that be the problem?

What i did:

As an ON action at the switch flgbuienradar it does:

http://192.168.1.154:8080/json.htm?type ... tchcmd=Off

So.it should.turn OFF the device 148 (my zwave sunscreen switch)

Edit: i see the mentionend command was ON, but that wasn.t correct.
When i give the OFF command the screen goes out, when i give the ON command the screen goes in.

So now everything should be wright i think
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

You posted image indicates that the update of device "BuienRadarMeter" doesn't happen each 5 minutes... so that is wrong!
Joske wrote: Saturday 27 June 2020 11:57 Oepsie...
Now i see flgbuienradar was OFF ....should that be the problem?
No ... that switch is set by the script!

So .. back to the problem. Are you still getting that error in the log each 5 minutes as we haven't found that issue yet?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

I think it works!
This is what the LOG says:

2020-06-27 12:25:00.057 Status: LUA: BuienRadar module
2020-06-27 12:25:04.426 Status: EventSystem: Script event triggered: Buienradar
2020-06-27 12:30:00.114 Status: LUA: BuienRadar module
2020-06-27 12:30:00.236 Status: EventSystem: Script event triggered: Buienradar

All green !

I think it was all about the mistake within the ON action of the switch: i have to give an OFF command to close the screen.

I don.t have an "0" anymore but "0;0.18"

Thanks to you i know know that everyting is like it should be and theres no information in the log of the txt file if theres no change.

I will test it, thanks...also.for your patience :-)
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Joske wrote: Saturday 27 June 2020 12:33 I think it works!
-snip
Ok ... nice, well, when device 'BuienRadarMeter' is updated each 5 minutes you should be good!
Joske wrote: Saturday 27 June 2020 12:33 I will test it, thanks...also.for your patience :-)
.... and no worries. ;)
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

:D

Have a nice weekend !
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Because it now works, another short question ;-)

Is it possible to use the lattitude / longtitude thats been used within the Domoticz settings?
Within Domoticz you van give a more accurate position then you can within this LUA, like 5.2737338 in stead of only 5.27 for example.

That would be nice.

Thanks
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Doubt buienradar will have that kind of accuracy in their data, as you are talking about approx 600 meters difference between 52.010 and 52.019. ;)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Oh, thats realy a very small difference, didn.t know that :-)

Thanks
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Just open google maps and type lat,lon in the searchbar and the location will be pinned. then make the change with the extra digits and check the difference with the first one. 8-)

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

And another one ;-)..

I see Buienradar can deliver 'windage information' .
For an sunscreen its allmost even relevant, maybe even more, that it goes in by an X strenght of windage.

Should that be an nice addition?

Maybe this one can do the trick? V

https://www.domoticz.com/forum/viewtopic.php?t=25207

Greetz
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: buienradar lua script

Post by jvdz »

Have you tried simply using the internal available option for Buienradar to get that information when running the latest version of Domoticz?
These devices are generated when you Add the Hardware "BuienRadar":
buienradar.jpg
buienradar.jpg (113.63 KiB) Viewed 1559 times
As you can see, there is also a Wind sensor there and you can use that data to retrieve the windspeed and windgustspeed :

Code: Select all

sDirectionDegrees, sDirection, sSpeed, sGust, sTemperature, sFeel = otherdevices_svalues['Wind']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: buienradar lua script

Post by Joske »

Hi! No i did not, not for windage.

I started with this Buienradar and used 'Expected rain' but that did.t work good.
(this: https://www.domoticz.com/wiki/Buienradar )

Thats why i wanted to use the LUA.
It should be nice if the LUA was 100% complete, so the windage is integrated.

But i can take a look if this works okay for windage.

What i'm wondering;
When i use Buienradar i have to configure Rain Threshold and Rain Forecast, but i am using this LUA for rain.
What should i use as parameter, set it to 0 of 255 (bullshit settings to be sure it doesn't influence the working of the LUA), because i only want the LUA let decide if its raining or not, the earlier mentioned settings didn't work accurate for me for rain predication.

EDIT:
What i did so far:
I added Buienradar (with correct longtitude/lattitude and 'fake' settings like ' 9999 ' for Rain Treshold).
I added the sensor (device) 'Wind' .
Because its not an ON/OFF switch i can't simply give an trigger when it goes on (like: http://192.168.1.154:8080/json.htm?type ... itchcmd=On) just like the 'flgbuienradar' does for rain.

I think i have to make an Blockly then, is see i can choose for WIND so it should work. I will use 10m/s for windage as trigger.
The only question about that: what do i have to choose as setting for WIND?

IF > WIND = ??????
Do > Sunscreen ON/OFF

Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest