I have zigbee2mqtt and home assistant in use. I have paired multiple door sensor via zigbee, 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?
1 Answer 1
I found a workaround solution, not exactly what I wanted, but it does the trick.
Instead of changing the device type in z2m, you can change it in home assistant by involving the customize.yaml file in configuration.yaml like this:
# configuration.yaml
homeassistant:
customize: !include customize.yaml
# customize.yaml
binary_sensor.window_basement_sensor:
device_class: window
It would be nicer from the arc. point of view to keep the hardware configuration in z2m and the functionality in home assistant. Anyway, my top most goal was to have a sustainable yaml configuration, so at least this is met.