Function "try_update_metadata()" update fail

Hello, I am currently coding a edge driver for matter sensor , In the matter sensor\init.lua file, there is a function called “check_for_battery” that is responsible for identifying the supported capabilities of the matter sensor and updating the driver’s metadata using try_update_metadata(profile=profile_name). However, an issue arises when the profile_name is “motion”, “contact”, or “illuminance” without quotation marks.

For example, if I have a matter sensor without a battery, it initially matches “motion-battery” in the fingerprint.yml file. Then, the “check_for_battery” function will check its supported capabilities, which in this case would be motion. Subsequently, try_update_metadata(profile=profile_name) will be executed with profile_name set to motion. What we expect is ST App will display a sensor device card without battery, However, upon viewing the sensor card details, the battery capability is still present, indicating that try_update_metadata() is not functioning as intended.

1 Like

So you have defined the various different profiles in your Edge driver package and there is a profile with the name set to 'motion'? Then try_update_metadata({profile = 'motion'}) doesn’t result in the profile being updated?

If you look at the device object in the API you should see the profile ID changing if try_update_metadata succeeds. It won’t change to anything recognisable, just to a different UUID. Is that happening?

Hi, @JOJOJO

Per your description, I understand your issue is replicated only when you omit the quotation marks in the try_update_metadata call, right?
The syntax shared by @orangebucket is correct, if you’re not using the command correctly it will fail, which explains the behavior you’re seeing. Can you confirm if using the correct syntax works, please?

I do use the quotation when execute try_update_metadata, and in case like “motion-contact”, “contact-humidity”, it works well. but in case like “motion”, “contact”, it’s not working. I pretty sure not the syntax problem.

Hi, I did not defined profiles in my Edge driver package, it was the original edge driver I used. I checked, profile ID will change after try_update_metadata executed.

Ah I understand now. I think you may have found a bug in the stock Matter Sensor driver.

I notice that the ‘motion.yml’ profile in the stock driver actually has the name matter-motion which doesn’t seem right to me. I’d expect the name to just be motion as everywhere else the name and the filename match and there doesn’t seem to be a motion profile to be selected by ‘check_for_battery()’. So I can see how that might go wrong. I guess there might not be many motion sensors around that don’t have batteries.

I can’t see why the other single capabilities should fail though.

@nayelyz

Yes, that’s what I want to point out. The profile name in motion.yml file do has the problem, In other hand profile like “contact.yml”, “pressure.yml” and “sensor.yml” have profile names that match their file names. However “try_update_metadata” still not working.

I test it by a motion sensor, it will first match the profile “motion-battery”, when I called try_update_metadata{"profile=“contact”}, It still shows the plugin with motion and battery capabilities. Therefore, I doubt that the try_update_metadata is not working.

ok, thanks for the extra info, @orangebucket. I’ll check this with the engineering team.

@JOJOJO, about the “contact” profile, could you verify the current profile assigned to the device? You can do it by getting the device’s details using this CLI command:

smartthings devices deviceId -j

Then query that device profile’s config with:

smartthings deviceprofiles deviceId -j

Seeing the capabilities assigned to the device also helps, remember sometimes the app can show the old configuration due to the saved cache. In Android, you sometimes need to go back to the dashboard view and enter the device again to refresh it.
In the meantime, I’ll see if I can test this behavior with another driver.

Update: I modified some things in this driver to turn it into a LAN driver, I assigned it the profile matter-motion-battery, then, I sent the command try_update_metadata with the fixed value for “contact” and it worked correctly, here’s how this function was changed:

local function check_for_battery(device)
  local profile_name = ""

  if device:supports_capability(capabilities.motionSensor) then
    profile_name = profile_name .. "-motion"
  end

  if device:supports_capability(capabilities.contactSensor) then
    profile_name = profile_name .. "-contact"
  end

  if device:supports_capability(capabilities.illuminanceMeasurement) then
    profile_name = profile_name .. "-illuminance"
  end

  if device:supports_capability(capabilities.temperatureMeasurement) then
    profile_name = profile_name .. "-temperature"
  end

  if device:supports_capability(capabilities.relativeHumidityMeasurement) then
    profile_name = profile_name .. "-humidity"
  end

  if device:supports_capability(capabilities.atmosphericPressureMeasurement) then
    profile_name = profile_name .. "-pressure"
  end

 --[[ if supports_battery_percentage_remaining(device) then
    profile_name = profile_name .. "-battery"
  end]]

  -- remove leading "-"
  profile_name = string.sub(profile_name, 2)
  print("profile name:"..profile_name)

  device:try_update_metadata({profile = "contact"})
  device:set_field(BATTERY_CHECKED, 1, {persist = true})
end

Something I forgot to mention is that when this change is successful, we get the infoChanged lifecycle, so, that’s another way to validate the change is being performed.

Hi, here is the detail profile info of the device after I changed profilename to “contact” in init.lua.

{
    "id": "c040b2f8-21da-3c79-82f1-5cddf87ddf17",
    "name": "motion-battery",
    "metadata": {
        "vid": "4ce5cd02-b568-3bed-b6d5-2ba2205fb525",
        "mnmn": "SmartThingsCommunity",
        "presentationId": "4ce5cd02-b568-3bed-b6d5-2ba2205fb525",
        "driverId": "4c3f37ed-7e09-41bd-ace4-a9bb7c23960e",
        "manufacturerName": "SmartThingsCommunity",
        "driverStatus": "DEVELOPMENT",
        "deviceProfileName": "motion-battery"
    },
    "migrationStatus": "NOT_MIGRATED",
    "status": "PUBLISHED",
    "preferences": [],
    "components": [
        {
            "label": "main",
            "id": "main",
            "capabilities": [
                {
                    "id": "motionSensor",
                    "version": 1,
                    "ephemeral": false
                },
                {
                    "id": "battery",
                    "version": 1,
                    "ephemeral": false
                },
                {
                    "id": "firmwareUpdate",
                    "version": 1,
                    "ephemeral": false
                },
                {
                    "id": "refresh",
                    "version": 1,
                    "ephemeral": false
                }
            ],
            "categories": [
                {
                    "name": "MotionSensor",
                    "categoryType": "manufacturer"
                }
            ]
        }
    ],
    "owner": {
        "ownerType": "IMPLICIT",
        "ownerId": "530"
    }
}

Thanks to your post I’ve discovered the Aqara P2 contact sensor can report battery level (although it always reports 100%) and voltage too (3.1V, I trust that more) even if in SmartThings stock drivers there’s no battery or voltage info because it loads the “contact” profile instead of the “contact-battery”.

In my case the issue was the check for the existence of the PowerSource cluster, I just skipped that part checking if the manufacturer was Aqara to return true in the supports_battery_percentage_remaining function.

Mmm interesting, could you reply the issue and send the following info, please?

  1. Driver log of when you execute the profile change to see the events called
  2. Hub logs after you tried to change the profile but failed
  1. In the Advanced Users app, enter the “Hubs” section
  2. Enter the corresponding Hub and click on “Dump Hub logs”
  3. Confirm the process by clicking on “Dump Hub logs” again in the pop-up.
  4. You’ll get a green box at the top confirming the Hub logs were requested.
  1. Take note of the timestamp when the change was attempted and share it with us including your timezone. For example: 11:00 am GMT-6
  2. Share the device’s name to look for its details.
  3. Confirm the email account registered in the forum is the same one you use for SmartThings. If not, please share it with me over DM
  4. Enable support access to your account:
  1. Go to the SmartThings Web (my.smartthings.com)
  2. Log in to your Samsung Account
  3. Select Menu (⋮) and choose Settings
  4. Toggle on Account Data Access
  5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.

I changed the matter sensor driver in the “edge driver” menu, and initially it didn’t work. However, after trying 2-3 times, it successfully switched to the desired driver, which in this case is pressure.

here is the driver log and the driver changed happened in 2024-06-13T09:41 UTC+8

2024-06-13T09:41:39.417612109+08:00 TRACE Matter Sensor  Received event with handler driver_lifecycle
2024-06-13T09:41:57.042190168+08:00 TRACE Matter Sensor  Setup driver matter-sensor with lifecycle handlers:
DeviceLifecycleDispatcher: matter-sensor
  default_handlers:
    infoChanged:
    init:
    driverSwitched:
  child_dispatchers:

2024-06-13T09:41:57.064310353+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Capability handlers:
CapabilityCommandDispatcher: matter-sensor
  default_handlers:
    refresh:
      refresh
  child_dispatchers:

2024-06-13T09:41:57.086258581+08:00 INFO Matter Sensor  Created dispatcher [SecretDataDispatcher]matter-sensor that had no handlers
2024-06-13T09:41:57.098154297+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Secret Data handlers:
SecretDataDispatcher: matter-sensor
  default_handlers:
  child_dispatchers:

2024-06-13T09:41:57.117767652+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Matter handlers:
MatterMessageDispatcher: matter-sensor
  default_handlers:
    attr:
      AttributeReportHandler: cluster: IlluminanceMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: TemperatureMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: PressureMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: BooleanState, attribute: StateValue
      AttributeReportHandler: cluster: RelativeHumidityMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
      AttributeReportHandler: cluster: PowerSource, attribute: BatPercentRemaining
    event:
    cmd_response:
  child_dispatchers:

2024-06-13T09:41:57.137453429+08:00 TRACE Matter Sensor  Received event with handler driver_lifecycle
2024-06-13T09:41:57.154669234+08:00 INFO Matter Sensor  received driver startupState: {"hub_zigbee_id":"XMfB//7itOg=","hub_node_id":null,"hub_ipv4":"172.20.10.7"}
2024-06-13T09:41:57.166193552+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:41:57.183973200+08:00 INFO Matter Sensor  device init
2024-06-13T09:41:57.204107502+08:00 WARN Matter Sensor  Device does not support cluster 0x002F not adding subscribed attribute
2024-06-13T09:41:57.227526495+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> sending InteractionRequest: <InteractionRequest || type: SUBSCRIBE, info_blocks: [<InteractionInfoBlock || cluster: OccupancySensing, attribute: Occupancy>]>
2024-06-13T09:41:57.241664340+08:00 INFO Matter Sensor  device init end
2024-06-13T09:41:57.258926787+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.281687401+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:41:57.288112937+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: removed
2024-06-13T09:41:57.294426445+08:00 TRACE Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received unhandled lifecycle event: removed
2024-06-13T09:41:57.300889962+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.307473710+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:41:57.313613347+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: added
2024-06-13T09:41:57.320722957+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.327137415+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:41:57.332243569+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: driverSwitched
2024-06-13T09:41:57.339055661+08:00 TRACE Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received unhandled lifecycle event: added
2024-06-13T09:41:57.345350970+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.350190133+08:00 TRACE Matter Sensor  Received event with handler matter
2024-06-13T09:41:57.356533460+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: OccupancySensing, attribute: Occupancy, data: OccupancyBitmap: \x01>>]>
2024-06-13T09:41:57.362846218+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:41:57.370146941+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.375465864+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:41:57.381635444+08:00 INFO Matter Sensor  device init
2024-06-13T09:41:57.387930920+08:00 WARN Matter Sensor  Device does not support cluster 0x002F not adding subscribed attribute
2024-06-13T09:41:57.393493345+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> sending InteractionRequest: <InteractionRequest || type: SUBSCRIBE, info_blocks: [<InteractionInfoBlock || cluster: OccupancySensing, attribute: Occupancy>]>
2024-06-13T09:41:57.399905305+08:00 INFO Matter Sensor  device init end
2024-06-13T09:41:57.406626151+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.411692491+08:00 TRACE Matter Sensor  Found MatterMessageDispatcher handler in matter-sensor
2024-06-13T09:41:57.416678622+08:00 INFO Matter Sensor  Executing AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
2024-06-13T09:41:57.421809097+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> emitting event: {"attribute_id":"motion","capability_id":"motionSensor","component_id":"main","state":{"value":"active"}}
2024-06-13T09:41:57.428421248+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.433811676+08:00 TRACE Matter Sensor  Received event with handler matter
2024-06-13T09:41:57.440219554+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: OccupancySensing, attribute: Occupancy, data: OccupancyBitmap: \x01>>]>
2024-06-13T09:41:57.447937068+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.454142256+08:00 TRACE Matter Sensor  Found MatterMessageDispatcher handler in matter-sensor
2024-06-13T09:41:57.460710762+08:00 INFO Matter Sensor  Executing AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
2024-06-13T09:41:57.469473170+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> emitting event: {"attribute_id":"motion","capability_id":"motionSensor","component_id":"main","state":{"value":"active"}}
2024-06-13T09:41:57.550987767+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:41:57.930443861+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:41:57.939980757+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: infoChanged
2024-06-13T09:41:57.946203769+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:41:57.950968260+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:21.302061876+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:42:21.428275862+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: removed
2024-06-13T09:42:21.439935279+08:00 TRACE Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received unhandled lifecycle event: removed
2024-06-13T09:42:21.450580579+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:21.457249909+08:00 TRACE Matter Sensor  Received event with handler driver_lifecycle
2024-06-13T09:42:21.467677693+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:42.633204888+08:00 TRACE Matter Sensor  Setup driver matter-sensor with lifecycle handlers:
DeviceLifecycleDispatcher: matter-sensor
  default_handlers:
    driverSwitched:
    init:
    infoChanged:
  child_dispatchers:

2024-06-13T09:42:42.663253481+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Capability handlers:
CapabilityCommandDispatcher: matter-sensor
  default_handlers:
    refresh:
      refresh
  child_dispatchers:

2024-06-13T09:42:42.697776711+08:00 INFO Matter Sensor  Created dispatcher [SecretDataDispatcher]matter-sensor that had no handlers
2024-06-13T09:42:42.737952613+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Secret Data handlers:
SecretDataDispatcher: matter-sensor
  default_handlers:
  child_dispatchers:

2024-06-13T09:42:42.768145342+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Matter handlers:
MatterMessageDispatcher: matter-sensor
  default_handlers:
    attr:
      AttributeReportHandler: cluster: IlluminanceMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: TemperatureMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: PressureMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: BooleanState, attribute: StateValue
      AttributeReportHandler: cluster: RelativeHumidityMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
      AttributeReportHandler: cluster: PowerSource, attribute: BatPercentRemaining
    event:
    cmd_response:
  child_dispatchers:

2024-06-13T09:42:42.788575539+08:00 TRACE Matter Sensor  Received event with handler driver_lifecycle
2024-06-13T09:42:42.815652410+08:00 INFO Matter Sensor  received driver startupState: {"hub_zigbee_id":"XMfB//7itOg=","hub_node_id":null,"hub_ipv4":"172.20.10.7"}
2024-06-13T09:42:42.846539750+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:42:42.880407308+08:00 INFO Matter Sensor  device init
2024-06-13T09:42:42.885941748+08:00 INFO Matter Sensor  entering battery cheking----------------------
2024-06-13T09:42:42.939538270+08:00 INFO Matter Sensor  
2024-06-13T09:42:42.953607065+08:00 WARN Matter Sensor  Alias: PowerSourceFeature => Feature
2024-06-13T09:42:42.959535433+08:00 INFO Matter Sensor  -motion
2024-06-13T09:42:42.971754237+08:00 INFO Matter Sensor  remove leading--------------------------
2024-06-13T09:42:42.978255901+08:00 INFO Matter Sensor  motion
2024-06-13T09:42:42.990639373+08:00 INFO Matter Sensor  updated
2024-06-13T09:42:42.996313951+08:00 WARN Matter Sensor  Device does not support cluster 0x002F not adding subscribed attribute
2024-06-13T09:42:43.016112422+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> sending InteractionRequest: <InteractionRequest || type: SUBSCRIBE, info_blocks: [<InteractionInfoBlock || cluster: OccupancySensing, attribute: Occupancy>]>
2024-06-13T09:42:43.030071189+08:00 INFO Matter Sensor  device init end
2024-06-13T09:42:43.040305444+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:43.050815686+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:42:43.059563060+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: added
2024-06-13T09:42:43.071261292+08:00 TRACE Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received unhandled lifecycle event: added
2024-06-13T09:42:43.077592666+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:43.091397885+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:42:43.099002664+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: driverSwitched
2024-06-13T09:42:43.114288767+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:42:43.121459388+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:43.129845027+08:00 TRACE Matter Sensor  Received event with handler matter
2024-06-13T09:42:43.143379798+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: OccupancySensing, attribute: Occupancy, data: OccupancyBitmap: \x01>>]>
2024-06-13T09:42:43.159136624+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:43.165589229+08:00 TRACE Matter Sensor  Found MatterMessageDispatcher handler in matter-sensor
2024-06-13T09:42:43.176162482+08:00 INFO Matter Sensor  Executing AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
2024-06-13T09:42:43.183815112+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> emitting event: {"attribute_id":"motion","capability_id":"motionSensor","component_id":"main","state":{"value":"active"}}
2024-06-13T09:42:43.200936172+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:44.167600348+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:42:44.354900776+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: infoChanged
2024-06-13T09:42:44.409505543+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:42:44.506288003+08:00 INFO Matter Sensor  info changing--------------------------
2024-06-13T09:42:44.526276171+08:00 WARN Matter Sensor  Device does not support cluster 0x0403 not adding subscribed attribute
2024-06-13T09:42:44.532859211+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> sending InteractionRequest: <InteractionRequest || type: SUBSCRIBE, info_blocks: [<InteractionInfoBlock || cluster: OccupancySensing, attribute: Occupancy>]>
2024-06-13T09:42:44.549383736+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:44.559857497+08:00 TRACE Matter Sensor  Received event with handler matter
2024-06-13T09:42:44.575266080+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: OccupancySensing, attribute: Occupancy, data: OccupancyBitmap: \x01>>]>
2024-06-13T09:42:44.581334586+08:00 TRACE Matter Sensor  Found MatterMessageDispatcher handler in matter-sensor
2024-06-13T09:42:44.590303224+08:00 INFO Matter Sensor  Executing AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
2024-06-13T09:42:44.601548807+08:00 WARN Matter Sensor  Attempted to generate event for 01f1ea25-3d57-4d30-97e6-6d3133d94b47.main but it does not support capability Motion Sensor
2024-06-13T09:42:44.610915288+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:42:44.622404457+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:42:44.632045010+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: infoChanged
2024-06-13T09:42:44.642950471+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:42:44.657462378+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:07.911423209+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:43:08.059364201+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: removed
2024-06-13T09:43:08.073365197+08:00 TRACE Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received unhandled lifecycle event: removed
2024-06-13T09:43:08.079103535+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:08.088404216+08:00 TRACE Matter Sensor  Received event with handler driver_lifecycle
2024-06-13T09:43:08.093522239+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:22.681817236+08:00 TRACE Matter Sensor  Setup driver matter-sensor with lifecycle handlers:
DeviceLifecycleDispatcher: matter-sensor
  default_handlers:
    driverSwitched:
    infoChanged:
    init:
  child_dispatchers:

2024-06-13T09:43:22.700149024+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Capability handlers:
CapabilityCommandDispatcher: matter-sensor
  default_handlers:
    refresh:
      refresh
  child_dispatchers:

2024-06-13T09:43:22.725869615+08:00 INFO Matter Sensor  Created dispatcher [SecretDataDispatcher]matter-sensor that had no handlers
2024-06-13T09:43:22.741292900+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Secret Data handlers:
SecretDataDispatcher: matter-sensor
  default_handlers:
  child_dispatchers:

2024-06-13T09:43:22.756791980+08:00 TRACE Matter Sensor  Setup driver matter-sensor with Matter handlers:
MatterMessageDispatcher: matter-sensor
  default_handlers:
    attr:
      AttributeReportHandler: cluster: IlluminanceMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: TemperatureMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: PressureMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: BooleanState, attribute: StateValue
      AttributeReportHandler: cluster: RelativeHumidityMeasurement, attribute: MeasuredValue
      AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
      AttributeReportHandler: cluster: PowerSource, attribute: BatPercentRemaining
    event:
    cmd_response:
  child_dispatchers:

2024-06-13T09:43:22.770873644+08:00 TRACE Matter Sensor  Received event with handler driver_lifecycle
2024-06-13T09:43:22.786095321+08:00 INFO Matter Sensor  received driver startupState: {"hub_zigbee_id":"XMfB//7itOg=","hub_node_id":null,"hub_ipv4":"172.20.10.7"}
2024-06-13T09:43:22.803233789+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:43:22.815383544+08:00 INFO Matter Sensor  device init
2024-06-13T09:43:22.840100138+08:00 INFO Matter Sensor  entering battery cheking----------------------
2024-06-13T09:43:22.845844098+08:00 INFO Matter Sensor  
2024-06-13T09:43:22.850891032+08:00 WARN Matter Sensor  Alias: PowerSourceFeature => Feature
2024-06-13T09:43:22.857202083+08:00 INFO Matter Sensor  -motion
2024-06-13T09:43:22.863534082+08:00 INFO Matter Sensor  remove leading--------------------------
2024-06-13T09:43:22.868773544+08:00 INFO Matter Sensor  motion
2024-06-13T09:43:22.874682214+08:00 INFO Matter Sensor  updated
2024-06-13T09:43:22.879832845+08:00 WARN Matter Sensor  Device does not support cluster 0x002F not adding subscribed attribute
2024-06-13T09:43:22.908064639+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> sending InteractionRequest: <InteractionRequest || type: SUBSCRIBE, info_blocks: [<InteractionInfoBlock || cluster: OccupancySensing, attribute: Occupancy>]>
2024-06-13T09:43:22.915028031+08:00 INFO Matter Sensor  device init end
2024-06-13T09:43:22.920774448+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:22.926966558+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:43:22.933565049+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: added
2024-06-13T09:43:22.939377350+08:00 TRACE Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received unhandled lifecycle event: added
2024-06-13T09:43:22.944431363+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:22.949955516+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:43:22.957142296+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: driverSwitched
2024-06-13T09:43:22.962837572+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:43:22.969568205+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:22.975947431+08:00 TRACE Matter Sensor  Received event with handler matter
2024-06-13T09:43:22.980877548+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: OccupancySensing, attribute: Occupancy, data: OccupancyBitmap: \x01>>]>
2024-06-13T09:43:22.987928812+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:22.995551207+08:00 TRACE Matter Sensor  Found MatterMessageDispatcher handler in matter-sensor
2024-06-13T09:43:23.001766306+08:00 INFO Matter Sensor  Executing AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
2024-06-13T09:43:23.009092225+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> emitting event: {"attribute_id":"motion","capability_id":"motionSensor","component_id":"main","state":{"value":"active"}}
2024-06-13T09:43:23.015530171+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:23.537223402+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:43:23.679989775+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: infoChanged
2024-06-13T09:43:23.766924994+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:43:23.803462383+08:00 INFO Matter Sensor  info changing--------------------------
2024-06-13T09:43:23.870315773+08:00 WARN Matter Sensor  Device does not support cluster 0x0403 not adding subscribed attribute
2024-06-13T09:43:23.888048027+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> sending InteractionRequest: <InteractionRequest || type: SUBSCRIBE, info_blocks: [<InteractionInfoBlock || cluster: OccupancySensing, attribute: Occupancy>]>
2024-06-13T09:43:23.917900135+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:23.925627020+08:00 TRACE Matter Sensor  Received event with handler matter
2024-06-13T09:43:23.932107070+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received InteractionResponse: <InteractionResponse || type: REPORT_DATA, response_blocks: [<InteractionResponseInfoBlock || status: SUCCESS, <InteractionInfoBlock || endpoint: 0x01, cluster: OccupancySensing, attribute: Occupancy, data: OccupancyBitmap: \x01>>]>
2024-06-13T09:43:23.939126350+08:00 TRACE Matter Sensor  Found MatterMessageDispatcher handler in matter-sensor
2024-06-13T09:43:23.945480089+08:00 INFO Matter Sensor  Executing AttributeReportHandler: cluster: OccupancySensing, attribute: Occupancy
2024-06-13T09:43:23.951646545+08:00 WARN Matter Sensor  Attempted to generate event for 01f1ea25-3d57-4d30-97e6-6d3133d94b47.main but it does not support capability Motion Sensor
2024-06-13T09:43:23.958445311+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled
2024-06-13T09:43:23.964664741+08:00 TRACE Matter Sensor  Received event with handler device_lifecycle
2024-06-13T09:43:23.970507569+08:00 INFO Matter Sensor  <MatterDevice: 01f1ea25-3d57-4d30-97e6-6d3133d94b47 [92EB06375A58EA0D-9C75E6A7E7B0150A] (LeTianPai Presence Sensor Box)> received lifecycle event: infoChanged
2024-06-13T09:43:23.977232121+08:00 TRACE Matter Sensor  Found DeviceLifecycleDispatcher handler in matter-sensor
2024-06-13T09:43:23.983336276+08:00 DEBUG Matter Sensor  LeTianPai Presence Sensor Box device thread event handled

Hi, @JOJOJO
Just to keep things organized, you are now reporting an issue with the driver switch function and we’ll continue in that path, leaving the issue with try_update_metadata aside, right?

This is the first time we have received this kind of report, so, I’ll check if there’s enough information for the team to look at. For now, we only need access to your account to get all the necessary IDs to look for the logs.
It would also be useful to get both drivers’ names to get their details to make the logs’ query more specific. In the logs, I only see the name “Matter sensor” so I don’t know which driver was previously using the device.