[ST Edge] Is there a way to dynamically change ocfDeviceType?

Hi,

Is there a way to change device’s ocfDeviceType dynamically?
I suppose I could have multiple device profiles with only ocfDeviceType different and then change them with

https://developer-preview.smartthings.com/edge-device-drivers/device.html#st.Device.try_update_metadata

but it seems too complicated to just change an icon.

Another question, is it possible to create device profile on the fly?
I perhaps could read the original device profile and just change the icon and profile’s name and then update device metadata to the newly created profile.

Thanks

1 Like

Hi, @ygerlovin!

No, it cannot be modified from within the driver. try_update_metadata is an excellent approach, the specified device profile in the parameter overwrites the old one.

No, creating device profiles dynamically is not supported yet, even for the try_update_metadata, the device profile must already exist in the driver package.

I’ve been discussing your use case with the engineering team, when I have more information on other possible alternatives, I’ll share it with you.

1 Like

@nayelyz

Nayely,

The API reference suggests the devices endpoint has the ability to ‘update a device’. Specifically it implies that is is possible to change the label, location (sometimes) and room, and change the categories and icon for each component (accompanied by a broken link to /devicecategories and with no clues offered as to how icons are defined).

Elsewhere (probably buried in comments in the Core SDK or somewhere like that) it is implied that only changing the label actually works.

Would you happen to know what the truth of the matter is? The ability for an end user to be able to change the category and/or icon seems to be pretty much the functionality that has been asked about lately.

OK the mobile app makes a pig’s ear of categories at the moment, which is why community developers have been using ocfDeviceType in Edge drivers, but if it stopped making a mess of them it rather seems the required functionality is documented, if not actually implemented.

1 Like

I see, following the instructions in the API document the request is successful but the changes are not applied. I’m checking this with the engineering team, I’ll let you know more as soon as I receive their feedback.

1 Like

Hi @nayelyz,

I noticed the latest app update allows changing device icons (for some devices).
Is it something that can be done from within edge driver?
Thanks

Yes, I have an Edge driver where I can change the icon, but it depends on the category you assigned to the device in the profile, check this post where the available categories are listed:

1 Like

Hi @nayelyz and @SamsungZell
Thanks for the update.
Is there any new way to change icon from the driver?
In addition to
try_update_metadata
that requires device profile for each icon.
Thank you

Do you mean for devices that use a different category than Switch/light, Outlet, Contact Sensor or Multi Sensor?
Each category has different icon options.

@nayelyz I mean, this options allows changing the icon without changing the driver. Is this is a GUI only option or some new function was added to st.device.lua to allow changing device icon from the edge driver code.
Perhaps, Device:try_update_metadata may now receive an icon name only, instead of the complete device profile?

I will check this with the engineering team and let you know their feedback.

1 Like

Hi @nayelyz ,

Any update regarding changing an icon with try_update_metadata call?

I have another use case for multi gang switches.
Some users prefer multi tile dashboard view, rather than entering detailed view to control specific component for multicomponent devices.
Others prefer small icons for each device.

Now, to implement user selectable view it is required to have 2 identical profiles with only different vid.
It would be great if we could change profiles’ vid from within the driver.
I suppose
try_update_metadata
is a good candidate for this.
Thanks

Yes, you can achieve this with try_update_metadata. There’s a feature request opened to change only the icon from the code so I will modify it to check if a feature to change specific parts of the device profile is possible.
Just a heads up, the request can take some time to be analyzed as they are prioritized based on the team’s workload.

2 Likes

It’s been my experience that config changes within detailView don’t take affect until you exit and come back. For example, changing the supported values for a list. I also tried changing the profile from settings. Just curious-- when/where are you making your profile changes?