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
7 minutes ago, Patrick said:

Think I found the problem as some of the code gets disrupted when I copy this to this forum .. l have added a txt file with the full code  :)

Yes yes, working here too

Thank you @Patrick!!!!!!!!!!!!!!

Edited by Twannie
Link to comment
Share on other sites

  • 0

@Patrick

I want to use the scene to send my robot mower home when the rain is heavy (I have a very low part of my garden where my mower will drown with to much rain),

Can you help me how I can store the maximum amount of rain in this scene in a global so I can use it for my mower scene?

Link to comment
Share on other sites

  • 0
32 minutes ago, Twannie said:

Yes yes, working here too

Thank you @Patrick!!!!!!!!!!!!!!

Icons do change too

Edited by Twannie
Link to comment
Share on other sites

  • 0

I don't get the logic @Patrick

Rain expected at 14:40 but 14:35 show rain too

 

Please login or register to see this image.

/monthly_2020_08/image.png.7636a6c27582edc1ae8dd131fb12ab99.png" />

Link to comment
Share on other sites

  • 0

23-Aug 14:33:42 : update: refresh
23-Aug 14:33:42 : rain and 0, wait 15 min voor het regent
23-Aug 14:33:42 : rain and counter: 1
23-Aug 14:34:42 : true
23-Aug 14:34:42 : rain and counter: 2
23-Aug 14:35:42 : true
23-Aug 14:35:42 : rain and counter: 3
23-Aug 14:36:42 : true
23-Aug 14:36:42 : rain and counter: 4
23-Aug 14:37:42 : true
23-Aug 14:37:42 : rain and counter: 5
23-Aug 14:38:42 : true
23-Aug 14:38:42 : rain and counter: 6
23-Aug 14:39:42 : true
23-Aug 14:39:42 : rain and counter: 7
23-Aug 14:40:42 : true
23-Aug 14:40:42 : rain and counter: 8
23-Aug 14:41:42 : true
23-Aug 14:41:42 : rain and counter: 9
23-Aug 14:42:42 : true
23-Aug 14:42:42 : rain and counter: 10
23-Aug 14:43:42 : true
23-Aug 14:43:42 : rain and counter: 11
23-Aug 14:44:42 : true
23-Aug 14:44:42 : rain and counter: 12
23-Aug 14:45:42 : true
23-Aug 14:45:42 : rain and counter: 13
23-Aug 14:46:42 : true
23-Aug 14:46:42 : rain and counter: 14
23-Aug 14:47:42 : true
23-Aug 14:47:42 : rain and counter: 15
23-Aug 14:48:42 : true
23-Aug 14:48:42 : rain
23-Aug 14:48:42 : 2020-08-23 14:48:42.654975 [ fatal] LUA error: /opt/fibaro/FibaroSceneAPI.lua:335: attempt to concatenate local 'deviceID' (a nil value)

Link to comment
Share on other sites

  • 0

@Twannie don't forget to change the lattitude en longitude in the scene for the right location. (in maps.google.com you can see the coördinates of your location)

still some issues here too

Please login or register to see this image.

/monthly_2020_08/afbeelding.png.615118dae879e6e8360143eed410f525.png" />

Link to comment
Share on other sites

  • 0

I I noticed after one run the scene stops running without errors!

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0
2 hours ago, WouterStegenga said:

@Twannie don't forget to change the lattitude en longitude in the scene for the right location. (in maps.google.com you can see the coördinates of your location)

still some issues here too

Please login or register to see this link.

Hi @WouterStegenga
you can fetch the lattitude and longitude from HCx configuration:-)

 

Link to comment
Share on other sites

  • 0
18 minutes ago, Twannie said:

Seems like scene stops when rain = yes??

No one experience scene stop running when rain = yes in the debug?

Link to comment
Share on other sites

  • 0

It is not rain = yes which stops the scene running but something else

Sometimes the scene keeps running and after a while it stops

 

I now disabled selfrun and start the scene from the loop in the VD

Everything seems to run fine except when rain comes the "Rain expected at" is different from the time in the list where the first mm rain is shown.

Also I noticed the scene keeps running when rain is yes setting up this way.

There seems to be more errors in my experience.

 

How is it running with the others and how if I may ask?

 

 

Please login or register to see this image.

/monthly_2020_08/image.png.7636a6c27582edc1ae8dd131fb12ab99.png.29555857ed23d64213bcac13731b1f89.png" />

Edited by Twannie
Link to comment
Share on other sites

  • 0
23 hours ago, Twannie said:

No one experience scene stop running when rain = yes in the debug?

I'm not sure why and I am a complete beginner in this, but mine won't run automatically. Only update with the refresh button. I also can't find multiple icons for this VD.

Link to comment
Share on other sites

  • 0

Got it sort of working, but in my case is also runs only once. I need to hit refresh button of the VD to start it again.

Link to comment
Share on other sites

  • 0
4 hours ago, TheWorker said:

Got it sort of working, but in my case is also runs only once. I need to hit refresh button of the VD to start it again.

 

Me too, I stripped some coding and I run the scene using the loop of the VD (startscene)

Link to comment
Share on other sites

  • 0
2 hours ago, SmartHomeEddy said:

Sounds like the solution is almost there

 

Hmm... dont know about the messages but the code runs fine (stripped out some loops)

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