Breaking changes for MQTT in Home Assistant 2023.8

Hello,

Some changes in MQTT will impact the way Nuki is integrated in Home Assistant.

To quote the beta release note:

As for everything, there is good and bad because if the current implementation is not changed names will become very long for people who will update Home Assistant, and if changed it will impact people who will not update.

An advantage of the future implementation is more information will be shared so a lot of information will only be useful to be specified once instead of being for each entity.

An article is also available in the Home Assistant developers blog:

3 Likes

Do you have a suggestion what should be changed?

@Juergen

Hi JĂĽrgen!
I have just observed that my Nukis (Pro 3.0, integration via MQTT) have warnings in Home Assistant 2023.8.0.

I get the following info:

"Einige MQTT-Entitäten haben einen Entitätsnamen, der mit dem Gerätenamen beginnt. Dies ist nicht zu erwarten. Um einen doppelten Namen zu vermeiden, wird als Work-Around das Präfix des Gerätenamens aus dem Entitätsnamen entfernt. Bitte informiere den Betreuer der Softwareanwendung, die die betroffenen Entitäten bereitstellt, um dieses Problem zu beheben. "

sensor.nebeneingang_battery
binary_sensor.garagentur_battery_critical
button.garagentur_lock_n_go_with_unlatch
button.nebeneingang_lock_n_go
binary_sensor.nebeneingang_battery_critical
sensor.garagentur_battery
binary_sensor.garagentur_battery_charging
button.nebeneingang_unlatch
binary_sensor.nebeneingang_battery_charging
button.nebeneingang_lock_n_go_with_unlatch
button.garagentur_unlatch
button.garagentur_lock_n_go
lock.nebeneingang
lock.garagentur

So it seems that it is enough to remove the device name prefix from the entity names.

Another screenshot which shows the text next to the warning icon.
grafik

So starting from 2024.2.0 the Nuki Home Assistant Discovery won’t work anymore.

Same issue here…



How to fix?

FYI, I integrated Nuki yesterday (so after upgrading HA to 2023.8) and it worked nicely. No repair warnings and it works great.

are you saying that we need to remove it… and add it again after the upgrade?
In my case, I had it installed before, did the upgrade and then the warning appears…

Hi,

Sorry for the late reply.

  • The lock and the door sensor should be named ""
  • All related battery binary sensor and sensor need no name as these have correct class
  • Buttons only need their function in the name
  • In the device part, only the name and identifier must be defined for all other entities than the lock. Other information only have to be defined for the smart lock. Information will be shared with other entities because identifier will be the same but I am not sure I understood what has to be done for the device name so defining it for all entities should be OK.

I will try to be more precise latter if needed.

1 Like

Thanks… but in order to me more precise … could you make an exmple (with screenshots) on how to configure the integration properly (after this change)?
I think this would be usefull for many people…

1 Like

I integrated it for the first time. Did not remove & add it back. But yeah, if it stopped working for you, removing and adding it back it should help.

Warnings and repair issues can safely be ignored, the modifications have to be done from Nuki.
These warning should not prevent to use your smart lock in Home Assistant.

I should have replied to @Juergen’s reply of this topic, sorry for this confusion.

OK, so more precisely:

  • In the device section, the lock entity must have all information, other entities only need to have name and identifier set
  • The lock and the door sensor binary sensor, entities should have name set to ""
  • The charging state binary sensor, battery level sensor and smart lock battery critical sensor don’t really need a name because their state will be their respective name, maybe some people would not agree with me and would prefer to have a name set to the battery critical binary sensor to avoid having two entities named Door name battery even if the state allows to make the difference
  • The door sensor battery critical should keep its actual name except the smart lock name should be removed from the name, else we will have two binary sensors for battery critical. IIRC the name should be Door sensor battery critical.
    Same for the fob battery critical sensor.

I hop I did not forget any entity.
The done side is for people using Home Assistant versions earlier than 2023.8 who won’t have the smart lock name in the entities.
They also will have default MQTT entity name for those which will have no name set at all and I don’t remember what happens for entities which have name set to null.

1 Like

how did you set it up in home assistent/ the nuki app

Thanks!! Would you be able to send some screenshots of where you did this?

@TheGamersCubeNL @NoeG I have not changed my HA settings, in fact I have not this issue because I have not updated HA yet.
Information in my previous message are about the implementation Nuki should use to comply with new Home Assistant naming style in MQTT as @Juergen asked.

I still can give a YAML configuration to comply with new HA version if you want but you will have two devices so two of each entities except if you disable Home Assistant autodiscovery in the MQTT settings of the Nuki app.

Morning,
so if I get it correctly, there are 2 options right now.
Option 1) disable mqtt auto discovery and add the sensors manually with proper naming in the configuration yaml
Option 2) wait for nuki devs to adopt the mqtt naming scheme in their products

Could you please provide your custom configuration for the entities?
BR

Sure I can provide a configuration which should work, but I really hop an update will be provided before Home Assistant will stop supporting old names.
@Juergen could you tel us if and eventually when an update will be provided?

mqtt:
  lock:
  - name: ""
    unique_id: "nuki_12345ABC_lock_yaml"
    command_topic: "nuki/12345ABC/lockAction"
    payload_lock: "2"
    payload_unlock: "1"
    payload_open: "3"
    state_topic: "nuki/12345ABC/state"
    state_locked: "1"
    state_locking: 4
    state_unlocked: "3"
    state_unlocking: 2
    state_jammed: 254
    value_template: '{% if value in ("5","6","7") %}3{% else %}{{value}}{% endif %}'
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC_yaml"
      name: "Lock name YAML"
      manufacturer: "Nuki home solutions GMBH"
      model: "Smartlock 3.0 pro"
      hw_version: "3.0p"
      sw_version: "3.5.9"

  binary_sensor:
  - name: ""
    device_class: "door"
    unique_id: "nuki_12345ABC_door_sensor_yaml"
    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_yaml"
      name: "Lock name YAML"
  - unique_id: "nuki_12345ABC_battery_charging_yaml"
    device_class: "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_yaml"
      name: "Lock name YAML"
  - unique_id: "nuki_12345ABC_lock_critical_yaml"
    device_class: "battery"
    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_yaml"
      name: "Lock name YAML"
  - name: "Door sensor battery critical"
    device_class: "battery"
    unique_id: "nuki_12345ABC_door_critical_yaml"
    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_yaml"
      name: "Lock name YAML"

  sensor:
  - unique_id: "nuki_12345ABC_battery_percentage_yaml"
    device_class: "battery"
    state_class: "measurement"
    unit_of_measurement: "%"
    state_topic: "nuki/12345ABC/batteryChargeState"
    availability_topic: "nuki/12345ABC/connected"
    payload_available: "true"
    payload_not_available: "false"
    device:
      identifiers: "12345ABC_yaml"
      name: "Lock name YAML"

Replace lock name by the desired name and 12345ABC by your smart lock ID.

1 Like

No. In general we do no provide dates and contents of future updates. Besides that breaking changes are always problematic because they create lots of testing and communication efforts on our side in order to ensure that every update case is covered and no user is left unnoticed with a broken system.

1 Like

Hi @Juergen you are aware that all Home Assistant users which use a Nuki with MQTT are affected from this issue?