Override device_class for home assistant in zigbee2mqtt

I have zigbee2mgtt and home assistant in use. I have paired multiple door sense via zigbess, some of them are used on windows, some of them on doors. Now i am trying to override in configuration.yaml file the device_class from door to window but it is not working as expected. I found this documentation for exposing a switch as a light, and this works:

devices:
    '0x12345678':
        friendly_name: my_switch
        homeassistant:
            switch:
                type: light
                object_id: light
            light:
                name: null
                value_template: null
                state_value_template: '{{ value_json.state }}'

I tried an analogue approach to change door to window, but it has no effect. Is that even possible? If so, what would be the yaml config for it?

If the device is already registered in HA then changing the Z2M config might not make a difference. Did you try removing the device from HA and then re-discovering it?

Can you post the snippet you used to try to change the type?

Can you confirm the path to the file you’re editing and whether you’re using Z2M as an add-on vs standalone?

Two possible solutions with the limited information provided(maybe others)

Template a cover

Change the type in the settings for the door you want to convert

that makes sense, looks like the cleanest way is to remove/re-add the device in HA after adjusting configs. I’ll try that approach.