How to export HE Global Vars to Sharptools?

@James

Sorry new to HE too :slight_smile:

Can’t find a Virtual Variable device to push the HE Global variables into.

Can you point me to FAQ or something that will shed some light on how to do this please?

Thanks

What kind of variables are you trying to use? A common approach is to map variables into standard virtual devices – for example, mapping a Boolean variables into a Virtual Switch.

Alternatively, you could use a custom driver for mapping Hubitat variables into - for example, I put together a custom driver which has slots for switches, numbers, and text in the following post:

:link: Virtual Values Custom Hubitat Driver

Edit: And for the sake of completeness, it’s worth mentioning that SharpTools Variables can be exposed natively to your SharpTools Dashboards.

2 Likes

@josh

Thankyou - makes perfect sense!!!

I have a bunch of Boolean vars - one for each room - HeatDemand_room

The Switch is perfect thanks!!

On principle I am fine having end user displays running in the cloud but not HA logic, I want that local.

So at the moment I am using Sharptools to create room displays and testing using Sharptools rules as an oversight check of HE rules - Ie raise an alarm if xyzzy occurs, not sure how that will run - but an idea.

2 Likes

Have used the Virtual Values Custom Driver -

Thanks

2 Likes

@josh anyway to be able to use the variable in the text field in the Device - such as %HeatDemand% would insert the content of the variable HeatDemand - TRUE or FALSE?

It would remove the need to create a Rule to trigger on VAR change and populate Device txt Field ?

Too much?

Can you clarify what you mean by ‘text field in the Device’? Do you mean the Virtual Values custom driver?

The comments at the top of the driver code have some tips that you might find helpful as to what each command does:

Virtual Values
    Author: @josh (SharpTools.io)
    Description: The Virtual Values device driver exposes a variety of methods which can be used to 
        set values of specific attributes. These attributes can then be used in other Apps within 
        Hubitat or in SharpTools.io Dashboards by using Hero Attribute tiles.
        This serves as a flexible 'utility' device for setting arbitrary values that you want to use
        elsewhere.
    Command to Attribute Mappings
        setText              →       text
        speak                →       text   *1
        deviceNotification   →       text   *2
        setNumber            →       number
        setLevel             →       level, [switch] *3
        on                   →       switch
        off                  →       switch
    *1 speak() is a wrapper method for setText to provide compatibility with apps that support Speech Synthesis devices
    *2 deviceNotification() is a wrapper method for setText to provide compatibility with apps that support Notify devices
    *3 setLevel will issue the off() command if the level is set to 0 and will leave the level set at the previous value
    Other Notes:
        The on/off commands are useful for reflecting an active/default state in SharpTools.io dashboards which is helpful
        for setting the color of your tile based on the device's state.

In Hubitat you can use variables as %variablename%.

If that could be used in the Set Text field in the Device anytime the Variable is updated so would the device without the need for Rules to update the field on Variable change

I don’t personally use Hubitat’s built-in Rule Machine, so I can’t speak to it. If you haven’t figured it out next week, feel free to ping me and I’ll poke around RM a bit. :wink:

Edit: Hubitat also has variable ‘connectors’ which are basically virtual devices. I can’t remember which capabilities they offer off the top of my head though.

2 Likes

Thanks

I am new to both Hubitat and Sharptools :slight_smile:

I received my first Hubitat 24 Dec 2020 :slight_smile:

I am reading up on Rule Machine Variable Connectors now - looks like it could make life a bit easier :slight_smile:

Ok the problem seems to be in The SharpTools Apps on Hubitat.

It does not give the ability to share the Rule Machine Connectors - Virtual Devices to Sharptools.

These do not show up in the Sharptools App in Hubitat :frowning:

So the virtual devices exist just not shareable with SharpTools.

The only way now is to replicate every Virtual Device with another virtual device and create a rule to sync them :frowning:

@Michael_Horton, you can add the Variable Connector device to SharpTools by following the instructions in the post below. It doesn’t show up in the SharpTools auth list because it doesn’t implement the core capabilities supported by SharpTools, but can still be found and authorized using the method.

1 Like

You guys are so cool!!!

Thank you!!

Apparently, I never used the RM Connector. :joy: I did a quick test before posting by creating a RM Connector Variable device directly, which can be authorized using the the method mentioned above, but not those created in RM’s Connector section, because the parent RM Connector device might not implement the needed capabilities.

That being said, I am wondering if it would make things easier for you if you use Virtual Switch instead of HE Variable to represent the HeadDemand status (true/false → on/off). So you don’t have to worry about syncing between the variables and the virtual switches.

1 Like

:frowning: not getting anywhere

Managed to get the Virtual Devices into Sharptools but they have no data :frowning:

And can’t find a way to actually get the variable content.

I use variables around Heating systems to avoid issue later.

Currently I have 7 zones in the house, about increase them.

Each zone is managed with a very simple rule and built in Apps for Thermostat Controller .

As each zone requests Heat it gets flagged as a VAR HeatDemand_Bathroom.

The Rule that updates that Variable also sends a command to the Valve to open.

I have a Trigger if ANY HeatDemand is TRUE then Turn on Boiler and Radiators.

Slightly more complex because the Rule that controls the actual boiler switch also performs a series checks determine if Turning on the heating is the right things to do.

This way I have just one place where all the safety logic resides and a single rule that touches the Boiler and radiator switches.

I’ll use Hubitat Dashboards for diagnosis Dashboards and use Sharptools for the end user displays so not an issue.

Thank you both for all your help

Very much appreciated!

Is there any reason why these variables cannot be replaced with the Virtual Switches? Or you may just need additional RM rules to sync the variable values to the mapping Virtual Switches to expose them to SharpTools.

I personally think using Virtual Switches may be more direct and you don’t need to worry about the sync between variables and Virtual Switches. Cannot speak for Hubitat and don’t know what you mean by the issue later, but since Virtual Switch is using the fundamental device handler the system supports, so it may just be more generally supported.

Ok I am struggling with this.

I have Text I would like to put on the SharpTools displays.

In Hubitat I have a Global Variable ‘Alert-Message’ this is displayed on the TV (if On) and I would also like to display on the Tablets using Sharptools.

Additionally I have an HE Global variable HolidayCountDown, that HE decrements at 00:01 every night and I would like to put this on Sharptool displays also.

I have Setup RuleManager Connectors for them both so they show up as devices, just can’t figure out how to get these into Sharptools.

@Michael_Horton, well this question came in just at the right time. :grinning: We just rolled out the rule HTTP Trigger feature this morning, and this would make it easer to pass Hubitat variables to SharpTools variables, which can be displayed in the dashboard(s) then.

Step 1: Create a rule in SharpTools to set variable based on the value passed in

  • Create a variable in SharpTools using the same type as your Hubitat variable (ex: String)
  • Create a rule in SharpTools using HTTP Trigger, and add a “value” parameter
  • In the rule flow, set the newly created variable using the Context Variable → Event → HTTP Event → Parameters → value (the parameter name you added from previous step)
  • Copy the Trigger URL and save the rule

Step 2: Create a rule in Hubitat to send HTTP request with the HE variable value to the SharpTools rule created in Step 1

  • Create a rule in Rule Machine, and to be triggered when the desired variable is changed
  • Add the “Send HTTP Request” action using the Trigger URL from the step 1, and add the ?value=%your_variable_name% in the end of URL so it will pass the desired variable value via the HTTP request.

Now whenever this HE variable is changed it will be synced to the SharpTools variable as well. More details and instructions about this Rule HTTP Trigger can be found in the help article below.

James - You are a scholar and a gentleman!!!

Got it working Thanks.

Cheeky question…

Anyway to change the font size ? I have given three tiles width and it sits tiny in the middle of them… I cannot find anything to tweak the text size.

1 Like

What type of SharpTools variable are you using? If it’s a Text variable, you can adjust the size in the tile settings:

image

If it’s a numeric variable, you would likely have to use Custom CSS. There’s a community maintained wiki with some snippets here:

:link: [WIKI] Custom CSS snippets, verified on SharpTools

1 Like

PERFECT!!!

The variable type is a Number from HE but might as well import as TEXT as all the manipulation has to be done in HE anyway.

1 Like