As far as I can tell it also makes contains your blockly, lua and dzVents you've made inside Domoticz.
Is it gonna rain within the next X minutes?
Moderator: leecollings
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Blockly and LUA I knew when using the internal editor, so guess you also mean the DzVents script done with the internal Editor, as they are saved into the domoticz.db as well. I am using only the separate files in the LUA directory and those aren't backed up. Assume the same counts for when using DzVents scripts in the directory structure.
Jos
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Re: Is it gonna rain within the next X minutes?
@jvdz I would like to use your script. However it is not very clear to me where to put the code.
It seems there are two blocks with "config"-code. Should I put all this in the crontab too, or should I put it somewhere else. ?
It seems there are two blocks with "config"-code. Should I put all this in the crontab too, or should I put it somewhere else. ?
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
@curious, the filename is shown on line 4 of the script which shows the crontab schedule and shells file: /home/pi/domoticz/scripts/buienradar_rainprediction.lua
You basically can store it anywhere you like and make the change in the crontab line.
So all you need to do is :
1. Create a file called buienradar_rainprediction.lua
2. copy & paste the code into this file
3. Edit this section at the top and fill in your information:
4. Save the file
5. test the file by running it: lua buienradar_rainprediction.lua
6. start crontab and add a line like this:
You should be in business. Just check BRP.log for issues.
Jos
You basically can store it anywhere you like and make the change in the crontab line.
So all you need to do is :
1. Create a file called buienradar_rainprediction.lua
2. copy & paste the code into this file
3. Edit this section at the top and fill in your information:
Code: Select all
-- config ---------------------------------------------------------
lat='5?.??'
lon='4.??'
-- use information for the next xx minutes
minutesinfuture=15
-- Domoticz server url
domoticzurl="http://192.168.0.??:8080"
-- rain device
DEVIDX=???
-- General Percentage device
PDEVIDX=???
-- set to true or false
debug=true
-- set to the appropriate tmp path
tempfilename = '/var/tmp/rain.tmp' -- can be anywhere writeable
-- config ---------------------------------------------------------
5. test the file by running it: lua buienradar_rainprediction.lua
6. start crontab and add a line like this:
Code: Select all
*/5 * * * * sudo lua /home/pi/domoticz/scripts/buienradar_rainprediction.lua >> /var/tmp/BRP.log
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Re: Is it gonna rain within the next X minutes?
@Jos
Thanks for your quick response. Seems to work, but no rain is expected tonight
Thanks for your quick response. Seems to work, but no rain is expected tonight
-
- Posts: 53
- Joined: Tuesday 11 August 2015 14:20
- Target OS: NAS (Synology & others)
- Domoticz version: 2.2903
- Location: The Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Quick question: Why do I get this error in the log?
Error: EventSystem: in script_time_rain: [string "---------------------------------------------..."]:89: expected near 'local'
Thanks!
JB
Error: EventSystem: in script_time_rain: [string "---------------------------------------------..."]:89: expected near 'local'
Thanks!
JB
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
You will have to show your complete script as it seems to have an issue with line 89.
Jos
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 53
- Joined: Tuesday 11 August 2015 14:20
- Target OS: NAS (Synology & others)
- Domoticz version: 2.2903
- Location: The Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Sorry Jos
Here it is:
Here it is:
- Spoiler: show
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Looks like you have copied multiple scripts together and have an extra "return commandArray" on line 87. It also contains multiple commandArray = {} statements. Just group your Functions together at the top and put your logic together within the If as assume you want to do this only one time each 15 minutes?
EDIT: The script also contains 2 times the same function IsItGonnaRain(minutesinfuture) with different content!
Jos
EDIT: The script also contains 2 times the same function IsItGonnaRain(minutesinfuture) with different content!
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 53
- Joined: Tuesday 11 August 2015 14:20
- Target OS: NAS (Synology & others)
- Domoticz version: 2.2903
- Location: The Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
After reading the wiki (http://www.domoticz.com/wiki/Is_it_gonna_rain) I thought that both scripts should be in one LUA script....
Now I have two scripts and it seems to work!
Thanks Jos!
Now I have two scripts and it seems to work!
Thanks Jos!
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
You can merge them together when you want, but that means you need to modify the code so it will work as one.
Jos
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 53
- Joined: Tuesday 11 August 2015 14:20
- Target OS: NAS (Synology & others)
- Domoticz version: 2.2903
- Location: The Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Well I am not a star in modifying code , so lets leave it like this
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Is it gonna rain within the next X minutes?
Now I have been working again on this, and was going to use your script, Jos, but
Any clue's?
Doesn't seem to work on Synology, And somehow the other scripts, won't work either6. start crontab and add a line like this:
*/5 * * * * sudo lua /home/pi/domoticz/scripts/buienradar_rainprediction.lua >> /var/tmp/BRP.log
Any clue's?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
What does the BRP.LOG tell you?
Does the same command work from the command prompt?
Jos
Does the same command work from the command prompt?
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Is it gonna rain within the next X minutes?
Doesn't tell anything. Doesn't run at all.
It's clear, can't run lua from Synology terminal. Time to get another Pi..@DiskStation:/var/tmp# sudo lua /var/scripts/buienradar_rainprediction.lua >> /var/tmp/BRP.log
sudo: lua: command not found
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
or maybe just install LUA ?
Jos
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Is it gonna rain within the next X minutes?
Not sure if that is possible
Edit: Guess it can Just finished the downloading/installing of it. Now back to the movie
Btw. This is in the log file
Edit: Guess it can Just finished the downloading/installing of it. Now back to the movie
Btw. This is in the log file
Still not running from crontabhttp://gadgets.buienradar.nl/data/raint ... 6&lon=4.41
Rain in timerange: 0 Total rain now: 0 difference:180 Line:000|20:50
Rain in timerange: 0 Total rain now: 0 difference:480 Line:000|20:55
Rain in timerange: 57 Total rain now: 57 difference:780 Line:057|21:00
Sun Nov 5 20:47:20 2017 averagerain:19 calcmmh:0
http://192.168.0.10:8084/json.htm?type= ... svalue=0;0
1792
http://192.168.0.10:8084/json.htm?type= ... value=7.45
1792
==> Rain chance: 7.45%
*/5 * * * * root sudo lua /var/scripts/buienradar_rainprediction.lua >> /var/tmp//BRP.log
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
-
- Posts: 10
- Joined: Tuesday 07 November 2017 21:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Is it gonna rain within the next X minutes?
Using the script as (for example) shown in this post: viewtopic.php?f=38&t=5903&p=155037&hili ... in#p148937 the 'DEVIDX' sensor is always filled with two numbers separated by a ';' and the two numbers are always equal. What's the purpose of that?
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 10
- Joined: Tuesday 07 November 2017 21:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Is it gonna rain within the next X minutes?
Thanks for your quick reply. In the meantime I figured out myself it has to do with this line: I did take a look at your wiki reference but I don't understand what the RAINCOUNTER value as shown on the wiki is supposed to mean.
Code: Select all
url=domoticzurl..'/json.htm?type=command¶m=udevice&idx=' .. DEVIDX .. '&nvalue=0&svalue=' .. calcmmh .. ';' .. calcmmh
Who is online
Users browsing this forum: No registered users and 1 guest