Mqtt help needed: sensor is not showing up as an entity

Hi all,

New to HASS as I installed it on a virtualbox instance. Learning fast though, through troubleshooting my issue. I’ve setup mqtt mosquitto broker and sending data from an ESP32. I can read the topic from the addon configuration. The data is showing up in the core-mosquitto diagnostics file which I downloaded.

I’ve used MQTT Sensor - Home Assistant (home-assistant.io) section “Temperature and humidity sensors” as a guide and changed the topic and value template accordingly.

I’ve configured my sensors in configuration.yaml and restarted HASS. I would expect the sensors to show up in the entities list and added automatically in the overview. But no, I can’t find them. The sensor (readings) should be added to Settings - Devices&services - Entities and the overview automatically, do they?

With the DeveloperTools-CheckAndRestart functionality I don’t get and errors when checking configuration.

And I am stuck now at that point, as I can’t get home assistant to create a sensor for it. Tried a lot of stuff! :confused:

Anyone can give any assistance?

configuration.yaml:

# listen to mqtt topic
mqtt:
  sensor:
    - name: "temperature"
      state_topic: "iotsensor/AGS"
      unit_of_measurement: "°C"
      value_template: "{{ value_json.temp_2 }}"
    - name: "humidity"
      state_topic: "iotsensor/AGS"
      unit_of_measurement: "%"
      value_template: "{{ value_json.humi_2 }}"

Part of downloaded diagnostics file:

    "devices": [],
    "mqtt_debug_info": {
      "entities": [
        {
          "entity_id": "sensor.temperature",
          "subscriptions": [
            {
              "topic": "iotsensor/AGS",
              "messages": [
                {
                  "payload": "{\"temp_2\":21.4,\"humi_2\":52}",
                  "qos": 0,
                  "retain": 0,
                  "time": "2024-10-11T10:28:28.882206+00:00",
                  "topic": "iotsensor/AGS"
                },

You didn’t configure a device, so they won’t show up in devices & services. They will only show up in the entities list and developer tools → states page.

Hi Petro, thanks for replying.

I’m not sure what happened, but now I got back to the project and tried some logging stuff to enable, the sensors readings do show up in the list:
Settings - Devices&services - Entities
Looking at their history, the data is logged before I posted this thread.

And all of a sudden the sensors are added automatically in the overview…

Which is very nice :smiley:

Beats me what it fixed, I didn’t change configuration the last three hours…

I’ve installed the add-on “Log Viewer” and enabled more logging by adding the following into configuration.yaml

# enable logging
logger:
  default: info
  logs:
    homeassistant.components.mqtt.client: debug
    homeassistant.components.mqtt: debug

And now disabled the debug logging of course :wink:

Not sure whether I have to create a device for the two entities, I might have to configure a bit more in order to be able to customize the entity via the gui, as the cog icon is unavailable for me now. It seems I haven’t or can’t assign a unique ID to them.

Customizing entities - Home Assistant (home-assistant.io)

Not sure why the URL is containing “customizing-devices” and the page is called “Customizing entities”. The terms entity and device is rather confusing to me and the documentation is not making this easier.

Anyways, thanks for the support.