How does one model a dimmable switch as equipment properly?

I’ve been trying to model my home using Equipment with little success. Most of my wall switches are also dimmable, and some also report power back – using a mixture of Inovelli Red (zwave) and Blue (zigbee) switches.

Here is what the equipment looks like :

The problem is, no matter what mix of aggregation I choose for the equipment group, I cannot get the equipment-level on/off to work correctly. Each individual item works correctly but the overall equipment does not. When I click off at the group level, all items receive the OFF command (including brightness), which immediately turns also turns the state on but leaves the group in the “off” state.

Turning the “Equipment” back on does nothing – in fact, if I manually turn state off and then turn the Equipment on, still nothing – and no message in the logs to indicate that “ON” is being sent to all items.

Am I trying to do something that is outside the use-case for equipment in the semantic model, or is there a better way to model this?

That’s probably because the Equipment is largely just a label and a package. It’s not meant to be used to control the Points that make it up. At least not without creating a custom widget that interacts with the Points directly.

Yes, that’s how Groups work. When you send a command to a Group, the command gets sent to all the Group’s members. An Equipment is just a Group with a special well known tag. Nothing more.

That’s odd behavior that would need more experimentation to see what is going on. But in general, if you have a Group with mixed Item types, it doesn’t work well to try to aggregate and send commands to the Group.

Yes

Options include using a Group outside the semantic model for this, work with the Brightness Item individually and not through the Equipment, create a custom widget that represents the whole equipment that you can add as the default stand alone widget for the Equipment and put that on your pages. I’m sure there are more.

1 Like

Thank you very much for your answers – very helpful. “create a custom widget that represents the whole equipment that you can add as the default stand alone widget for the Equipment” really pointed me in the right direction. I almost have the functionality I am looking for with the light switch from the marketplace (and I see that you are the author!)

Here is what I have –
image

This works, but I would like the ability to perform the popup group details action if the widget is clicked on outside of the toggle that performs on/off (or, alternatively, a separate button on the widget that would pop up group details). Thoughts on how to achieve this?

Thank you again!

This doesn’t look like it’s possible. There is no way to add an additional action to a toggle widget. To achieve this you’ll have to create a composite widget that includes two controls, one for the toggle and the other for the pop-up.

Here’s a thread that gives you an example framework to start from.

Justin & Rich – thank you so much for your help. I pretty much have what I was initially after.

uid: jjr_lightswitch_list_widget
tags:
  - light
  - list
props:
  parameters:
    - description: The label for the widget
      label: Title
      name: title
      required: false
      type: TEXT
    - context: item
      description: The Group popup item when label is clicked
      label: popupItem
      name: popupitem
      required: false
      type: TEXT
    - context: item
      description: The item for on/off toggle
      label: toggleItem
      name: toggleitem
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Jan 18, 2023, 11:26:55 PM
component: f7-list-item
config: {}
slots:
  title:
    - component: oh-link
      config:
        iconF7: lightbulb
        text: =(props.title==null)? props.popupitem:props.title
        iconSize: 32
        iconColor: '=(items[props.toggleitem].state == "ON") ? "yellow" : "gray"'
        color: '=(items[props.toggleitem].state == "ON") ? "yellow" : "gray"'
        textColor: black
        action: group
        actionGroupPopupItem: =props.popupitem
  after-title:
    - component: oh-toggle
      config:
        style:
          position: absolute
          left: calc(100% - 60px)
        class:
          - align-items-right
        color: '=(items[props.toggleitem].state == "ON") ? "yellow" : "gray"'
        iconColor: '=(items[props.toggleitem].state == "ON") ? "yellow" : "gray"'
        item: =props.toggleitem

The widget above gives me this:
image

The toggle button works, as does clicking on the label to bring up the group popup. The only thing at this point is that I have to manually set the title to something more friendly (“Basement Office Light 1”) as I could not find a way to use anything like “popupitem.label” to get the display name – is the name/label of the item accessible in the widget?

Also – from a group perspective, can I set the state of an “Equipment” without aggregating all of the members? If not, I know I can work around it but it’d be more intuitive.

Thanks again for all of your help!

-JJ

Not directly. The only way to get that information is to return a complete definition of the items through the API and the only way to do that is with an oh-repeater component. You can build a component that uses a repeater to retrieve only a single item (although this is not really the intended use of a “repeater”) and then access the label through that, but an API call takes time and one of the way the UI minimizes its response time is to limit those API calls to only critical ones. If you have a lot of extra calls just to get the labels of some items, you would see a significant downgrade in the responsiveness of your UI.

No. There’s just no mechanism for this. The only way for a group item to have a state is for it to have an aggregation function and an aggregation function applies to all of the groups members.

You could also use the new tap&hold functionality which is at least available for oh-button and oh-label-card.
Especially for mobile phones this would be the more intuitive way