Sync Hubitat Variables to SharpTools

Not sure I have the best use case for this. More of me trying to make things simple/dynamic being lazy

On the Habitat side I have a super simple virtual device driver which creates state variables dynamically through a method.

Pass in a key & value and it creates a variable with the key as name and value as…value.
Stupidly simply.

Since these variables aren’t attributes, obviously they aren’t going to appear on SP side.
It has 1 attribute. attributeUpdated.
When a variable is created or updated,
I do a sendEvent on attributeUpdated, it’s value is set to a simple key=value pair (json).

Now that - arrives over at sharp tools no problem, no need to auth, no new virtaul device, etc.

Just a nice way to bypass having to worry about device capabilities, and re-authorizing between platforms just to expose a piece of information from there to here.

I can use HTTP. This just seemed like low effort way to do it.
You create this 1 virtual device and it’ll store as many “hub wide” state variables as you’d like and you can share them in either RM through event listening.

In the rules machine on Hubitat or Shaprtools you just trigger on the event of attributeUpdated being changed then you filter if it’s the variable you’re looking for or not. (If I could parse %value%)

There should not be a vast need for this, but when you do need it ,it’s nice to just be able to work in the 2 rules engines without making a new virtual device and reauthorizing.

My thought is more to expose some of the existing rules engine options for HTTP to variables.

Anyways - I’m in the middle of learning a lot of this and groovy - i’m sure there is a “well you could just do this” I’ve not thought of.


1 Like

@Edward_Brown, so is the idea here to store the Hubitat variables and their values in the stringified JSON dictionary format in a device’s attribute, and you want the PARSE feature in Rule Engine to parse the JSON string and access the specific variable’s value by using the variable’s name as the key?

In case you are not aware of this, you can pass Hubitat variable value to SharpTools by following the steps in this post. It needs a RM rule to call SharpTools HTTP trigger and pass in the variable when the HE variable gets updated, and the SharpTools rule gets the value and assign it into a SharpTools variable that can be used in both dashboards and another rule afterwards.

1 Like

See! And then someones like “this is easy over here”. I got too far down into the virtual devices and passing attributes it didn’t occur this would be easier in the end.

1 Like

@Edward_Brown I moved this discussion into its own topic since the context is more related to syncing Hubitat variables to SharpTools. Feel free to let me know if you have any questions in setting this up. :wink:

1 Like

sounds great. Sorry for the confusion.