Endpoint_to_component ambiguity?

I’m writing a driver for a device that has a root device and 4 endpoints.
Each of the endpoints represent a different component in the device. For example, endpoints 1 and 2 are two different multilevel sensors (SIG1 and SIG2) and 3 and 4 are two binary switches (REL1 and REL2).
The root device has command classes that that mix those components. For example, its binary switch command class maps to REL1, and its multilevel sensor command class maps to SIG1.

In my driver, I sometimes see commands coming from endpoint 0 (the root device).
When the endpoint_to_component method is called, all I see is endpoint 0, but I don’t have access to the command class itself, so I don’t know if this is SIG1 or REL1.

Is there a way to somehow disambiguate it? Can I access the command somehow?

If you have a custom zwave_handler for these events, have you seen the content of the command variable received? For example, this is a custom handler for a Z-Wave motion sensor:

--I only print the command for testing purposes:
local function notification_handler(self, device, cmd)
  print(cmd)
end

--This is the result:
{args={alarm_level=0, alarm_type=0, event="STATE_IDLE", event_parameter="\x08", notification_status="ON", notification_type="HOME_SECURITY", v1_alarm_level=0, v1_alarm_type=0, z_wave_alarm_event=0, z_wave_alarm_status="ON", z_wave_alarm_type="BURGLAR", zensor_net_source_node_id=0}, cmd_class="NOTIFICATION", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x00\x00\x00\xFF\x07\x00\x01\x08", src_channel=0, version=3}