Is it gonna rain within the next X minutes?

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
poudenes
Posts: 473
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Is it gonna rain within the next X minutes?

Post by poudenes » Wednesday 24 January 2018 13:33

Hi All,

no matter what i do i get a error

Code: Select all

2018-01-24 12:31:00.305  LUA: http://gadgets.buienradar.nl/data/raintext/?lat=52.06&lon=4.39
2018-01-24 12:31:00.420  Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_raintext.lua: /home/pi/domoticz/scripts/lua/script_time_raintext.lua:14: attempt to index global 'file' (a nil value)
How can i solve this?

output of the http link:

Code: Select all

000|12:30
000|12:35
000|12:40
000|12:45
000|12:50
000|12:55
000|13:00
000|13:05
000|13:10
000|13:15
000|13:20
000|13:25
000|13:30
000|13:35
000|13:40
000|13:45
000|13:50
000|13:55
000|14:00
000|14:05
000|14:10
000|14:15
000|14:20
000|14:25
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

Mace
Posts: 77
Joined: Monday 21 August 2017 19:52
Target OS: Windows
Domoticz version: 3.8153
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by Mace » Sunday 28 January 2018 10:42

mvroosmalen wrote:
Tuesday 23 January 2018 8:51
He mace,
In that case change then commandArray['SendNotification']=....... to code to only send to for example pushbullet or change settings.

s6

Mark
Thanks Mark, I however have no clue on how to doe that... ;)

mvroosmalen
Posts: 19
Joined: Saturday 03 December 2016 17:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by mvroosmalen » Sunday 28 January 2018 12:05

Hi Mace,

Google is your friend :-)..... viewtopic.php?t=8231
create a bash file pushbullet.sh:

Code: Select all

#!/bin/bash
api=<Put_Your_API_KEY_HERE>
title=$1
body=$2
curl -u $api: https://api.pushbullet.com/v2/pushes -d type=note -d title=$title -d body=$body
and in the script:

Code: Select all

os.execute('/home/pi/domoticz/scripts/pushbullet.sh "Rain alert" "blabla......."')
or directly use this as a HTML code in the script...

s6 Mark

bobke77
Posts: 2
Joined: Wednesday 10 January 2018 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by bobke77 » Tuesday 30 January 2018 14:07

Hi,

SInce I'm new here (or call me NOOB :D ) I just used the script as mentioned in the start post.

On my dashboard I get the text message : Regen verwacht, so the text file seems to be working (took me some time to figure out I had to use the chmod 0666).

Now I've got one problem: When I look in the Log it says:

2018-01-30 12:57:00.239 LUA: -- Regen verwacht(0-255 hoe hoger hoe meer regen): nan binnen 15 minuten.

Looking further iI notice that in the /var/tmp/ folder I can't open the rain.tmp file

It says: Object moved, this document can be found here
Then I get forwarded in Chromium and I can see the values.

How can I solve this ?

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

Re: Is it gonna rain within the next X minutes?

Post by poudenes » Tuesday 30 January 2018 22:33

Does someone have at the full script for me that work on dzVents 2.4.0?
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

mickmack82
Posts: 1
Joined: Wednesday 31 January 2018 16:04
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by mickmack82 » Wednesday 31 January 2018 16:09

bobke77 wrote:
Tuesday 30 January 2018 14:07
Hi,

SInce I'm new here (or call me NOOB :D ) I just used the script as mentioned in the start post.

On my dashboard I get the text message : Regen verwacht, so the text file seems to be working (took me some time to figure out I had to use the chmod 0666).

Now I've got one problem: When I look in the Log it says:

2018-01-30 12:57:00.239 LUA: -- Regen verwacht(0-255 hoe hoger hoe meer regen): nan binnen 15 minuten.

Looking further iI notice that in the /var/tmp/ folder I can't open the rain.tmp file

It says: Object moved, this document can be found here
Then I get forwarded in Chromium and I can see the values.

How can I solve this ?
Try to add the -L paramter in the curl command: read = os.execute('curl -L -s -o '..tempfilename..' "'..url..'"')
This enable follow redirects using the location header flag

bobke77
Posts: 2
Joined: Wednesday 10 January 2018 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by bobke77 » Wednesday 31 January 2018 16:26

mickmack82 wrote:
Wednesday 31 January 2018 16:09
Try to add the -L paramter in the curl command: read = os.execute('curl -L -s -o '..tempfilename..' "'..url..'"')
This enable follow redirects using the location header flag
That's the one !
I had already changed this, but made it -s -o -L instead of -L -s -o :lol: :lol:

Many thanks mickmack !!!!!

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

Re: Is it gonna rain within the next X minutes?

Post by poudenes » Wednesday 31 January 2018 16:38

the -L parameter also solved my NIL problem :)
RPi3 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

User avatar
EdwinK
Posts: 1185
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by EdwinK » Wednesday 31 January 2018 17:17

Now noticing an error regarding

Code: Select all

2018-01-31 16:09:12.436 Error: EventSystem: in Regen: [string "---------------------------------------------..."]:27: module 'socket.http' not found:
no field package.preload['socket.http']
no file '/usr/local/share/lua/5.2/socket/http.lua'
no file '/usr/local/share/lua/5.2/socket/http/init.lua'
no file '/usr/local/lib/lua/5.2/socket/http.lua'
no file '/usr/local/lib/lua/5.2/socket/http/init.lua'
no file './socket/http.lua'
no file '/usr/local/lib/lua/5.2/socket/http.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket/http.so'
no file '/usr/local/lib/lua/5.2/socket.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket.so'
Didn't check often so don't know when this started to happen. Thought I had to do a sudo apt-get install socket.http, but that doesn't seem to work.

Now what?
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

mvroosmalen
Posts: 19
Joined: Saturday 03 December 2016 17:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by mvroosmalen » Wednesday 31 January 2018 20:52

You need to install the socket library and supporting code somewhere that Lua 5.2 can find.

It is explained on this page http://www.domoticz.com/wiki/Philips_Hu ... ng_Colours and the necassary supporting libraries are attached to the linked forum message.

Mark

User avatar
EdwinK
Posts: 1185
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by EdwinK » Thursday 01 February 2018 10:27

But it used to work
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

User avatar
jvdz
Posts: 1316
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Is it gonna rain within the next X minutes?

Post by jvdz » Thursday 01 February 2018 12:50

EdwinK wrote:
Thursday 01 February 2018 10:27
But it used to work
.. and then the next line should read: "and I haven't changed anything".. right? :D
In general these things happen when you either initially do an install or changed things on your system.

Jos

User avatar
EdwinK
Posts: 1185
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by EdwinK » Thursday 01 February 2018 14:57

jvdz wrote:
Thursday 01 February 2018 12:50
EdwinK wrote:
Thursday 01 February 2018 10:27
But it used to work
.. and then the next line should read: "and I haven't changed anything".. right? :D
In general these things happen when you either initially do an install or changed things on your system.

Jos
Almost ;) But I'm getting the hint.
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

User avatar
EdwinK
Posts: 1185
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by EdwinK » Sunday 11 February 2018 19:06

Still no luck :(
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

mvroosmalen
Posts: 19
Joined: Saturday 03 December 2016 17:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by mvroosmalen » Sunday 11 February 2018 19:59

still about the socket?? Please list the files found in /usr/local/share/lua/5.2 and dir below. It should list all the needed files...

User avatar
EdwinK
Posts: 1185
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by EdwinK » Monday 12 February 2018 11:05

Nope, this time it's the following.

Code: Select all

2018-02-12 10:03:00.440 Error: EventSystem: in Regen: [string "---------------------------------------------..."]:45: attempt to call global 'UrlEncode' (a nil value)
2018-02-12 10:04:00.360 Error: EventSystem: in Regen: [string "---------------------------------------------..."]:45: attempt to call global 'UrlEncode' (a nil value)
Had to look it up again, as I was trying several different scripts at different times.
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

User avatar
EdwinK
Posts: 1185
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is it gonna rain within the next X minutes?

Post by EdwinK » Monday 12 February 2018 11:19

And also this still

./buienradar.py
Traceback (most recent call last):
File "./buienradar.py", line 23, in <module>
import ssl
File "/usr/local/lib/python3.5/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: No module named '_ssl'

domoticz@domo-server:/usr/local/share/lua/5.2 $ ls
ansicolors.lua luacolors.lua mobdebug.lua socket.lua
ltn12.lua mime.lua socket
Running latest BETA on a Pi-3 | Toon Thermostat | RFxcom | Dashticz V2 |

mvroosmalen
Posts: 19
Joined: Saturday 03 December 2016 17:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Is it gonna rain within the next X minutes?

Post by mvroosmalen » Monday 12 February 2018 12:59

Hi Edwin,

You miss the relevant files in /usr/local/share/lua/5.2. It should list:
socket
ssl
ansicolors.lua
JSON.lua
ltn12.lua
luacolors.lua
mime.lua
mobdebug.lua
socket.lua
ssl.lua

you could reinstall...

Mark

Venzent
Posts: 29
Joined: Sunday 15 April 2018 13:00
Target OS: Raspberry Pi
Domoticz version: 3.8153
Contact:

Re: Is it gonna rain within the next X minutes?

Post by Venzent » Wednesday 30 May 2018 20:56

I had this script previous and it was running fine. Re-installed Domoticz and did create this script again, but it just won't run.
Created a dummy switch "Rain expected"
Copy-pasted the script in the eventsystem and added my lat and lon (52.39 and 5.30).
Created the /var/tmp/rain.tmp file and chmodded it to 0777.
Sometimes when fiddling around I see it trigger once after changing or re-creating the script, but only once, the next minute is not triggered.
Currently it is not triggered at all.
I saved the script as Rain expected, type Lua and trigger Time. The script is activated and under settings, other, Event system "not active" is not checked....
Any thoughts?

Venzent
Posts: 29
Joined: Sunday 15 April 2018 13:00
Target OS: Raspberry Pi
Domoticz version: 3.8153
Contact:

Re: Is it gonna rain within the next X minutes?

Post by Venzent » Wednesday 30 May 2018 21:09

Venzent wrote:
Wednesday 30 May 2018 20:56
I had this script previous and it was running fine. Re-installed Domoticz and did create this script again, but it just won't run.
Created a dummy switch "Rain expected"
Copy-pasted the script in the eventsystem and added my lat and lon (52.39 and 5.30).
Created the /var/tmp/rain.tmp file and chmodded it to 0777.
Sometimes when fiddling around I see it trigger once after changing or re-creating the script, but only once, the next minute is not triggered.
Currently it is not triggered at all.
I saved the script as Rain expected, type Lua and trigger Time. The script is activated and under settings, other, Event system "not active" is not checked....
Any thoughts?
I just enabled debugging and after 3 minutes i see this, so it did run (once), but now 5 minutes later, it didn't run again.
2018-05-30 21:00:00.532 dzVents: https://gadgets.buienradar.nl/data/rain ... 9&lon=5.30
2018-05-30 21:00:00.896 dzVents: Line:000|21:00
2018-05-30 21:00:00.896 dzVents: Linetime: 21:00
2018-05-30 21:00:00.896 dzVents: 0
2018-05-30 21:00:00.896 dzVents: Line:000|21:05
2018-05-30 21:00:00.896 dzVents: Linetime: 21:05
2018-05-30 21:00:00.896 dzVents: 300
2018-05-30 21:00:00.896 dzVents: Line in time range found
2018-05-30 21:00:00.896 dzVents: Rain in timerange: 0
2018-05-30 21:00:00.896 dzVents: Total rain now: 0
2018-05-30 21:00:00.896 dzVents: Line:000|21:10
2018-05-30 21:00:00.896 dzVents: Linetime: 21:10
2018-05-30 21:00:00.897 dzVents: 600
2018-05-30 21:00:00.897 dzVents: Line in time range found
2018-05-30 21:00:00.897 dzVents: Rain in timerange: 0
2018-05-30 21:00:00.897 dzVents: Total rain now: 0
2018-05-30 21:00:00.897 dzVents: Line:000|21:15
2018-05-30 21:00:00.897 dzVents: Linetime: 21:15
2018-05-30 21:00:00.897 dzVents: 900
2018-05-30 21:00:00.897 dzVents: Line in time range found
2018-05-30 21:00:00.897 dzVents: Rain in timerange: 0
2018-05-30 21:00:00.897 dzVents: Total rain now: 0
2018-05-30 21:00:00.897 dzVents: Line:000|21:20
2018-05-30 21:00:00.897 dzVents: Linetime: 21:20
2018-05-30 21:00:00.897 dzVents: 1200
2018-05-30 21:00:00.897 dzVents: Line in time range found
2018-05-30 21:00:00.897 dzVents: Rain in timerange: 0
2018-05-30 21:00:00.897 dzVents: Total rain now: 0
2018-05-30 21:00:00.897 dzVents: Line:000|21:25
2018-05-30 21:00:00.897 dzVents: Linetime: 21:25
2018-05-30 21:00:00.897 dzVents: 1500
2018-05-30 21:00:00.897 dzVents: Line:000|21:30
2018-05-30 21:00:00.897 dzVents: Linetime: 21:30
2018-05-30 21:00:00.897 dzVents: 1800
2018-05-30 21:00:00.897 dzVents: Line:000|21:35
2018-05-30 21:00:00.897 dzVents: Linetime: 21:35
2018-05-30 21:00:00.897 dzVents: 2100
2018-05-30 21:00:00.897 dzVents: Line:000|21:40
2018-05-30 21:00:00.898 dzVents: Linetime: 21:40
2018-05-30 21:00:00.898 dzVents: 2400
2018-05-30 21:00:00.898 dzVents: Line:000|21:45
2018-05-30 21:00:00.898 dzVents: Linetime: 21:45
2018-05-30 21:00:00.898 dzVents: 2700
2018-05-30 21:00:00.898 dzVents: Line:000|21:50
2018-05-30 21:00:00.898 dzVents: Linetime: 21:50
2018-05-30 21:00:00.898 dzVents: 3000
2018-05-30 21:00:00.898 dzVents: Line:000|21:55
2018-05-30 21:00:00.898 dzVents: Linetime: 21:55
2018-05-30 21:00:00.898 dzVents: 3300
2018-05-30 21:00:00.898 dzVents: Line:000|22:00
2018-05-30 21:00:00.898 dzVents: Linetime: 22:00
2018-05-30 21:00:00.898 dzVents: 3600
2018-05-30 21:00:00.898 dzVents: Line:000|22:05
2018-05-30 21:00:00.898 dzVents: Linetime: 22:05
2018-05-30 21:00:00.898 dzVents: 3900
2018-05-30 21:00:00.898 dzVents: Line:000|22:10
2018-05-30 21:00:00.898 dzVents: Linetime: 22:10
2018-05-30 21:00:00.898 dzVents: 4200
2018-05-30 21:00:00.898 dzVents: Line:000|22:15
2018-05-30 21:00:00.898 dzVents: Linetime: 22:15
2018-05-30 21:00:00.898 dzVents: 4500
2018-05-30 21:00:00.898 dzVents: Line:000|22:20
2018-05-30 21:00:00.898 dzVents: Linetime: 22:20
2018-05-30 21:00:00.898 dzVents: 4800
2018-05-30 21:00:00.899 dzVents: Line:000|22:25
2018-05-30 21:00:00.899 dzVents: Linetime: 22:25
2018-05-30 21:00:00.899 dzVents: 5100
2018-05-30 21:00:00.899 dzVents: Line:000|22:30
2018-05-30 21:00:00.899 dzVents: Linetime: 22:30
2018-05-30 21:00:00.899 dzVents: 5400
2018-05-30 21:00:00.899 dzVents: Line:000|22:35
2018-05-30 21:00:00.899 dzVents: Linetime: 22:35
2018-05-30 21:00:00.899 dzVents: 5700
2018-05-30 21:00:00.899 dzVents: Line:000|22:40
2018-05-30 21:00:00.899 dzVents: Linetime: 22:40
2018-05-30 21:00:00.899 dzVents: 6000
2018-05-30 21:00:00.899 dzVents: Line:000|22:45
2018-05-30 21:00:00.899 dzVents: Linetime: 22:45
2018-05-30 21:00:00.899 dzVents: 6300
2018-05-30 21:00:00.899 dzVents: Line:000|22:50
2018-05-30 21:00:00.899 dzVents: Linetime: 22:50
2018-05-30 21:00:00.899 dzVents: 6600
2018-05-30 21:00:00.899 dzVents: Line:000|22:55
2018-05-30 21:00:00.899 dzVents: Linetime: 22:55
2018-05-30 21:00:00.899 dzVents: 6900
2018-05-30 21:00:00.899 dzVents: Regen verwacht: 0 mm binnen 20 minuten.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests