Looking to upload device value to 3rd party api

I am trying to upload a device's value on schedule to a 3rd party api (io.adafruit.com). I tried doing this using a momentary switch, and it worked.... with one minor issue. I can call a POST to the api and formulate the json in the body. The problem is that I don't have any way to get the value from a device (e.g. I can only hard-code values in the body). Is there something that I am missing here? Thank you so much in advance!

What are you using to send the POST? If Rule Machine, you can grab the device value into a variable, and put the variable into the POST body using %variable-name%.

1 Like

@bravenel, thank you so much for that! I do have this working, with one exception: how do I schedule it to run every x minutes? Unfortunately the triggers seem very limited, but I know from working with other hubs that sometimes we can daisy-chain items to achieve our desired outcome.

EDIT: Maybe create a virtual switch and have it turn on and off every x minutes. Could I then just have the trigger in this rule be a state change in the switch?

Look at Periodic Schedule trigger.

That sets up a cron schedule.

Why on schedule? Why not upload the device's value every time it changes, and use the fact that it changes as a trigger for the automation?

I should add that if you chose this approach, you wouldn't even need to create a variable with the device's value.

Thank you both so much! I completely missed that trigger.

Yeah, I had thought about triggering it on the temperature change only. The reason why I am not doing it now is that I wanted to have regular data points for a project that I am doing related to this sensor.

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