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.

Moderator: leecollings

mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by mvroosmalen »

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 12:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bobke77 »

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

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

Post by poudenes »

Does someone have at the full script for me that work on dzVents 2.4.0?
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
mickmack82
Posts: 9
Joined: Wednesday 31 January 2018 15:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by mickmack82 »

bobke77 wrote: Tuesday 30 January 2018 13: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 12:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by bobke77 »

mickmack82 wrote: Wednesday 31 January 2018 15: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: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

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

Post by poudenes »

the -L parameter also solved my NIL problem :)
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
User avatar
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?

Post by EdwinK »

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 (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by mvroosmalen »

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: 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?

Post by EdwinK »

But it used to work
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
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: Is it gonna rain within the next X minutes?

Post by jvdz »

EdwinK wrote: Thursday 01 February 2018 9: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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
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?

Post by EdwinK »

jvdz wrote: Thursday 01 February 2018 11:50
EdwinK wrote: Thursday 01 February 2018 9: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 (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
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?

Post by EdwinK »

Still no luck :(
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by mvroosmalen »

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: 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?

Post by EdwinK »

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 (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
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?

Post by EdwinK »

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 (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
mvroosmalen
Posts: 23
Joined: Saturday 03 December 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by mvroosmalen »

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: 40
Joined: Sunday 15 April 2018 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

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

Post by Venzent »

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: 40
Joined: Sunday 15 April 2018 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

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

Post by Venzent »

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.
Venzent
Posts: 40
Joined: Sunday 15 April 2018 13:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

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

Post by Venzent »

Mmmmm, it seems to run every 15 minutes. Is this something new??
Probably this line:
if ((time.min % 15)==0) then
Which is fine by me, every minute is an overkill, but to my knowledge it did run every minute....
Never mind, case closed :-)
DickN
Posts: 8
Joined: Monday 06 March 2017 19:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

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

Post by DickN »

Hi,

In Hardware I have created a virtual sensor with type Regen
MWSnap002.jpg
MWSnap002.jpg (7.84 KiB) Viewed 2568 times
In devices i can see now:
The attachment MWSnap002.jpg is no longer available
Idx=782

and in the weather tab:
is correctly shown
MWSnap001.jpg
MWSnap001.jpg (26.91 KiB) Viewed 2567 times
Also when I open the Log:
is alsocorrectly shown.

So far everything is OKe

When I edit my script with:
RainDeviceIDX=778
commandArray[1] = {['UpdateDevice'] = RainDeviceIDX .. '|'..tostring(RainPrediction)..'|'..tostring(verw)}
The divice in the weather tab is not lookingen like before.
The log-file does niet appear anymore.

Can somebody tell me what I did wrong
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest