jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
198 stars 48 forks source link

send_command to helper group #254

Closed budmannxx closed 7 months ago

budmannxx commented 8 months ago

Describe the bug Not able to use Hubitat: send_command to send to helper groups

I'd like to use Hubitat: send_command to send the same command to multiple devices, e.g., multiple Inovelli Red dimmer switches. I've created a helper Group that includes all the light entities, but cannot choose that group in the "Entity*" dropdown within the hubitat.send_command action config screen.

To Reproduce

  1. Go to 'Settings --> Devices & services --> Helpers '
  2. Create a new Group helper and add the appropriate entities as members
  3. Go to 'Settings --> Automations' and crate a new automation
  4. Click 'Add Action --> Other actions --> Hubitat --> send_command'
  5. Attempt to add the new helper group created in #​1 above
  6. See error --> no error, but the helper group is not available in the dropdown

Screenshots

N/A **Environment** - Home Assistant version: <2024.2.0> - Core 2024.2.0 - Supervisor 2024.01.1 - Operating System 11.5 - Frontend 20240207.0 - Integration version: <0.9.22>
budmannxx commented 8 months ago

I just tried typing the Entity ID into the field and while the autocomplete doesn't work, upon saving the automation, the Entity ID is resolved to the correct Name value. But, running the action results in "Unknown error"

budmannxx commented 8 months ago

Autocomplete of the helper group entity does work after the initial manual typing of the Entity ID and saving. But running command still does not work (same "Unknown error" each time)

budmannxx commented 8 months ago

I tried another way, by creating a device group within Hubitat and exposing that to HA via the Maker API. This gets the group "device" to show in the Entity dropdown via autocomplete, but sending a startNotification to this entity also results in the "unknown error".

jason0x43 commented 7 months ago

Sending command to a Home Assistant group probably won't work, at least not without updating the integration. The integration's send_command service simply makes a REST request to the Hubitat device associated with a HA entity. Since there is no Hubitat device associated with an HA group, the service will error.

A Hubitat group has better odds of working, because it will be a Hubitat device that can be addressed by the integration. It sounds like that solution may need some work, too.

I've never tried using send_command with device groups, but I'll take a look to see what might be needed.

jason0x43 commented 7 months ago

I just tried using a Hubitat light group, and HA seems to be able to interact with it in the same way as a normal light. I was able to use send_command to send an on command to the light group, and the lights turned on.

What kind of device group did you create in Hubitat? You can get the device capabilities to see what commands the device group supports.

budmannxx commented 7 months ago

Agreed, I can turn the lights connected to the dimmers on from HA, as your test confirmed. I created a group of Dimmers in the Hubitat "Groups and Scenes" app (group Type = "Group-2.1"). My actual dimmers are Inovelli Red Z-Wave dimmers (model LZW31-SN), which have an LED notification bar next to the physical paddle switch. For an individual dimmer, I'm able to send (via both Hubitat and HA) a startNotification command to get the LED strip to change colors, patterns, etc. This startNotification is what's not working when using the integration from HA. And, in the group "device" that's created withing Hubitat, there isn't an option to send a startNotification, so that could be part of the issue here.

I'm attaching the output of the capabilities from the Maker API for both an individual dimmer that's a member of the group, and for the group "device" itself.

Group device Capabilities.json Individual member device Capabilities.json

Edit: Here's the relevant section of the debut log when I attempt to send the startNotification to the Group "device" debug_log.txt

jason0x43 commented 7 months ago

What about the commands for each device? The info you pulled from Hubitat for each device should also have included a commands section, like:

{
  "id": "15",
  "name": "Virtual Window",
  ...
  "attributes": [
    ...
  ],
  "capabilities": [
    ...
  ],
  "commands": [
    "close",
    "open"
  ]
}

The fact that trying to issue a startNotification command causes an HTTP 500 error from Hubitat does suggest that startNotification isn't a supported command for the target device/group.

budmannxx commented 7 months ago

Looks like you nailed it, the commands for the Group device are only: off, on, setLevel, startLevelChange, and stopLevelChange. No startNotification in the commands section. So, this seems to be a limitation on the Hubitat side, in the Groups and Scenes app. Thanks for looking.

budmannxx commented 7 months ago

I was hoping this HA blueprint/script would work:

I'm guessing this can't currently be used because that script is attempting to send the commands via the HA Z-wave native integration, and I'm attempting to use your HA-Hubitat integration (and, therefore, the Maker API).

EDIT: I guess it can't work the way I'd hoped, since the Maker API is limited to the commands noted above. So close, yet so far :)

jason0x43 commented 7 months ago

I'm going to close this since it doesn't seem like there's an issue with the integration.

Regarding z-wave, have you considered getting an adapter and moving your z-wave devices over to HA?

budmannxx commented 7 months ago

Agreed on closing this, thanks. Appreciate the suggestion but my HA is a VM and I'm sure adding radio heard is possible, the Hubitat has been solid for me so I'd prefer to keep using it.