Logic - getting data from the weather API

Hi

I’m new here and I have a question if I can do the following automation with Homey Bridge

  1. Access to the weather provider’s API address

  2. Receives the following answer from him

{“coord”:{“lon”:20.996,“lat”:52.177},“weather”:[{“id”:802,“main”:“Clouds”,“description”:“zachmurzenie małe”,“icon”:“03d”}],“base”:“stations”,“main”:{“temp”:27.78,“feels_like”:29.13,“temp_min”:24.69,“temp_max”:30.4,“pressure”:1007,“humidity”:60},“visibility”:10000,“wind”:{“speed”:3.09,“deg”:120},“clouds”:{“all”:40},“dt”:1661078863,“sys”:{“type”:2,“id”:2000452,“country”:“PL”,“sunrise”:1661052552,“sunset”:1661104176},“timezone”:7200,“id”:753571,“name”:“Zbarz”,“cod”:200}

  1. I would like the downloaded data, eg feels_like, humidity

and in effect, for example, variable #weatherhumidity would be equal to 60

were saved as variables in Homey Bridge

Is it possible?explain the working of specific Flows in homey.

Hi,
you can use built in Logic cards for http request (getting JSON as result) and parsing your JSON to extract the needed field as numeric tag. This example uses AdvancedFlows. Therer you can execute several action cards and use the result from the card before as input tag in the next tag. This way you can extract several JSON fiels into tags in only one flow. I think, these JSON cards are only available in AdvancedFlows and should be available on HomeyCloud, too.

grafik
The red arrows are showing the tags which are passes between the cards.

You can find these cards in the Logic area:

I think Adv.Flows is a Pro only option, Ronny.

This AND card is available
(An Http request’s status code is…)

But that isn’t useful for this case…

Oh, too bad. Then my example is not useable for cloud.
Are http cards existing in HomeyCloud? The JSON cards aren’t.

PS: with the simple http cards you can get a http code, but the body too? But then you will have the JSON as string.

Yup, there’s a Get/Post/Put/Del http request action card with url, headers and body. But no receive option…

I only have that at homey bridge

Hm, I don’t think it’s possible on HomeyCloud. You can call a http GET, but I can’t see how you get the result because there is no trigger card in Logic part.

I did a workaround for this, I have a script that reads the data and puts it into variables using Logic Webhook, unfortunately each separately, and it has its limitations (max 5 calls per minute) but it seems to work fine.

I also have another question, do you know when Home Bridge will be the official version? Beta was due to end earlier this year, and it’s September.

Only Athom could answer this… But as I read on Slack channel, Atom is extensivly testing HomeyCloud to end the beta state.

Nice to hear. Maybe share it here?

My method is complicated, but it works

  1. I have created an account at SharpTools: Dashboard and Rule Engine for SmartThings, Homey, Hubitat, and Home Assistant

SharpTool works mainly under smartthings and has no direct integration with Homey.

  1. I added weather API queries using rules and variables

  2. SharpTools allows you to get a query (read and save as variables)

  3. In the rules I ordered the read parameter to be saved as a variable

  4. I inserted the variable at the end of the link that is generated in HomeyBridge in logic

  5. Saves the parameter from the link as a variable in homey

  6. Unfortunately, each parameter requires a separate link, you can make a maximum of 5 link calls per minute, so I recommend that you use a delay between inquiries, e.g. by 30 seconds.

2 Likes