Home Assistant MQTT auto-discovery implementation requirements

As I said, this is the YAML configuration I use now:

Nuki Smartlock YAML configuration
mqtt:
  lock:
  - name: "Front door"
    unique_id: "nuki_12345ABC_lock"
    command_topic: "nuki/12345ABC/lockAction"
    payload_lock: "6"
    payload_unlock: "1"
    payload_open: "3"
    state_topic: "nuki/12345ABC/state"
    state_locked: "1"
    state_unlocked: "3"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC"
      name: "Front door"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.5"
      suggested_area: "Entrence"

  binary_sensor:
  - name: "Front door"
    device_class: "door"
    unique_id: "nuki_12345ABC_door_sensor"
    state_topic: "nuki/12345ABC/doorsensorState"
    payload_on: "3"
    payload_off: "2"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC"
      name: "Front door"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.5"
      suggested_area: "Entrence"
  - name: "Front door charging"
    device_class: "battery_charging"
    unique_id: "nuki_12345ABC_battery_charging"
    state_topic: "nuki/12345ABC/batteryCharging"
    payload_on: "true"
    payload_off: "false"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC"
      name: "Front door"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.5"
      suggested_area: "Entrence"
  - name: "Front door lock battery critical"
    device_class: "battery"
    unique_id: "nuki_12345ABC_lock_critical"
    state_topic: "nuki/12345ABC/batteryCritical"
    payload_on: "true"
    payload_off: "false"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC"
      name: "Front door"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.5"
      suggested_area: "Entrence"
  - name: "Front door sensor battery critical"
    device_class: "battery"
    unique_id: "nuki_12345ABC_door_critical"
    state_topic: "nuki/12345ABC/doorsensorBatteryCritical"
    payload_on: "true"
    payload_off: "false"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC"
      name: "Front door"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.5"
      suggested_area: "Entrence"

  sensor:
  - name: "Front door battery"
    device_class: "battery"
    state_class: "measurement"
    unit_of_measurement: "%"
    unique_id: "nuki_12345ABC_battery_percentage"
    state_topic: "nuki/12345ABC/batteryChargeState"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC"
      name: "Front door"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.5"
      suggested_area: "Entrence"

It works as expected for me, even if by reading again there might be some point to change:

  • The device ID should be prefixed by nuki_ to be sure it is really unique
  • the unique_ids maybe should be lowercase, in fact maybe all IDs.

I hop this helps to give a better idea about what could be an integration in Home Assistant as auto-discovery payloads are the same as YAML configuration.