Query HASS Labels in Node-RED

Hi ;everybody,

FYI : I’m a Home Assistant newbie…

Home Assistant supports labels. This is a grrreat! new feature.
The extra layer of abstraction allows for mighty versatile filtering.

But I can’t get/query an entity’s labels property (probably an array of strings) into NodeRed.

As an example:
In NodeRed I’d like to query all entities that have the label “LIGHT_SALON”.
For this, I presume that I should be able to use a ‘get_entities’ node and specify a label.
But I cannot find the label, labels, entity_labels, … property anywhere.
image

Sure, one could name the entity_id’s very carefully and filter entities based on their name…
I’m not a robot and my light entities were given a name in my pre-HASS life, dark times where my ikea app only allowed a certain string length etc…

Renaming entities is deadly mortal (guess every HASS user dreads this like the pest)

Labels are a great addition. They are that extra versatile level of abstraction that allow to modify memberships of quasi everything in HASS without touching the holy entity_id’s at all.
And are therefore indispensable… also inside NodeRed.

Although I’d prefer to achieve this with existing Nodes in NodeRed, I’m not averse to coding this in javascript through a Function Node. But since I’m a noob in HASS and in NodeRed, I can’t quickly find my way. I also don’t know if this can be achieved or if the ‘labels’ property is exposed to NodeRed at all.

Can someone please give me a nudge on this?
Thank in advance!

https://github.com/zachowj/node-red-contrib-home-assistant-websocket/discussions/1355

1 Like