MQTT Birth and Last will


Home Assistant’s MQTT integration supports so-called Birth and Last Will and Testament (LWT) messages. The former is used to send a message after the service has started, and the latter is used to notify other clients about a disconnected client. Please note that the LWT message will be sent both in case of a clean (e.g. Home Assistant shutting down) and in case of an unclean (e.g. Home Assistant crashing or losing its network connection) disconnect.

By default, Home Assistant sends online and offline to homeassistant/status.

To customize the MQTT Birth and Last Will messages, add the following section to your configuration.yaml file:

# Example configuration.yaml entry
mqtt:
  birth_message:
    topic: 'hass/status'
    payload: 'online'
  will_message:
    topic: 'hass/status'
    payload: 'offline'

Configuration Variables

birth_message list (Optional)

Birth Message. Set to the empty dict, {}, to disable publishing a birth message.

topic string (Optional, default: homeassistant/status)

The MQTT topic to publish the message.

payload string (Optional, default: online)

The message content.

qos integer (Optional, default: 0)

The maximum QoS level of the topic.

retain boolean (Optional, default: false)

If the published message should have the retain flag on or not.

will_message list (Optional)

Will Message. Set to the empty dict, {}, to disable publishing a will message.

topic string (Optional, default: homeassistant/status)

The MQTT topic to publish the message.

payload string (Optional, default: offline)

The message content.

qos integer (Optional, default: 0)

The maximum QoS level of the topic.

retain boolean (Optional, default: false)

If the published message should have the retain flag on or not.