Just give it a try I did it via the integration and it works.
This is my config from my configuration.yaml:
# MQTT Pimatic bridge
mqtt:
broker: 192.168.0.101
username: !secret mqtt_username
password: !secret mqtt_password
port: 1883
discovery: true
discovery_prefix: hass
birth_message:
topic: "hass/status"
payload: "online"
will_message:
topic: "hass/status"
payload: "offline"