HA does not show my manually added MQTT device

Hi all,

I could need some help to figure out why HA is not showing my own device.

The device is configured manually in configuration.yaml:

mqtt:
  sensor:
    - name: "gardener1"
      # device_class: none # generic sensor, default
      state_topic: "pwgardener/pico1/status"
      value_template: "{{ value_json.value_raw | int }}"
      availability:
        - topic: "pwgardener/pico1/available"

I think availability is not needed but I tried if this improves the situation.

The HA MQTT log shows the MQTT messages:

2024-07-08 18:20:19.758 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on pwgardener/pico1/status (qos=0): b'{"value_raw": 4095}'
2024-07-08 18:20:19.759 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"value_raw": 4095}' with variables {'entity_id': 'sensor.gardener1', 'name': 'gardener1', 'this': <template TemplateStateFromEntityId(sensor.gardener1)>} with default value 'default' and Template<template=({{ value_json.value_raw | int }}) renders=6>
2024-07-08 18:20:19.963 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/sensor/p2x4-satellite/p2x4-satellite_cpuload/state (qos=0): b'3'
2024-07-08 18:20:22.750 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on pwgardener/pico1/status (qos=0): b'{"value_raw": 4095}'
2024-07-08 18:20:22.750 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"value_raw": 4095}' with variables {'entity_id': 'sensor.gardener1', 'name': 'gardener1', 'this': <template TemplateStateFromEntityId(sensor.gardener1)>} with default value 'default' and Template<template=({{ value_json.value_raw | int }}) renders=7>
2024-07-08 18:20:24.737 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on pwgardener/pico1/available (qos=0): b'online'
2024-07-08 18:20:25.746 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on pwgardener/pico1/status (qos=0): b'{"value_raw": 4095}'
2024-07-08 18:20:25.746 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"value_raw": 4095}' with variables {'entity_id': 'sensor.gardener1', 'name': 'gardener1', 'this': <template TemplateStateFromEntityId(sensor.gardener1)>} with default value 'default' and Template<template=({{ value_json.value_raw | int }}) renders=8>

Should the device appear in HA right after adding it to configuration.yaml or will HA wait for any message reception?

What do I miss? :face_with_monocle:

Thank you
Heiko

If it is your first manually created mqtt device, you need to restart HA

I think I tried all possible reloads and finally also restarted HA completely. That did not help.

But may I find some startup log to verify that the device is found?

Hi,

I tried once more with MQTT auto-discovery. I see that HA is reading it but the integration still does not find it.


2024-07-09 20:39:09.022 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/sensor/pwgardener/pico1/config (qos=0): b'{ "unique_id": "pico1", "name": "PicoW Gardener", "state_topic": "pwgardener/pico1/status", "availability_topic": "pwgardener/pico1/available", "retain": true, "platform": "mqtt"}'
2024-07-09 20:39:09.022 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'unique_id': 'pico1', 'state_topic': 'pwgardener/pico1/status', 'availability_topic': 'pwgardener/pico1/available', 'retain': True, 'platform': 'mqtt', 'name': 'PicoW Gardener'}
2024-07-09 20:39:09.022 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor pwgardener pico1
2024-07-09 20:39:09.023 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'pwgardener pico1'): deque([])
2024-07-09 20:39:09.124 DEBUG (MainThread) [homeassistant.components.mqtt.client] 10.0.10.108: register write 67
2024-07-09 20:39:09.124 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing with mid: 124 to topics with qos: [('pwgardener/pico1/available', 0), ('pwgardener/pico1/status', 0)]
2024-07-09 20:39:09.125 DEBUG (MainThread) [homeassistant.components.mqtt.client] 10.0.10.108: unregister write 67
2024-07-09 20:39:11.000 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on pwgardener/pico1/status (qos=0): b'{"value_raw": 4095}'

It appears in the diagnostic log:

[..]
          "entity_id": "sensor.picow_gardener",
          "subscriptions": [
            {
              "topic": "pwgardener/pico1/available",
              "messages": [
                {
                  "payload": "online",
                  "qos": 0,
                  "retain": 0,
                  "time": "2024-07-09T18:39:53.099210+00:00",
                  "topic": "pwgardener/pico1/available"
                },
[..]

… but not in the MQTT device list in the GUI.

Do I interpret the data incorrectly? What can possibly go wrong here? :thinking:

With that discovery message, you need to check the mqtt entity list, as there is no device defined

1 Like

Thank you! I added a device definition and now I see it.

Your config should add an entity. If you want to represent a device, you should add a device mapping.
Also it is advised to add a unique id. But it seems you are already there.