Window contact sensor icon

Hi, @ronie_pilot
AFAIK, the icon is set based on the category assigned to the device profile. Only certain categories allow users to change the icon in the app.

As you already have the ContactSensor category assigned, I don’t know if you also need to add that in the profile’s metadata as OCF type, this is an example of a motion sensor

name: xxxxx
components:
- id: main
  capabilities:
  - id: motionSensor
    version: 1
  - id: illuminanceMeasurement
    version: 1
  - id: temperatureMeasurement
    version: 1
  - id: battery
    version: 1
  - id: healthCheck
    version: 1
  categories:
    - name: MotionSensor
metadata:
  deviceType: MotionSensor
  ocfDeviceType: x.com.st.d.sensor.motion
  deviceTypeId: MotionSensor

Could you see if that helps, please?

You cannot do the exact same within the driver’s code. I’ve seen other developers use the function try_update_metadata to change the profile assigned to the device, but you’ll need a profile for each icon you want to set.

1 Like