DIY MQTT sensor, how to use in Home Assistant?

Hello,

I have a DIY door sensor, that publishes 3 states: “open”, “closed” and “locked” by MQTT and I have prepared 3 miniature bitmaps. How can I make Home Assistant show the state of the door with the bitmaps in the GUI (and use the state of the door in automations)?

If this is a dumb or frequently asked question, please be gracious and point me to the documentation I should read.

Any help would be highly appreciated, thanks in advance
Ralf

The simplest way would be using the mosquitto mqtt broker addon and then configuring the integration for the connection.

Afterwards, you can add a mqtt sensor into configuration.xml.
Here is the reference:

And here is a simple example from my HA:

binary_sensor:
  - platform: mqtt
    name: "espeasy0_button-A1"
    state_topic: "espeasy-0/button/button_A1/State"
    payload_on: "1"
    payload_off: "0"

It reads 1 or 0 from the mqtt topic espeasy-0/button/button_A1/State and converts it to on or off.

O.K., I already have the mosquitto plugin running and use shelly wifi switches by MQTT. But thank you for pointing me to the “MQTT Sensors” documentation.
Unfortunately all this answers only a small part of my question, especially not the part about the gui integration. In your example, you use a “binary_sensor” and I think by this HA knows how to handle it. But this doesn’t fit for my case.

Regards
Ralf