Howto: Virtual device, update attribute via incoming HTTP request payload

I have a DIY keypad door lock. I would like to create a Rule Machine rule that responds to different codes being entered. What is the simplest way for my keypad to report door codes to the Hubitat?

I've noticed when creating a local/cloud endpoint that RM doesn't seem to be able to parse additional query string parameters. Is there a different way to expose a URL endpoint on Hubitat that when hit with a string parameter would trigger RM or even update a Virtual device with an attribute dedicated to this string?

I have a Raspberry Pi controlling the keypad so I can easily make HTTP requests. Do I create some type of virtual Hubitat device that can hold the last code entered? And then some cloud endpoint that can update that code?

Thanks.

The built-in App Maker API will likely be what you are looking for. If you install the App you will see some examples at the bottom of the App configuration screen. Maker API can be used for both retrieving device status information as well as issuing commands.

In terms of your exact use case, yes, a virtual device is likely the option to use with Maker API. I'd have to think about it a little more to give you the best option, though I have developed a generic driver in the past to store some basic values. Will just depend on whether Hub Variables are available to use in Maker API or if there is another option.

Awesome it looks super relevant.

If my goal is for a virtual device to have a string attribute (last code entered), is there a Virtual device you are aware of that would fit the bill? I'm hoping to avoid having to develop one. I looked at the 'Virtual Door lock' and it has a method I could use 'Set Code' but it receives multiple params which I understand Maker API doesn't support.

Thanks

It may support two, but I'd have to check...

The driver I developed was this one:

If nothing else you could give it a go to get you started... Like I said, not sure (can't remember) if there is another more appropriate option nowadays in terms of a Virtual Device driver, though for many situations Hub Variables are the way to go.

This looks exactly like what I need, trying now. Thanks!

1 Like

Works perfect, thanks.

1 Like