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

Hello Remko ,

It does not work as I want; the variable 'Buienradar' jumps to early to "1".

Maybe there is a possibility to work with the variable 'Timet', you used in the 'function raincheck()'. I see here that the raintime is requested. Can I work with os.difftime(t2,t1)  (t2 = timeT, t1 = currentTime)? The result put into a variable ' Time2rain'?

If the variable 'Time2rain' is less than 300 seconds then starts a scene?

 

I hope you can help me.

 

Greetz John

 

 

Hi John,

 

Try the new VD (attached) and the following scene:

Please login or register to see this code.

Please login or register to see this link.

  • 0
Posted

Hi Remko,
beautiful script. And it seems to work! At least if I use a dummy time. Tomorrow expect rain and I can properly test the script.
I have another question. I've written a scrip where I put the awning in a different position depending on the wind speed, to avoid damaging. Is it possible to combine these two scripts into one ?

Please login or register to see this code.

Thank for you're support,

 

Greetz John

  • 0
Posted

Something like this:

Please login or register to see this code.

  • 0
Posted

Remco,

Thank you very much. I made a few minor adjustments and the script works great. Just had a downpour of rain and the scene worked perfectly. Thanks again for your help.

The final script is:

Please login or register to see this code.

Greetz John

  • 0
Posted

Hi Remko ,

 

.today called a rainy day and a time to take a test well VD Buienradar coupled with my scene.

it rains from 15:00 hours without intervals of 5 minutes. This allows the variable ' Buienradar' remains fixed and does not change.

This makes the scene can not be used properly . is there a solution for this?

 

Greetz John

  • 0
Posted

Hi, if you place this to row 196 of the VD it will updated every time if it keeps raining:

 

fibaro:setGlobal("Buienradar", raintime)

 

the part will like this after the change:

 

  elseif rain and buienradar ~= "0" then
    log("rain and 1")
    fibaro:setGlobal("Buienradar", raintime)
    fibaro:call(selfId, "setProperty", "ui.lblOverview.value", "Expected at "..raintime);
 

  • 0
Posted

Hi, if you place this to row 196 of the VD it will updated every time if it keeps raining:

 

fibaro:setGlobal("Buienradar", raintime)

 

the part will like this after the change:

 

  elseif rain and buienradar ~= "0" then

    log("rain and 1")

    fibaro:setGlobal("Buienradar", raintime)

    fibaro:call(selfId, "setProperty", "ui.lblOverview.value", "Expected at "..raintime);

 

It works. Thank

  • 0
Posted

Hi Remko,

 

in The scene(script) is a little bug; the script-log keeps counting below zero to infinity . And every 5 minutes, it indicates " script already running".

It seems that the script continues counting in a loop and does nothing more with the variable "Buienradar", unless you restart the script..

Kun je helpen dit te verhelpen?

 

Greetz John

  • 0
Posted

Hi Remko,

 

in The scene(script) is a little bug; the script-log keeps counting below zero to infinity . And every 5 minutes, it indicates " script already running".

It seems that the script continues counting in a loop and does nothing more with the variable "Buienradar", unless you restart the script..

Kun je helpen dit te verhelpen?

 

Greetz John

 Can you change:

while math.ceil((bTime - currentTime)/60) ~= (beforeRain) do

to

while math.ceil((bTime - currentTime)/60) > (beforeRain) do

 

The problem is that the value was already below the beforeRain value when it started.

  • 0
Posted

Hallo Remco,

 

the scene works well. However, it causes problems as radar adjusts the time of rain to an earlier time. The script then does not want to overwrite the earlier expected time of rain, making my awning rains still wet.

 

Is there a possibility to use the latest information from Buienradar in this script?

 

Greetz John

  • 0
Posted

hereby the last version of the script.

Please login or register to see this code.

Greetz John

  • 0
Posted

Hi John,

 

Try the new VD (attached) and the following scene

Thank you (again) boerremk for this excellent peace of code!

 

Just my (very little) contribution, VD icon attached with transparent background.

Please login or register to see this attachment.

  • Like 1
  • 0
Posted

Hallo Remco,

 

the scene works well. However, it causes problems as radar adjusts the time of rain to an earlier time. The script then does not want to overwrite the earlier expected time of rain, making my awning rains still wet.

 

Is there a possibility to use the latest information from Buienradar in this script?

 

Greetz John

 

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.

  • 0
Posted

Remko,

 

wonderful solution. Simple, but effective! I'm going to try it. Thank you, again!

 

@Lambik, Thank ik put de *.png into my VD. Nice work.

 

Greetz John

 

  • 0
Posted

Cool solution, just gave it a try. No rain however 

Please login or register to see this image.

/emoticons/default_icon_biggrin.gif" alt=":-D" />

 

Wat should be set in the "Buienradar" variable? Is it just 0 or 1? Or is the time set in this variable?

  • 0
Posted

The time of the expected rain, so 0 means no rain. You can use the variable for other scenes or VDs, for example to close the windows.

  • 0
Posted

Remko,

 

Sinds 27 aug the VD buienradar crashes at the next line:

 

[DEBUG] 18:39:33: buienradar: 0
[DEBUG] 18:39:33:

Please login or register to see this link.

 

Has Buienradar anything changed?

What can I do to solve it?

 

Greetz John

  • 0
Posted

Same problem here... and "error getting data" in the VD

  • 0
Posted

I will have a look.

  • 0
Posted

Host and url were changed.

 

I added a new VD to my original post.

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