Help creating a rule HTTP GET

Can someone point me in the direction of an example of or documentation on how to set a variable using HTTP GET? I don't see the answer on what I'd like to do in any FAQ or searching.

What I'd like to do in RM:

Every day at 5:00 AM using my Open Weather account

http://api.openweathermap.org/data/3.0/onecall?lat=40.1***&lon=-80.1***&units=imperial&appid=dd60************************

Set variable [HighTempToday]

using: response.data.daily.0.temp.max

Set variable [LowTempToday]

response.data.daily.0.temp.min

I know there is a lot of helpful "how to's" here, but I can't find this one.

I just need a push in the right direction.

I don't really use Rule Machine, but there was a post about this recently.

Action:

Select Variable to Set -> select your variable
Select String operation -> select Set from HTTP Post Response
Select content type -> probably json in this case
Enter URL to Send request to -> Your url for the request
Enter body for Post -> probably not needed

I've never actually tried this is Rule Machine, I have only used Webcore for web requests and json parsing.

Some RM master can comment if I missed something.

1 Like

Not seeing this in the selection drop down...

While this doesn’t answer your question about http get but… if you are trying to retrieve the max and min temps of the day from open weather map why not use this driver? Both values are saved to a custom attribute, so you can automate as you’ld like in RM from there.

1 Like

I'm at the same place but don't have Select String Operation.

Thanks!

I'll take a look. I see it is not meant to be "real time", but I just need it once a day at 5:00 AM.

Hi Sidjohn1-

I installed this driver. Is there any documentation on how to use it?

More specifically, how to capture/use this information in RM....

Those show up as custom attributes in RM.

1 Like

Thank you very much!

I think I'll just create some RM variables to capture the data I want to use in other rules like High Temperature Today, Low Temperature Today, etc...

I think that will be easier for me to work with. Unless I'm missing something.

I really appreciate the push in the right direction!

I use A LOT of custom attributes. If i created variables for each custom attribute I used, it would quickly become unmanageable. Ultimately though what works for me may not work for you.

Also as i learned how to use RM over time, i ended up rewriting several rules to make them simpler or better or because i realized being less heavy handed can produce more consistent results. I’m sure most people on this forum have done the same. Home automation is a journey, glad i could help.

I'll take another look at using the custom attributes. Conceptually it seems cleaner. While I was able to "see" the attribute to set the variable in my test above, I was not able to see it to use it as a "condition" in a rule. (Not sure why). I'll keep trying....

EDIT: They are there now. not sure why they were not before. This will work perfectly!!!

Thanks again @sidjohn1