HTTP Get parameters for Rule Machine action

Hi folks,

I feel like I am missing reading some essential piece of documentation but I have a Zigbee temperature and humidity sensor which generates events, all working well. However I want to pass those temperature readings via an HTTP GET call to another application so how do I provide the Temperature as a parameter in the HTTP GET url? I'm sure this is a common blocker to others just getting started with Hubitat Elevation but I can't seem to find it in the doco of the Rule Machine HTTP GET at all..

e.g. is it something like this?

http://xxxxxxxxxx/notify?device=BEDROOM&event=UPDATE&temperature=%temperature%

Cheers,
Murray

Have you tried setting up a variable and adding the string to it? Adding device values is possible in variables where it would not be directly in the HTTP Get.

Then you can send the variable in your Get by using %variable% instead of http://XXX

2 Likes

Thanks for your help Sebastien, your comments got me to the stage where I could make it work. I thought I would post the full steps here now that I've worked out how it fits together. It turns out you can't use device parameters as HTTP GET parameters, you have to copy each one into a local variable and then use those. It would be nice to use the device attributes directly. But at least it's possible. For each parameter you want to pass into the HTTP GET you must create a local variable first in the Rule Engine rule for that device. When you look at a device you can see all the Device Attributes the driver provides for you:

For each one you want to send through to the HTTP GET you have to create a Local Variable in the rule you have created in the Rule Engine. Here are the two I have created for the rule - I probably will add battery to this set at some stage:

Then whenever ANY one of the Device Attributes you're interested in changes, you need to trigger the rule.

So here's the finished rule.
IF any of the Device Attributes we're interested in change THEN

  1. SET our local variables to the values of the Device Attributes
  2. Send a GET to your endpoint with the local variables referenced by %variable_name%

(An example of how to set a local variable from a device attribute is shown with the highlighted ticks)

Hope this helps someone!

3 Likes

I'm starting with hubitat and I got stuck on the same problem. Very helpful!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.