Some help on NodeRed MQTT

I have node-red and mqtt set up in HA. I am able to publish to mqtt from quite a few esp units around my house and I am trying to display the values published via mqtt message into a gauge within HA. I think I am missing something on how to consume mqtt data (via node-red) into HA. There isn’t an “entity” as the only players here are gauge and data to populate the gauge. Is there such a concept as ‘virtual device’ or ‘virtual entity’ from within HA? Maybe what I am looking for is a way to populate a gauge based on MQTT data instead of a device. Anyone have any ideas on this? I did search the interwebs but mostly what I found was tutorials on how to create an MQTT broker and how to apply MQTT data to real devices. Thank you.

Several ways to do this if I understand you correctly.

  1. You could either just setup a sensor based on the MQTT Values within HA directly
  2. You could also create helper entities that then get populated by service calls via NodeRed.
  3. You simply use the auto discovery with your MQTT so the sensors are automatically added as soon as a new MQTT thread is published
  4. You create new sensors via the “entity” node.

I would probably go with either 3. or 4.

in another words saying: to render a gauge you need sensor entity first.
You can create the entity using either HA mqtt integration or NR depending on usecase.
I would prefer HA mqtt integration in most cases

I was headed down the path of #2 but I will see how to setup either #3 or #4 instead. I’m not sure if #3 is doable as the MQTT broker already existed prior to installation of HA. I’m not sure if that makes a difference. Appreciate your answer.

Ok let me take a look at how to to create an entity via NR given that I already have established a communication between my existing MQTT broker (existed prior to installing HA) and my HA node-red integration.

Yes #3 is still possible if the MQTT Broker already exists.
Take a look here: MQTT Discovery - Home Assistant which explains it pretty well.

Home Assistant connects to the MQTT broker in exactly the same way as Node Red does, that’s the whole point of MQTT, multiple clients can be connected to one broker and all receive the same data (that they subscribe for). Connecting Home Assistant to the broker as a client is absolutely the way to go here.

I agree with you 100%. For real world implementation I will subscribe directly via HA, so the answers above were helpful. At this stage I am really just trying to understand how to pass data from node-red to an HA gauge and as I already have data in node-red via MQTT I was hoping to use it as my test case. Appreciate your response.