Device class - mqtt binary sensor

I want to set device_class: door in mqtt / binary_sensor but it doesn’t recognize device_class and I don’t have the door icon:
My connfig:

mqtt:
binary_sensor:
   - unique_id: toilet_door
     friendly_name: "Toilet door"
     state_topic: "bridge / tele / RESULT"
     value_template: "{{value_json.RfReceived.Data}}"
     payload_off: "70CC67"
     payload_on: "70CC6E"
     device_class: door
     qos: 1

Docs say it should work. Your indentation is out, though: binary_sensor: should be two spaces right. Does the sensor work, just without the icon?

I have MQTT binary sensors with working device classes (plug, motion and battery_charging).

Sesor works, but icon don’t.

Have you restarted, or at least reloaded MQTT entities?

Could you show yours configuration of mqtt / binary sensor?

Yes, I restarted all HA.

configuration.yaml:

mqtt:
  sensor: !include_dir_merge_list mqtt/sensors
  binary_sensor: !include_dir_merge_list mqtt/binary_sensors
  switch: !include_dir_merge_list mqtt/switches

mqtt/binary_sensors/misc.yaml:

- name: kitchen_motion
  state_topic: "fully/event/onMotion/REDACTED"
  payload_on: '{"type":"visual","deviceId":"REDACTED","event":"onMotion"}'
  off_delay: 5
  device_class: motion
1 Like

Does the device_class show on the states screen? For the above sensor:


image

configuration.yaml :

mqtt: !include_dir_merge_list includes/mqtt/

mqtt/kerui.yaml:

binary_sensor:
  - unique_id: toilet_door
    friendly_name: "Toilet door"
    state_topic: "bridge/tele/RESULT"
    value_template: "{{ value_json.RfReceived.Data }}"
    payload_off: "70CC67"
    payload_on: "70CC6E"
    device_class: door
    qos: 1

  - unique_id: front_door
    friendly_name: "Front door test"
    state_topic: "bridge/tele/RESULT"
    value_template: "{{ value_json.RfReceived.Data }}"
    payload_off: "49A067"
    payload_on: "49A06E"
    device_class: window
    qos: 1

  - unique_id: bathroom_door
    friendly_name: "Bathroom door"
    state_topic: "bridge/tele/RESULT"
    value_template: "{{ value_json.RfReceived.Data }}"
    payload_off: "C85467"
    payload_on: "C8546E"
    device_class: door
    qos: 1

No I don’t have

Hmmm, running out of ideas here. Are you running a recent version of HA? Anything in the logs? Are you sure your unique_ids aren’t replicated elsewhere?

Your configuration.yaml refers to the folder includes/mqtt but you didn’t include includes/ in your kerui.yaml reference above. Was that just an omission, or is it possible you’re editing a file that HA isn’t reading?