(Hubitat) How to send custom device commands (outside normal Capabilities)

As of 3.11.1 it is possible to use a new generic “Command” capability to execute any command on any device. Details on how to use this to follow from Bill.

Original thread from older Google Groups forum:

To send a generic command to any Hubitat device:

  1. Add Command to the Device object’s Capabilities. Unlike the other Capabilities, this is not automatically assigned during synchronization. You will need to manually enter it.

  2. Add a DataAction to your control that sets the YourDeviceName.Command attribute. The Value you supply is the command name. The Value will be appended to the Maker API URL without any manipulation.

When to use?

  • If the command you need to send is not listed on this Hubitat Driver page, you’ll most likely need this new Command capability. Most commands listed on the Driver page are already handled internally when you request a value change on one of your attributes.

Hubitat_CommandCapability.hrp (4.0 KB)

1 Like

Hi Bill,

Thanks for adding this feature.

This seems to work fine when executing for instance a button clicked event on a page linked to MainPage.xaml (EventTrigger ‘clicked’ --> DataAction: “LhBedroomTv.Command” value = mute). However when using either ‘@device.Command’ or ‘devicename.Command’ within a template assigned to a device to appear as part of a group, neither seems to send the ‘command’ to MakerApi on Hubitat (going by Hubitat log output). Am I misunderstanding the intention here?

I was basically using a modified copy of the supplied ‘MediControllerDetails.xaml’ template as a starting point for a virtual TV remote.

Thanks for any help you can offer.



I beleive it’s case-sensitive so you’d need to use @Device.Command. Also, MediaControllerDetails.xaml uses @Device.MediaCommand. You’ll need to replace MediaCommand with just Command. Other than that, everything should work. You should be able to create a template for it.

One other thing that could make that a little difficult for you to reuse is many of the buttons are enabled/disabled based on the SupportedMediaCommands attribute. You don’t have that. You’ll need to delete all of those conditions.

Oh sorry, my bad, I was using ‘@Device.Command’ (capital D), I just messed up in the email to you. Ok it must be the enabled/disabled thing. I’ll give it another look.

Thanks again.



It was the enabled/disabled state of the controls. Stupidly I didn’t notice all controls on the page were dimmed a little until I saw the contrast when one was enabled. Doh, sorry for wasting your time.



1 Like

Is it posible to have multiple custom commands linked to one device?

Yes, for @Joel_Groves I know his devices all had several commands. If you look at his JSON from that post in the Google Group, 1 of his devices had “back”, “chdown”, “chup”, “configure”, etc. All of those commands could be sent with 1 Home Remote Device object.

In that example I shared, you can copy & paste that Button and just update the Value for that DataAction. They can all share the same HubitatDevice.Command binding.

1 Like

Works great! Thank you! :slight_smile:

1 Like

Is it possible to to send a secondary value?

Send Device Command (replace [Device ID] with actual subscribed device id and [Command] with a supported command. Supports optional [Secondary value][Device ID]/[Command]/[Secondary value]?access_token=xxxxxxxxxxxxxxxxxxxxxxx

Yes. Just set the Value in the action to your combined value.

[Command]/[Secondary value]

Well that was easy.

What about if I want to pass an attribute from one device to another, or pass a variable.
Example value: Command/device.attribute or Command/variableName.

I’ve tested in different ways, but Hubitat only receives the exact text string that i put i the textbox.

I originally posted that you will need a ScriptAction. This is no longer necessary in

Original Post:

What you could do is use a ScriptAction to build & send your command. I generally discourage use of ScriptActions but in this case you don’t really have another choice until I add reference support to the DataAction Value.

For the time being, you could write a script that looks like this:

var attributeValue = App.GetDeviceAttribute("YourReferenceDevice.Attribute");
App.SetDeviceAttribute("YourCommandDevice.Command", "Command/" + attributeValue);

Great! Thank you! :slight_smile:

I updated my original response to you showing the new preferred way of passing an attribute from 1 device to another.