[ST Edge] Routines with Multiple Components

I am writing a driver for a Fan/Light combo and there are 2 on/off switches. Initially, I just coded it for the fan and everything worked fine with the fan being the “main” component. Then I added a second component for “light” so that I could add switch support for that as well. This multiple component device does not work with routines. The details screen works, but when adding it to a routine, the device is not listed. The single component version did show up in routines. Are there additional things that need to be defined to support routines in a multi-component device?

name: fan-light-combo
components:
- id: light
  capabilities:
  - id: switch
    version: 1
  - id: refresh
    version: 1
  categories:
  - name: Light
- id: main
  capabilities:
  - id: fanSpeed
    version: 1
  - id: refresh
    version: 1
  categories:
  - name: Fan

Have you seen the existing threads on issues with multicomponent drivers? There is quite a bit of discussion there. I’m not sure if they cover the exact issue that you are seeing, though. Hopefully someone else will know, or you will be able to tell from reading the other threads. :thinking:

[ST Edge] Issues with multi-component devices and third-party integrations

When will naming multi gang switches (in Edge Drivers) finally be fixed?

I did, but neither addressed why the device wouldn’t show up in routines. Oddly enough, my multi component device is now showing up in routines. My best guess is either a delayed cloud sync finally kicked in, or it has to do with upgrading the SmartThings mobile app. Can’t say which at this point.

1 Like

Paste your device presentation.
It is defined there how your device should behave in the routine pages.

Here is the documentation for details:

1 Like

I’ve also experienced delays with devices populating on the routines screen when I’m working on the driver. It’s not limited to multi-component devices - I had it happen with a single component device last night. I agree it’s likely lag somewhere in the cloud as it seems like waiting is the only fix.

1 Like

Yeah, I agree with @w35l3y, please share the presentation ID (we can query the configuration using this value). You can find it when you list the devices, it doesn’t matter if it’s the one generated by default, we want to check if it matches the device profile.

The configuration in all the views (dashboard, detail, and automation) depend on the presentation used by the device which in Edge is generated based on the profile.
This means:

  • They will appear in the ST app in the same order as they are included there.
  • The first capability will be used in the dashboard view
  • If the capability presentation doesn’t include a configuration for the view where it is included, nothing will be displayed.
    For example, in the case of Switch it has a configuration for all the views, but thermostatMode doesn’t have the dashboard view configuration.
    This means that, if we use thermostatMode first in our profile, the device won’t display any status in the dashboard view.

Use this command to verify the presentation configuration of each capability

smartthings capabilities:presentation thermostatMode 1 -j

You can see the presentation ID by listing the devices in the API and then query its configuration (presentation endpoint) to see if the new changes were added.

Also, verify you updated the driver correctly, this means:

  • Package the driver again
    smartthings edge:drivers:package driver_path
  • Assign that driver to the channel again
    smartthings edge:channels:assign
  • Install the driver again
    smartthings edge:drivers:install
  • When the profile is modified, it is best to install the device again or delete the ST app cache (Android only)
2 Likes

I didn’t define a presentation since my components were a Light and a Fan. I am using the default presentation for those components.

Default presentation probably will work if you move switch capability to the main component and remove light component.

As you divided into 2 separate components, then you would need custom device presentation.

Also, I think the order of components might interfere.
Consider testing main component as being the first component.
This shouldn’t be a problem, but we will never know, as API is in beta stage.

Have you done any testing to show that this is true? In my experience, profiles with multiple components function properly without a custom device presentation. The exception is the known issue regarding components that have a number in their ID, but that only impacts the sort order on the detail view.

I haven’t. It was an empirical thought based on the documentation and his report about actions not showing up in the automations.

This is the example in the docs.
It requires component id.
How would the automation know he has a component called “light” without a device presentation defined ?

The default presentation is generated based on the components and capabilities defined in the profile. From what I’ve seen, a profile that lacks a custom-defined vid works equally well regardless of whether the profile has one or many components.

Getting back on topic:

The device has been functioning properly in routines since post 3. No changes to the presentation are necessary.

The question is what changed between post 1 and post 3 to fix the issue. It could be something that @blueyetisoftware did while troubleshooting, such as re-packaging the driver. Or it could be cloud delays, possibly related to what was going on in that timeframe.

1 Like

You are correct. It is working fine in routines now. All I did between those posts was wait. My phone did auto update the ST app as well, hence the two options.

3 Likes

@philh30 / @w35l3y

Update on the routines. I am seeing some unexpected behavior in the configuration for a multi-component device. When I go into the settings screen, it is selecting a setting for my main switch by default, even if I only want to change the settings for a secondary component. For example, I have this Fan/Light combo with the fan being the “main” component. Both have a switch capability:

name: fan-light-combo
components:
- id: main
  capabilities:
  - id: fanSpeed
    version: 1
  - id: switch
    version: 1
  - id: refresh
    version: 1
  categories:
  - name: Fan
- id: light
  capabilities:
  - id: switch
    version: 1
  categories:
  - name: Light

Here is what I see when I open the setting in a routine. There is no way avoid changing the power setting for the fan if you want to automate the light.

@nayelyz / @andresg Is this a known issue?

I first encountered it on single component devices a couple of years ago. It is probably much older than that. It might have disappeared and reappeared in the meantime.

I didn’t understand.

What happens if you click to turn light on ?
It is iphone, isn’t it ? I don’t have iphone.

20220216_064945

No. That’s android. It doesn’t matter what is chosen for the light. The interface forces me to choose a power state for the main component as well.

This happens whenever the switch capability is included - it’s not specific to multi-component devices. My phone is Android and it allows me to do what @w35l3y demonstrated - simply unselect the switch capability so it’s not part of the automation.

That video seems to show a condition being selected. You can only have one selected.

@blueyetisoftware is trying to select an action and is seemingly being forced to choose between one of the three options for the switch in the main component. It can’t be deselected.

This came up in October last year in the context of Edge drivers for devices with a master switch and individual switches. It wasn’t possible to change only a component switch without choosing a state for the master switch.

It is much older than that though. I encountered it two years ago with a momentary switch. I couldn’t just select ‘push’, I was forced to select between toggle, on and off for the switch too…

I assumed it had been fixed a long time ago and I don’t have a device to test it on myself. Clearly @blueyetisoftware and others have found otherwise.

1 Like

20220216_140302

I was able to uncheck it. I just clicked on it.
It opens the page with “Turn on” checked, but then I tested other combinations even without any option checked.

“Plug 1” is the main component.
It is completely out of order.

2 Likes

Well, I feel a bit silly now. I was able to unselect the main component by tapping the selected option a second time. So if ON was selected by default, tapping ON again unselected that component. Seems to work. I was thrown off by the default selection and clicked everywhere except there.

4 Likes