Accessing a Multichannel device with the Api

I have recently received a Zen20 multi channel device. But I can’t figure out how to access each channel through the API. Any assistance would be appreciated.

{
  "deviceId":"d3edf236-0c5e-4473-a3ad-1aecd9ed8570",
  "name":"switch-multicomponent-generic-5",
  "label":"Zooz Power Strip",
  "manufacturerName":"SmartThingsCommunity",
  "presentationId":"899dd0b1-a3d7-3328-9676-ea43442d0a46",
  "deviceManufacturerCode":"027A-A000-A004",
  "locationId":"7b48bdb7-1aa5-4689-a8ee-4ad213b43b3e",
  "components":[
    {
      "id":"ch1",
      "label":"CH 1",
      "capabilities":[
        {
          "id":"switch",
          "version":1
        },
        {
          "id":"powerMeter",
          "version":1
        },
        {
          "id":"energyMeter",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"ch2",
      "label":"CH 2",
      "capabilities":[
        {
          "id":"switch",
          "version":1
        },
        {
          "id":"powerMeter",
          "version":1
        },
        {
          "id":"energyMeter",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"ch3",
      "label":"CH 3",
      "capabilities":[
        {
          "id":"switch",
          "version":1
        },
        {
          "id":"powerMeter",
          "version":1
        },
        {
          "id":"energyMeter",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"ch4",
      "label":"CH 4",
      "capabilities":[
        {
          "id":"switch",
          "version":1
        },
        {
          "id":"powerMeter",
          "version":1
        },
        {
          "id":"energyMeter",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"ch5",
      "label":"CH 5",
      "capabilities":[
        {
          "id":"switch",
          "version":1
        },
        {
          "id":"powerMeter",
          "version":1
        },
        {
          "id":"energyMeter",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"usb1",
      "label":"USB 1",
      "capabilities":[
        {
          "id":"platemusic11009.usbPort",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"usb2",
      "label":"USB 2",
      "capabilities":[
        {
          "id":"platemusic11009.usbPort",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    },
    {
      "id":"main",
      "label":"Main",
      "capabilities":[
        {
          "id":"switch",
          "version":1
        },
        {
          "id":"powerMeter",
          "version":1
        },
        {
          "id":"energyMeter",
          "version":1
        },
        {
          "id":"platemusic11009.firmware",
          "version":1
        },
        {
          "id":"platemusic11009.deviceNetworkId",
          "version":1
        },
        {
          "id":"refresh",
          "version":1
        }
      ],
      "categories":[
        {
          "name":"Switch",
          "categoryType":"manufacturer"
        }
      ]
    }
  ],
  "createTime":"2022-09-04T23:34:23.796Z",
  "parentDeviceId":"12734877-add5-4ef8-a2f6-0c26ba76d692",
  "profile":{
    "id":"4aa33c45-c273-3832-a7b0-17e6d4427d02"
  },
  "zwave":{
    "networkId":"B2",
    "driverId":"7333473f-722c-465d-9e5d-f3a6ca760489",
    "executingLocally":true,
    "hubId":"12734877-add5-4ef8-a2f6-0c26ba76d692",
    "networkSecurityLevel":"ZWAVE_S2_UNAUTHENTICATED",
    "provisioningState":"NONFUNCTIONAL"
  },
  "type":"ZWAVE",
  "restrictionTier":0,
  "allowed":[
    
  ]
}

Hi, @Jake_Mohl!
Could you provide more details, please? Which info are you trying to get or which action you’d like to perform?

@nayelyz I am attempting to use an example I believe you posted in another thread.

{
  "name":"Mirror switch events of main and light components",
  "actions":[
    {
      "if":{
        "changes":{
          "equals":{
            "left":{
              "device":{
                "devices":[
                  "32b92c1a-19cd-44c9-b05d-826456ecc322"
                ],
                "component":"main",
                "capability":"switch",
                "attribute":"switch"
              }
            },
            "right":{
              "string":"on"
            }
          }
        },
        "then":[
          {
            "command":{
              "devices":[
                "d3edf236-0c5e-4473-a3ad-1aecd9ed8570"
              ],
              "commands":[
                {
                  "component":"ch1",
                  "capability":"switch",
                  "command":"on"
                }
              ]
            }
          }
        ],
        "else":[
          {
            "if":{
              "changes":{
                "equals":{
                  "left":{
                    "device":{
                      "devices":[
                        "32b92c1a-19cd-44c9-b05d-826456ecc322"
                      ],
                      "component":"main",
                      "capability":"switch",
                      "attribute":"switch"
                    }
                  },
                  "right":{
                    "string":"off"
                  }
                }
              },
              "then":[
                {
                  "command":{
                    "devices":[
                      "d3edf236-0c5e-4473-a3ad-1aecd9ed8570"
                    ],
                    "commands":[
                      {
                        "component":"ch1",
                        "capability":"switch",
                        "command":"off"
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    },
    {
      "if":{
        "changes":{
          "equals":{
            "left":{
              "device":{
                "devices":[
                  "d3edf236-0c5e-4473-a3ad-1aecd9ed8570"
                ],
                "component":"ch1",
                "capability":"switch",
                "attribute":"switch"
              }
            },
            "right":{
              "string":"on"
            }
          }
        },
        "then":[
          {
            "command":{
              "devices":[
                "32b92c1a-19cd-44c9-b05d-826456ecc322"
              ],
              "commands":[
                {
                  "component":"main",
                  "capability":"switch",
                  "command":"on"
                }
              ]
            }
          }
        ],
        "else":[
          {
            "if":{
              "changes":{
                "equals":{
                  "left":{
                    "device":{
                      "devices":[
                        "d3edf236-0c5e-4473-a3ad-1aecd9ed8570"
                      ],
                      "component":"ch1",
                      "capability":"switch",
                      "attribute":"switch"
                    }
                  },
                  "right":{
                    "string":"off"
                  }
                }
              },
              "then":[
                {
                  "command":{
                    "devices":[
                      "32b92c1a-19cd-44c9-b05d-826456ecc322"
                    ],
                    "commands":[
                      {
                        "component":"main",
                        "capability":"switch",
                        "command":"off"
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

This command sent via the api will turn on and off the CH1.

{ "commands": [ { "component": "ch1", "capability": "switch", "command": "on", "arguments": [] } ] }

aaaaah ok, I think I got it. So, when you mention that the Zen20 is a multi-channel device, you’re referring to the different slots of the power strip, right?

But, what do you mean by “how to access each channel”?

In the case of sending a command, you’re sending it correctly to channel1 thanks to the component ch1 in the device profile.

When a physical device has different channels configured, they are known as components in SmartThings. The Edge driver maps the component to the corresponding channel. So, if you’ve confirmed that the commands to each channel (component) work correctly, in other places like Rules, you just need to make sure you use the correct componentID (ch1, ch2, etc.) according to the functionality you desire.

Was this information useful? Please let me know if you have any questions and we can revise everything again :smiley:

EDIT: My apologies, I found my error. It was very simple issues. I was missing the word “Bearer” in my hearlder. :man_facepalming:

Using the current structure of the rule I posted I am getting this Error with Tasker. I don’t know if it’s the app or if it’s something to do with the json it self.

Hi, @Jake_Mohl.

Is it possible for you to copy that text and share it with me, please? I’d like to check the content of the request in a formatted way. You can just paste the raw text, I can format it.

Raw json

{ “name”:“Mirror switch events of main and light components”, “actions”:[ { “if”:{ “changes”:{ “equals”:{ “left”:{ “device”:{ “devices”:[ “32b92c1a-19cd-44c9-b05d-826456ecc322” ], “component”:“main”, “capability”:“switch”, “attribute”:“switch” } }, “right”:{ “string”:“on” } } }, “then”:[ { “command”:{ “devices”:[ “d3edf236-0c5e-4473-a3ad-1aecd9ed8570” ], “commands”:[ { “component”:“ch1”, “capability”:“switch”, “command”:“on” } ] } } ], “else”:[ { “if”:{ “changes”:{ “equals”:{ “left”:{ “device”:{ “devices”:[ “32b92c1a-19cd-44c9-b05d-826456ecc322” ], “component”:“main”, “capability”:“switch”, “attribute”:“switch” } }, “right”:{ “string”:“off” } } }, “then”:[ { “command”:{ “devices”:[ “d3edf236-0c5e-4473-a3ad-1aecd9ed8570” ], “commands”:[ { “component”:“ch1”, “capability”:“switch”, “command”:“off” } ] } } ] } } ] } }, { “if”:{ “changes”:{ “equals”:{ “left”:{ “device”:{ “devices”:[ “d3edf236-0c5e-4473-a3ad-1aecd9ed8570” ], “component”:“ch1”, “capability”:“switch”, “attribute”:“switch” } }, “right”:{ “string”:“on” } } }, “then”:[ { “command”:{ “devices”:[ “32b92c1a-19cd-44c9-b05d-826456ecc322” ], “commands”:[ { “component”:“main”, “capability”:“switch”, “command”:“on” } ] } } ], “else”:[ { “if”:{ “changes”:{ “equals”:{ “left”:{ “device”:{ “devices”:[ “d3edf236-0c5e-4473-a3ad-1aecd9ed8570” ], “component”:“ch1”, “capability”:“switch”, “attribute”:“switch” } }, “right”:{ “string”:“off” } } }, “then”:[ { “command”:{ “devices”:[ “32b92c1a-19cd-44c9-b05d-826456ecc322” ], “commands”:[ { “component”:“main”, “capability”:“switch”, “command”:“off” } ] } } ] } } ] } } ] }

@Jake_Mohl, I copied the body, just changing the IDs and I was able to save the Rule.

I couldn’t find how to install the app you’re using, to make tests there. When it shows “Error: 1” does it provide a message about it?

Have you been able to create other Rules using this tool? Also, in the picture you shared, I still don’t see the word “Bearer” before the PAT…(BTW, I hid it in the picture for security purposes)