Multi-Component Presentation

Does anyone know how to shrink this presentation into a single row with two switches? Something closer to the two different devices beneath it. The current presentation is taking up a 2x2 slot. I would prefer a 2x1. I would also like to change the icon for the second component and remove/change the label.

Maybe @Mariano_Colmenarejo ?

If it could be done, I don’t know how to do it.

It seems to have a fixed size to display between 2 and 5 groups.

The name of the group labels can only be changed in the creation of the presentation.

The label names are only created in presentation VID.
If you want to change only the names of the labels or the order of the groups once the VID has been created, it no longer allows this, since it does not consider it a change and always generates the same VID.

In order to generate another different VID, more things have to be changed and it is a problem to solve, I already mentioned it to @nayelyz

The profiles can be changed dynamically so that the user can choose the profile with single or multiple mosaic in preferences. This works pretty well now.

It would be nice if they enable a smaller multiple tile size

For the icon of groups other than main, I don’t know if it can be done.

In an example of the presentations API, it shows how to add more icons to the presentation, but I don’t know how to implement it.

1 Like

I think that can be done, SmartThings needs to share their trade secrets.

This can be seen in Labs/Universal Remote

Thanks. I will try just deleting the presentation object and recreating from scratch.

How do you set this up to allow a choice in preferences?

Hello

These are the steps I do:

  • I create VID presentations for multiple mosaic profile
    Single mosaic profile: Not need custom VID, with standard VID works fine
  • I add this changeProfile preference to the profile I want to have with two tiles.
preferences:  
  - name: "changeProfileThreePlug"
    title: "Select Tile Type"
    description: "Select Multi-Tile or Single-Tile Type:"
    required: false
    preferenceType: enumeration
    definition:
      options:
        "Multi" : "Multi-Tile Switch"
        "Single": "Single-Tile Switch"
      default: "Single"
  • I duplicate, by copying and pasting, the modified profile.
  • I change the name of one of them, for example I add -multi
name: three-outlet
name: three-outlet-multi
  • I add the VID corresponding to each profile.
    Single profile: Not need custom VID, with standard vid works

Multi Tile profile:

metadata:
  deviceType: SmartPlug
  ocfDeviceType: oic.d.smartplug
  deviceTypeId: SmartPlug
  mnmn: SmartThingsCommunity
  vid: f01d2c27-6cbe-30d9-b723-0ae68d117e63
  • In the init.lua:
    • In the template add the function to execute when a preference is changed, lifecycle infoChanged
---- Driver configure ---------
local zigbee_outlet_driver_template = {
  supported_capabilities = {
    capabilities.switch,
    capabilities.refresh
  },
  lifecycle_handlers = {
    init = device_init,
    driverSwitched = driver_Switched,
    infoChanged = do_preferences
  },
  • Add the function and the code that detects the change of the value of some preference. This will also work to detect and execute code for any other custom preferences, temperature reports…etc
  • Add the profile change code according to the chosen preference.
--- Update preferences after infoChanged recived---
local function do_preferences (self, device)
  for id, value in pairs(device.preferences) do
    print("device.preferences[infoChanged] >>>>", device.preferences[id])
    local oldPreferenceValue = device:get_field(id)
    local newParameterValue = device.preferences[id]
    if oldPreferenceValue ~= newParameterValue then
      device:set_field(id, newParameterValue, {persist = true})
      print("Preference changed Name:", id, "Old Value:",oldPreferenceValue, "New Value:", newParameterValue)
 
      ------ Change profile 
      if id == "changeProfileThreePlug" then
       if newParameterValue == "Single" then
        device:try_update_metadata({profile = "three-outlet"})
       else
        device:try_update_metadata({profile = "three-outlet-multi"})
       end
      end
     end
   end 
 end
  • When you change the mosaic you have to close the app and reopen the app so that the chosen mosaic is displayed

Hope this can help you

1 Like