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

  • 1
Posted

does he have it running now?

If so, do you want to share it patrick?

 

  • 1
Posted (edited)

All,

 

Did manage to spend some time to update the code, it still needs some work but it looks likes it works again :)

-- added my Buienradar VD

 

2020-08-23  *** UPDATE BETA 0.3 ***

 

Please login or register to see this attachment.

Please login or register to see this attachment.

Edited by Patrick
  • Thanks 1
  • 0
Posted

Please login or register to see this code.

  • 0
Posted (edited)

Maybe this can help you.

Please login or register to see this attachment.

 

 

 

 

Please login or register to see this attachment.

Edited by boerremk
New url
  • 0
  • Inquirer
  • Posted

    awesum ty very much:)

    • 0
  • Inquirer
  • Posted

    and thats the exact website i was talking about:) ty both

    • 0
    Posted

    One thing: you need a global variable Buienradar to let it work, the lon/lat the scripts graps from the HC2.

    • 0
    Posted

    @kooy glad I could help!

    @boerremk thank you for sharing that VD! I'll test it tonight!

    • 0
    Posted

    Please login or register to see this image.

    /emoticons/default_biggrin.png" alt=":D" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> fun tipped boerremk about this api, he did a awesome job to make this..

     

    boerremk maybe start a official virtual device topic with the buienradar VD ?

    we already did a few weeks of testing. Stil looking good with the latest version... 

    • 0
    Posted

    One thing: you need a global variable Buienradar to let it work, the lon/lat the scripts graps from the HC2.

    Hi boerremk,

    tried your VD - it would be very helpful, if I would get it to work. However, all values stay at "0", although it's raining here (at the moment, at least). Global var is set and location is properly picked up, but still values stay at "0". Does it only work in the Netherlands? Thanks!

     

    Cheers

     

    Alfons

     

    BTW: Debug:

    [DEBUG] 16:36:52: buienradar: 0

     

    [DEBUG] 16:36:52:

    Please login or register to see this link.

     

    [DEBUG] 16:36:52: Gegevens opgehaald

     

    [DEBUG] 16:36:52: 16:40:000

     

    [DEBUG] 16:36:52: 16:45:000

     

    [DEBUG] 16:36:52: 16:50:000

     

    [DEBUG] 16:36:52: 16:55:000

     

    [DEBUG] 16:36:52: 17:00:000

     

    [DEBUG] 16:36:52: 17:05:000

     

    [DEBUG] 16:36:52: 17:10:000

     

    [DEBUG] 16:36:52: 17:15:000

     

    [DEBUG] 16:36:52: 17:20:000

     

    [DEBUG] 16:36:52: 17:25:000

     

    [DEBUG] 16:36:52: 17:30:000

     

    [DEBUG] 16:36:52: 17:35:000

     

    [DEBUG] 16:36:52: 17:40:000

     

    [DEBUG] 16:36:52: false

     

    [DEBUG] 16:36:52: not rain and 0

    • 0
    Posted

    As far I know it only work in the netherlands.

     

    You can check this api of yours (like in the debug)

    Please login or register to see this link.

    If it's raining and there are values in it, maybe it work..  If the value's are 000 like I see with yours it won't work

     

    Buienradar is a dutch site with rainfall detection for the Netherlands

    • 0
    Posted

    As far I know it only work in the netherlands.

     

    You can check this api of yours (like in the debug)

    Please login or register to see this link.

    If it's raining and there are values in it, maybe it work..  If the value's are 000 like I see with yours it won't work

     

    Buienradar is a dutch site with rainfall detection for the Netherlands

    Hi D-Vine,

     

    thansk - I already did this ... and only 0 values. Strangely, on their website you can select Netherlands/Belgium or Europe - but obviously this doesn't work via the api.

     

    Cheers

    Alfons

    • 0
    Posted

    Yes the website of buienradar gives more but al alert possibilities are for the Netherlands..   

    • 0
    Posted

    Ahh, too bad - just what I would have needed to retract my shutters in case of rain

    Please login or register to see this image.

    /emoticons/default_icon_sad.gif" alt=":-(" /> NetAtmo has too much of a delay.

    Cheers

    Alfons

    • 0
    Posted

    Yes the website of buienradar gives more but al alert possibilities are for the Netherlands..   

    Other open similar sites?

    • 0
    Posted

    Hi there,

     

    I'm using the 'VD buienradar' which was posted by boerremk. This is working great (in the Netherlands)!

    Please login or register to see this image.

    /emoticons/default_icon_rolleyes.gif" alt=":roll:" /> 

    But, now I want to use it in a Scene, where 5 minutes before it starts raining my sunscreen closes. Does anyone know, how I can extract these times from 'VD buienradar'?

    • 0
    Posted

    Hi there,

     

    I'm using the 'VD buienradar' which was posted by boerremk. This is working great (in the Netherlands)!

    Please login or register to see this image.

    /emoticons/default_icon_rolleyes.gif" alt=":roll:" /> 

    But, now I want to use it in a Scene, where 5 minutes before it starts raining my sunscreen closes. Does anyone know, how I can extract these times from 'VD buienradar'?

     

    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.

    • 0
    Posted

    Remko,

     

    thank you for your suggestion. However, if I adapt the variable 'beforerain' to 5, the variable 'Buienradar' is put on '1' much earlier then 5 minutes. I think the error is in the next line of the script :

       

    while counter < math.floor(beforeRain/runTime) and rain do
            log("rain and counter: "..counter)

     

    beforeRain = 5

    afterRain = 5

    runTime = 5

     

     

    How can I solve this?

     

    Greetz John

    • 0
    Posted

    Yes a bug!

     

    while counter <= math.floor(beforeRain/runTime) and rain do

     

    need an = after the < (smaller and equal)

     

    Can you test this, to see if it is ok now, I will then upload a new version.

    • 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

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