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


Question

Posted

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.
 
 
 
 

 

 

 

Recommended Posts

  • 0
Posted

Hi guys,

 

I'm running into a problem running the scene:

 

I get an error on line 22: 

[DEBUG] 20:27:44: line 22: invalid pattern capturee

 

this is the offending line:

Please login or register to see this code.

On 2016-5-29 at 6:31 PM, boerremk said:

 

Before it does a new cycle it will get the, new, value of the time (bold part is different):

Please login or register to see this code.

 

can anyone help me please?

 

Jim

Nevermind, found it:

Please login or register to see this code.

 

  • 0
Posted (edited)
On 2016-5-17 at 9:18 PM, boerremk said:

 

Hi,

 

You can use the following:

Please login or register to see this code.

You can tune the time before it will be set to 1 in the mainloop with the variable beforeRain.

 

I cant seem to get this buienradar VD to work.

If I look at my global variable “Buienradar” it’s value is “0” when no rain is detected.

And from above statement It must set itself to “1” when rain is detected.

But with me it’s not gone to set itself to “1” but it’s value is time. So like “21:50”.

 

Ok so this part is filling "Buienrader" to raintime variable witch explains the value time that is inserted.

Please login or register to see this code.

I cant find the code that sets the  globalvariable "Buienradar" to value "1"

Anybody know what I am doing wrong?

 

 

 

Edited by Ibie
  • 0
Posted

Hi @Ibie,

 

The variable is indeed filled with a time (it was on request changed by time instead of 1).

 

You can use the following:

 

Please login or register to see this code.

  • 0
Posted (edited)

Thnx for your quick support :-) 

It is working for me now...

Edited by Ibie
  • 0
Posted

@boerremk

 

The VD doesnt seem to be updating the correct information.

Sometimes it does and sometimes it doesn’t.

I compare the URL in my browser and shows different information…

 

Please login or register to see this attachment.

 

Please login or register to see this attachment.

 

There is also an other url that seems to be working:

Please login or register to see this link.

  • 0
Posted

Hi @Ibie,

 

I will keep an eye on this, for now it is ok (in my place), but will have some more tests if it stays ok. If I find the issue I will post a new VD.

 

It is not the first time that the url has changed, so wil also test the new url.

  • 0
Posted

Thank you :-)

  • 0
Posted

The 2 urls give different results back :roll:... The new url says "no rain", the old says "rain at 13:50"... we will see within 30 minutes who is right ;-)

  • 0
Posted (edited)

Yes i notested it to...

 

Sometimes when i used the one of yours with "gadget" it brought me to the buienradar map...

So if you try:

gadget.buienradar.nl/etc etc etc with long and lat

it redirects to:

Please login or register to see this link.

While gpsgadget.buienradar.nl/etc etc etc with long and lat always give me the rain info

 

But with yours i stil also get results in

Edited by Ibie
  • 0
Posted

The last couple of days I compared the outcome of the 2 urls, but there are, almost, the same.

 

Keep in mind that the VD only displays values if the result is, rounded up, 0.1mm/hours of rain (077 is 0.1mm/hour of rain). Values of 035 will not be displayed, the reason is that you get a lot of false positives if you include the lower values.

 

I could change the VD that it shown also the Buienradar result (eq 0 (035)) or that you can set the minimal to display (and set as default 077).

  • 0
Posted
2 hours ago, boerremk said:

The last couple of days I compared the outcome of the 2 urls, but there are, almost, the same.

 

Keep in mind that the VD only displays values if the result is, rounded up, 0.1mm/hours of rain (077 is 0.1mm/hour of rain). Values of 035 will not be displayed, the reason is that you get a lot of false positives if you include the lower values.

 

I could change the VD that it shown also the Buienradar result (eq 0 (035)) or that you can set the minimal to display (and set as default 077).

thnx for testing these two url’s…

For me the gpsgadget.biuenradar.nl works best or actually pretty good.

So I changed the VD for this URL and seems to be working for now for my satisfaction at the moment (I will keep my fingers crossed) :-)

 

I didn’t realize that 077=0.1mm rain… that’s explains a lot.

Then I don’t think it is necessary to change VD.

 

Thnx again for helping…

 

 

  • 0
Posted

@boerremkI think they have changed the url again... Looks like they now use https. Do you also have the problem not getting any data... and can you help me with a sollution? thnx

 

  • 0
Posted
1 hour ago, Ibie said:

@boerremkI think they have changed the url again... Looks like they now use https. Do you also have the problem not getting any data... and can you help me with a sollution? thnx

 

 

Indeed it is changed!

 

In the orginal post I added the new VD.

 

The new url is:

BR = Net.FHttp("br-gpsgadget-new.azurewebsites.net",80);

  • 0
Posted

@boerremkThnx again for your support :-)

  • 0
Posted

Weird, 
    BR = Net.FHttp("gadgets.buienradar.nl",80);

Was still returning data for me.

 

Have a good weekend!

 

Jim

  • 0
Posted

Hi guys,

 

Is it just me, but it seems the scene has stopt receiving data since last Saturday ? Any Idea what is going on ... :/

 

  • 0
Posted
27 minutes ago, Patrick said:

Hi guys,

 

Is it just me, but it seems the scene has stopt receiving data since last Saturday ? Any Idea what is going on ... :/

 

Mine is still working,

I'm still using the following url:

 

BR = Net.FHttp("br-gpsgadget-new.azurewebsites.net",80);

  • 0
Posted

Hi Remco,

Buienradar stops. Since February 27, I get faultmessage with error: 0 and status: 301. 

Can you help me to sove the problem?

 

Greetz John

  • 0
Posted

Good evening @JohnneyBoy,

 

around line 175 replace

Please login or register to see this code.

with

Please login or register to see this code.

 

Jim

  • 0
Posted
19 minutes ago, jimicr said:

Good evening @JohnneyBoy,

 

around line 175 replace

Please login or register to see this code.

with

Please login or register to see this code.

 

Jim

 

 

I changed the url in the VD.

 

Also added a variable "url" at the top of the code.

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...