Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Need help with getting info from a string with live rain website


kooy

Question

Hope you guys can help me.

 

I found a website that can give you realtime rain info on a specific lat and long values.

 

It can predict rain in your area upto 2 hours upfront.

 

now my only trouble is how to get the right info from the website.

 

As it stand now im getting info like this

 

000|20:50 000|20:55 000|21:00 000|21:05 000|21:10 000|21:15 000|21:20 000|21:25 000|21:30 000|21:35 000|21:40 000|21:45 000|21:50 000|21:55 000|22:00 000|22:05 000|22:10 000|22:15 000|22:20 000|22:25 000|22:30 000|22:35 000|22:40 000|22:45 000|22:50

 

where 000 is the amount of rain and timestamp (lucky me no rain at least till 22:50)

 

What i would like is to get the info only for the next 15 minutes.

so if my local time 21:15 i would like to get the info for 21:30 which looks like 000|21:30

 

How to get the 000 part out of the string at 21:30?

 

i tried

str = string.match(response, "21:10")

fibaro:debug(str)
but that only get the me right time and i need the 3 chars before that.
 
 
 
 

 

 

 

Link to comment
Share on other sites

Recommended Posts

  • 0

Host and url were changed.

 

I added a new VD to my original post.

Thanks, just installed it and looks like it's working.

 

Have a good weekend!

Link to comment
Share on other sites

  • 0

Just for info, new URL:

Please login or register to see this code.

I adopted some things to the original code wrote by boerremk, so I only needed the URL.

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

Link to comment
Share on other sites

  • 0

I want to share some additions, I made a while ago, for using the VD as a way to visually check if rain is predicted.
 
The original code I used is written by boerremk, so all credits to him!!

 

I just did some additions/changes:

Please login or register to see this code.

Options and symbols can be changed in the mainloop beneath the ℹ Initialisation of user settings (change if necessary)-header:

Please login or register to see this code.

 

Please login or register to see this link.

(solved by boerremk):

Change line near 178:

Please login or register to see this code.

to

Please login or register to see this code.

Please login or register to see this link.

(solved by boerremk)

Change lines near 87

Please login or register to see this code.

to

Please login or register to see this code.

Version 20161112

New version attached, with bugfixes 20161007 and 20161111

 

Please login or register to see this attachment.

 

Please login or register to see this attachment.

Edited by Lambik
Bugfix 20161111
Link to comment
Share on other sites

  • 0

Host and url were changed.

 

I added a new VD to my original post.

 

Hey Remko,

 

sometimes line 132 indicates an error:     timeTN = tostring(tonumber(timeT:sub(1,2)) + 24) .. timeT:sub(3)

 

[ERROR] 18:58:16: line 132: attempt to compare nil with number

 
 
How can this be remedied?
 
Greetz John
Link to comment
Share on other sites

  • 0

Hi John,

 

Didn't see this error yet. Is rain expected when this occurs or also in a dry condition?

Link to comment
Share on other sites

  • 0

Hi John,

 

Didn't see this error yet. Is rain expected when this occurs or also in a dry condition?

 

Hey Remko,

 

The problem occurs mainly when there is no rain forecast.

 

Greetz John

Link to comment
Share on other sites

  • 0

Hi all, some icons are not showed on my laptop and some not on my ipad. How are the icons defined, is this some type symbol?

Link to comment
Share on other sites

  • 0
2 hours ago, rsjabbens said:

Hi all, some icons are not showed on my laptop and some not on my ipad. How are the icons defined, is this some type symbol?

Are you talking about the 20160903 Buienradar (posted) version?

If so, the symbols are not always displayed (right). This is OS dependent. I'm using Linux and Android, which displays it right.

 

You can change the symbols (to text or other symbols) in the main loop beneath -- ℹ Initialisation of user settings (change if necessary). The table variable symbolTextTable contains the be symbols and should not be empty (there must be text or symbols between ' ' ).

 

Edited by Lambik
Link to comment
Share on other sites

  • 0

Th

1 hour ago, Lambik said:

Are you talking about the 20160903 Buienradar (posted) version?

If so, the symbols are not always displayed (right). This is OS dependent. I'm using Linux and Android, which displays it right.

 

You can change the symbols (to text or other symbols) in the main loop beneath -- ℹ Initialisation of user settings (change if necessary). The table variable symbolTextTable contains the be symbols and should not be empty (there must be text or symbols between ' ' ).

 

 

I use Linux and IOS (iphone/ipad) I got it working on Linux, not on IOS. Seem that most is displayed, only the first icon isnt currently displayed correctly. I think the fog/cloudy icon. Btw, i use the latest 20160903 posted version. For me this is the first with the icons i use now.

Edited by rsjabbens
Link to comment
Share on other sites

  • 0
56 minutes ago, rsjabbens said:

Th

 

I use Linux and IOS (iphone/ipad) I got it working on Linux, not on IOS. Seem that most is displayed, only the first icon isnt currently displayed correctly. I think the fog/cloudy icon. Btw, i use the latest 20160903 posted version. For me this is the first with the icons i use now.

Sorry, I can't help you to find (similar) icons on IOS. I don't use any Apple products.

Link to comment
Share on other sites

  • 0

Hi Guys,

 

First of all lots of credits to all of you who created this wonderful VD !!

But somehow the VD just "freezes" sometimes it takes a couple of hours or sometimes after days, any idea what it is causing this ?

 

Link to comment
Share on other sites

  • 0

I found the issue and testing the new one, will update it by the end of the week (if no other error found).

Link to comment
Share on other sites

  • 0
13 hours ago, boerremk said:

I found the issue and testing the new one, will update it by the end of the week (if no other error found).

 

Can you also explain the problem and solution found when updated, so I can adjust my version also?

 

I noticed the same error in mine version also. Your level of code is far more ahead of mine, so I need some explanation.... :mrgreen:

Thank you in advance.

 

Edited by Lambik
Link to comment
Share on other sites

  • 0

Added the new VD to my original post.

 

I changed 2 lines:

line 120 to:

if (response ~= nil and response ~= "") then

 

line 158 to:

errorlog("Result is nil or empty")

 

The issue is that sometimes the result is empty.

Link to comment
Share on other sites

  • 0
On 7-10-2016 at 7:43 PM, boerremk said:

Added the new VD to my original post.

 

I changed 2 lines:

line 120 to:

if (response ~= nil and response ~= "") then

 

line 158 to:

errorlog("Result is nil or empty")

 

The issue is that sometimes the result is empty.

Thank you boerremk!

 

For those who use

Please login or register to see this link.

of the code boeremk has written, change line near 178 as boerremk suggested:

if (response ~= nil and response ~= "") then

 

No need to change errorlog.

Edited by Lambik
Link to comment
Share on other sites

  • 0

Hello Remco,

 

My VD buienradar is not working since yesterday. I get a error code: 302. It seems to be, that we have to use login codes for getting data. Can you help to solve this problem?

 

Greetz John

Link to comment
Share on other sites

  • 0

Fixed, new VD attached to original post.

 

Lines 38 and 39 are changed:

      lattitude = round(jsonTable.latitude,2)
      longitude = round(jsonTable.longitude,2)

 

Only 2 digits are allowed and if added more they will be stripped by Buienradar and a 302 occurs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...