I installed MQTT client in HA using the integrations section. But there you can’t set special options.
I uninstalled the Mqtt integration and included the settings in configuration.yaml:
# MQTT Broker
mqtt:
broker: 192.168.178.237
port: 1883
client_id: home-assistant
username: !secret mqttbroker_user
password: !secret mqttbroker_password
discovery: true
discovery_prefix: homeassistant
birth_message:
topic: 'hass/status'
payload: 'online'
will_message:
topic: 'hass/status'
payload: 'offline'
Without the online/offline messages HA won’t get messages after a restarz of HA service.
With this way of integration I no such problems again.