WTH Why is it so hard to add an MQTT entity that's not autodiscovered?

I find it hard in Home Assistant to create a device & entities for something which is sending MQTT data. Home Assistant MQTT broker has the entity values.
A quick ‘create MQTT entity’ and ‘create MQTT device’ with specifying the topic/prefix would be amazing.

Similarly, grouping multiple entities as a ‘virtual device’ for cases like RESTful commands used.

It’s hard because it supports a lot of options.

2 Likes

@Mark_M FYI, I use Node-Red to add/delete virtual MQTT devices. Check an example I posted if you’r interested.

I could explain/share the code if you’r interested?

Maybe I’m wrong.
But is your need really about discovery? Or maybe you simply want to create a device consisting of mqtt based entities?

Asking, because the latter can be achieved without discovery, simply by yaml configuration.

Discovery is useful for entities creation in automated way usually used by 3rd party apps, while they decide what topics they create and then passes this information to HA using discovery mqtt topics.

1 Like

Do you have an example of that?

Tried suto discovery as well, but the registration process is not clear for me. (Looks very complicated) For now i managed to get topic values into helpers, but want to load them in a virtual device

tents of them. most my devices are wired through mqtt if possible.
Here is my package for Shelly PlugS.
Note that only one entity has a full device description. Others reference the device via its identifier

pck_socket3:
  mqtt:
    switch:
      - name: "Socket 3 State"
        unique_id: plug_bedroom_ctrl
        state_topic: "shellies/shplug-3/relay/0"
        command_topic: "shellies/shplug-3/relay/0/command"
        availability_topic: "shellies/shplug-3/online"
        payload_available: "true"
        payload_not_available: "false"
        payload_on: "on"
        payload_off: "off"
        device:
          connections: [["mac", "3CAAAAAAAAAA"]]
          name: "plug_bedroom"
          configuration_url: "http://192.168.107.50"
          manufacturer: "Allterco Robotics Ltd."
          model: Shelly PlugS (SHPLG-S)
          suggested_area: Bedroom

    sensor:
      - name: "Socket 3 Power"
        unique_id: plug_bedroom_power
        state_topic: "shellies/shplug-3/relay/0/power"
        availability_topic: "shellies/shplug-3/online"
        device_class: power
        unit_of_measurement: "W"
        payload_available: "true"
        payload_not_available: "false"
        device:
          connections: [["mac", "3CAAAAAAAAAA"]]

      - name: "Socket 3 Temperature"
        unique_id: plug_bedroom_temperature
        state_topic: "shellies/shplug-3/temperature"
        availability_topic: "shellies/shplug-3/online"
        unit_of_measurement: "°C"
        device_class: temperature
        payload_available: "true"
        payload_not_available: "false"
        entity_category: diagnostic
        device:
          connections: [["mac", "3CE90ED7CBAC"]]
1 Like

I try as much as possible not to rely on Nodered.
I find it very annoying when the integration and addon link fail between HA update versions.

1 Like

Two examples come to mind:

FPP (Falcon Pi Player) can expose multiple entities but doesn’t provide Home Assistant with a discoverable device.
I can add the MQTT topic/prefix manually and get a working entity if I manually set it up.
Other example is BirdNET-Pi, either stand alone version or the add-on.

Surely Home Assistant could recognise the topic fpp/ (or birdnet/) and ask which received states would like to be setup & grouped to a device.

Can you please explain what you mean by that? I don’t understand what you’r trying to explain, but that’s probably shortcoming on my part… :roll_eyes:

I don’t know what he is insisting either. Especially why he is adding NodeRed to the equation.

Actually the fact that state of MQTT broker or NR remains unchanged when HA restarts is more than benefit. The same about vice-versa.

It can’t. Data might be provided in many formats. Also data found in MQTT must not be there only for use in HA.
Thus either an integration or device provides meta data in form of discovery, or a user creates entities manually in yaml. There could be the GUI for that but… there are so many options. Such gui would be overwhelming

When I use Virtual MQTT devices (autodiscoverd in HA) it’s discoverd once after a restart of NodeRed (and so when HA is updated):
afbeelding
Check the small one inside the ‘Add’-node, it means:
afbeelding

FYI, I use this for a long time and it never failed.

@Mark_M is this what you would like to see done by HA (without using NodeRed)?