New MQTT topics are not shown in Home Assistant

Hi,

I’m new to Home Assistant and I’ve tried to find relevant parts in the documentation but failed to help myself. I assumed that any new MQTT topic gets visible in Home Assistant as long as “discovery” is enabled (which it is).

Unfortunately, I’ve failed to configure a Gardena R40Li mower as well as a CO2 logger to provide data via MQTT to HA. The data is visible in mosquitto (as shown below) but HA isn’t reporting any more device or visualized their data other than the one device that was present and set up during HA setup, a smart-meter data provider.

MQTT>HA working: smart-meter data provider.

MQTT>HA not working: Gardena R40Li via Robonect (URL removed due to Forum limitation to 2 URLs per post for me) and CO2 logger from Unraveltec (URL removed due to Forum limitation to 2 URLs per post for me).

I can use MQTT > “Listen to a topic” for all three devices with many topics each. For example when listening to co2lampel2/sensors/SCD30/gas (Unraveltec CO2) I get:

{
    "tags": {
        "interval_s": 2,
        "id": "i2c-1_0x61",
        "ASC": "yes"
    },
    "values": {
        "CO2_ppm": 509.73,
        "sensor_degC": 38.8,
        "H2O_gpm3": 9.43
    },
    "UTS": 1651924458.838
}

QoS: 0 - Retain: false

Listening to R40Li/wlan/rssi (Robonect):

-81

QoS: 0 - Retain: true 

For the already working smart-meter I need to listen to SHRDZM/AC0BFBxxxx/AC0BFBxxxx/sensor to get:

{
    "timestamp": "2022-05-07T15:26:01",
    "1.8.0": "8051506",
    "1.8.1": "5376438",
    "1.8.2": "2675068",
    "1.7.0": "421",
    "2.8.0": "0",
    "2.8.1": "0",
    "2.8.2": "0",
    "2.7.0": "0",
    "3.8.0": "3354277",
    "3.8.1": "1922946",
    "3.8.2": "1431331",
    "3.7.0": "0",
    "4.8.0": "2156253",
    "4.8.1": "1476048",
    "4.8.2": "48",
    "4.7.0": "303",
    "uptime": "0008:16:47:51"
}

QoS: 0 - Retain: false 

From the documentation on (URL removed due to Forum limitation to 2 URLs per post for me) and (URL removed due to Forum limitation to 2 URLs per post for me) I could not determine if my assumption is really true (everything that gets sent to MQTT is shown in HA as a new device with its values) or if my two devices do need manual configuration. If they do need manual configuration, I could not find out how to accomplish this myself.

For Robonect, I also tried this manual configuration which resulted in errors when I restart HA. Details on https://paste.grml.org/3485/

Thanks for any hints!

System information:

Setup via Docker on a Xubuntu 20.04 LTS on an AMD Ryzen x86 hardware:

System Health

version: core-2022.4.7
installation_type: Home Assistant Container
dev: false
hassio: false
docker: true
user: root
virtualenv: false
python_version: 3.9.9
os_name: Linux
os_version: 5.15.26-051526-generic
arch: x86_64
timezone: Europe/Vienna

logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

dashboards: 1
resources: 0
views: 2
mode: storage

Home Assistant, IMO has one of the hardest_to_use discovery system of any automation package I’ve used.

any new MQTT topic gets visible in Home Assistant

In order for HA auto discover to work, there needs to be a very specific discovery topic.

HA is very flexible in using mqtt, but won’t create entities unless it receives a specific mqtt discovery message, or unless you configure an entity in yaml.

Oh, I see. So my assumption was wrong. It seems to be the case that I do have to learn to manually configure the CO2 logger as well as the Robonect. This will be interesting.

As a personal comment: I do find the term “discovery” misleading. When I do interpret this information correctly, discovery only works when the data source is specifically built for HA-discovery support in its data stream which is great but doesn’t help much for the rest.

Yes - totally agree and I had the same misconceptions. The auto discover isn’t that, because basically it requires the device to send explicit Home Assistant specific instructions to create the entities. So in esence it is remote administration, not auto discovery.

I think this would be a great feature in HA. Vote if you agree.

2 Likes

I have another problem: a plant sensor “autodiscovery” chose to make the topics persistent. Now the device is gone, but when I delete it from HA it is “autodiscovered” all the same because the instructions to create it persist. So now I have to find a way to send empty persistent messages to overrule the old ones if I ever want to get rid of the derelict device.

Delete the retained messages using mqtt explorer

1 Like

Hello everyone. i am facing an issue i dot know how to handle so i want to use your vast experience. i created a device_tracker device that uses the mqtt from a real device_tracker(phone gps) that is in another instance of HA. the state is correctly transmitted however the attributes even though they are received (on an attribute topic, while the state is on a state topic) according to the format here bellow, does not populate the device`s attributes. Do You have an idea why please? please see here bellow the received payload.

I think everyone is going to need to see how you have the sensor added in HA.

Example: In my mqtt.yaml.

  - unique_id: '3B000012BE26A930StokerSensor'
    name: "Stoker Sensor 3B000012BE26A930"
    state_topic: "stoker/sensors/3B000012BE26A930"
    value_template: "{{ value_json.index2 | float }}"
    device_class: temperature
    unit_of_measurement: '°F'
    json_attributes_topic: "stoker/sensors/3B000012BE26A930"

Thank You for Your reply. This is how i defined the device_tracker:

  - device_tracker:
      name: "teo"
      state_topic: "homeassistant/device_tracker/sm_g935f_2/state"
      payload_home: "Borhanci"
      payload_not_home: "not_home"
      json_attributes_topic: "homeassistant/device_tracker/sm_g935f_2/attributes"

Am i taking the wrong approach?