HTTP Get Hub Variable

I can create or Set a Hub Variable with
http://192.168.0.xxx/apps/api/40/trigger/setHubVariable=MyVariable:25?access_token=xxx

How do I get that same or other Hub Variable via HTTP? Im new to Hubitat and have spent
a long time searching but failed so far.

Until someone chimes in with a secret endpoint that exposes the hub variables, the best hack I can think of would be to write the variable value to a device attribute whenever it changes (using Rule Machine) and expose the device via Maker API where you can then pull the device info via HTTP.

If you need to store a string you could either write a custom device driver or could use the virtual OMNI sensor as suggested here: Virtual device type to store text string? - #2 by dan.t

Depending on where and how the hub variable is used, it might be simpler just to store the variable value in the device attribute in the first place and not use the hub variable at all.

Thanks for the reply. Instead of creating a Hub Variable I can create a fake Virtual Dimmer to give me an integer variable with Get and Set access via Maker API.

I assume there's no way to add an attribute to a device unless I modify the groovy code.

I was wondering whether Maker API may have even been an option for you for a Hub Variable, but am not sure of the current state of connectors and alike for them.

As an alternative, if you get stuck, you could try my Generic Attribute Driver and link it up to Maker API.

But I would strongly recommend pursuing the HV route further to see if you can use the built-in option first.

Thanks, I can use your driver if I need anything other than an integer attribute.

1 Like

Can you explain what pursuing the HV route means? I think I have to use Maker API because I'm controlling Hubitat from a Windows.NET program that runs on my PCs and TVs.

I just meant trying to make the Hub Variables work for what you are trying to do, if you can. By all means use the driver I created, but where you can use the built-in features, it is often a better outcome.