[ST Edge] How to create child devices with edge?

@Mariano_Colmenarejo

Have you tried the following?

local function on_handler(_, device, command)
  -- capability reference
  local attr = capabilities.switch.switch

  -- parse component to endpoint
  local endpoint = device:get_endpoint_for_component_id(command.component)

  -- send zigbee event
  device:send(OnOff.server.commands.On(device):to_endpoint(endpoint))

  -- send platform event
  device:emit_event_for_endpoint(
    endpoint,
    attr.on())
end

Notice how the switch event is divided into two additional tasks:

  1. Send the Zigbee message to the device.
  2. Push platform event to confirm the device command.
1 Like