node-red-contrib-home-assistant-websocket icon indicating copy to clipboard operation
node-red-contrib-home-assistant-websocket copied to clipboard

Node 'get entities' rules with condition 'label_registry' not working correct if logic = 'is_not'

Open Kroki0815 opened this issue 10 months ago • 2 comments

Describe the bug

If you have 2 rules with the same condition "label_registry" only the logic with 'is' is wokring correct. if you wan't only entities wich have label A but not have label B that don't work. You get all entities with label A. if you wan't entities wich have label A and label B that work. You get only entities with label A and label b.

To Reproduce

Don't work:

      "rules": [  
                {
                  "condition": "label_registry",
                  "property": "name",
                  "logic": "is",
                  "value": Autolights,
                  "valueType": "str"
                },
                {
                  "condition": "label_registry",
                  "property": "name",
                  "logic": "is_not",
                  "value": "Presence",
                  "valueType": "str"
                }
               ]

Work:

      "rules": [  
                {
                  "condition": "label_registry",
                  "property": "name",
                  "logic": "is",
                  "value": Autolights,
                  "valueType": "str"
                },
                {
                  "condition": "label_registry",
                  "property": "name",
                  "logic": "is,
                  "value": "Presence",
                  "valueType": "str"
                }
               ]

Expected behavior

Result should be only the entities which evaluated by all rules correctly.

Screenshots

No response

Example Flow

[{"id":"3bbf78bc61855d82","type":"inject","z":"eb338817c79c6a50","name":"Presence","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"home","payloadType":"str","x":100,"y":540,"wires":[["c8713f0b3ecf5add"]]},{"id":"c8713f0b3ecf5add","type":"ha-get-entities","z":"eb338817c79c6a50","name":"Get Entities","server":"426c98e3c840b7e6","version":1,"rules":[{"condition":"label_registry","property":"name","logic":"is","value":"Autolight_Innen","valueType":"str"},{"condition":"label_registry","property":"name","logic":"is_not","value":"Presence_Lights","valueType":"str"}],"outputType":"array","outputEmptyResults":false,"outputLocationType":"msg","outputLocation":"payload","outputResultsCount":1,"x":350,"y":540,"wires":[["b7b1dc9d6ca0a17c"]]},{"id":"b7b1dc9d6ca0a17c","type":"debug","z":"eb338817c79c6a50","name":"Result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":540,"wires":[]},{"id":"426c98e3c840b7e6","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

Environment Information

Node-Red 4.0.8 node-red-contrib-home-assistant-websocket 0.75.0 Homeassistant 2025.1.4

Additional context

No response

Kroki0815 avatar Jan 26 '25 17:01 Kroki0815

FYI: Same happens with logic 'not include' and as single rule logic 'is_not' or 'not include' works like it should.

Kroki0815 avatar Jan 27 '25 07:01 Kroki0815

I got it to work by

  1. creating the labels... applying them to the entities.
  2. Full restart of Home Assistant
  3. Entities have lost the Labels so you need to readd them

mhuca avatar Sep 27 '25 08:09 mhuca