How do I create a Device with Entities, not just a list of entities?

One thing I’ve always wondered.
How do I create a ‘Device’ so all these Entities are seen as a Device with the Entities (as ESPHome etc do for me).
I have an incoming JSON string collected from an MQTT server and I split it up, first by device (just mine), then to create the Entities.
Am I missing something, is it possible to create the device ?


Typical string collected from MQTT server (this is the bottom of the two devices.)


Many thanks.

1 Like

Taking a quick look at HA’s documentation and I don’t see a way for a user to create a device. If it doesn’t exist in HA, short of creating your own integration, it won’t be possible from nodered.

1 Like

thanks, probably why I couldn’t find anything then.

Might need to look at another method and forget node-red. Shame it was easy to use and create the entities, just a faff to handle when they’re not seen as a device in HA as just individual entities.

If the idea is to condense this, when you create the entity in nodered, you may add as many attibutes as you need. This could all be in a single entity.

thought I would come back to this, I tried combining as above and it’s just saying some error in the API doing it. I give up, doesn’t seem easy.
Entity API error expected bool for dictionary … (etc)

back to just splitting them all apart long hand.

thanks for trying though, appreciated.

It would seem that you have chosen binary sensor for type. Meaning the primary state would need to be true/false on/off etc. For a number or a string you would use a sensor type.



1 Like

I did use sensor as it’s obviously not binary, that’s what the error is from.
I’ll update NodeRed again as a new .1 is out so I’ll have another go.
I can see your flow in nodered now, will have a nosey.
Again many thanks. :slight_smile:

I have updated the node-red-contrib-home-assistant-websocket yesterday within node red and what a surprise: it does support now generating devices natively!! Great thank you so much.