Missing Attributes?

I’m new to Node Red and was trying to use the “get Entities” command. When attached to a debug window showing the resulting object from a query, I noticed that many of my attributes of that object are missing (e.g. device id, area id, etc.) Am I missing something dumb?

Not all devices/entities have all attributes.
You can look in the developer tools what attributes are associated with a specific entity

Looking at my exterior light switches, I’m curious why area_id is not exposed at all since I have defined them to be in the area. If I run an API call command with:

{
   "type":"search/related",
   "item_type":"area",
   "item_id":"exterior_back"
}

I get the expected results, though it only gives me the deviceid. I’m trying to then check the state of each of those devices to determine if anything is turned on in the backyard. However, since the deviceID is not exposed via “get entities” I’m not sure how to link the output from the API call to a “get entities” call to check for state.

Remember to set the output of the debug node to “complete msg object”.

I’ve now gotten further, though still stuck. I am trying to call a “get entities” with the Property filter set as: attributes.friendly_name is {{payload}}. I have various debug windows showing that the {{payload}} is indeed a string with a valid friendly name, but it’s not passing correctly. If I manually replace {{payload}} in the Property filter with the actual string, it finds the entity with no problem. I’m guessing something is not parsing/passing correctly.

Try yo export your flow to the clipboard and then paste it in here and mark the code and click the </> option above.

[{"id":"53b138efb5a28918","type":"inject","z":"e2370c149a2883ed","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":560,"wires":[["6704b7e18d503e3d"]]},{"id":"6704b7e18d503e3d","type":"ha-api","z":"e2370c149a2883ed","name":"","server":"e51cef50.52714","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/device_registry/list\"}","dataType":"jsonata","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":406,"y":560,"wires":[["568519a6a3c96a9c"]]},{"id":"568519a6a3c96a9c","type":"split","z":"e2370c149a2883ed","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":550,"y":560,"wires":[["a351139462dc3aa6"]]},{"id":"a351139462dc3aa6","type":"switch","z":"e2370c149a2883ed","name":"","property":"payload.area_id","propertyType":"msg","rules":[{"t":"eq","v":"exterior_back","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":560,"wires":[["9cf51226fa62e6d4","8b23e5e82ddc8472","e1168fb81d59f0bc"]]},{"id":"2a762bdfc175fe27","type":"api-current-state","z":"e2370c149a2883ed","name":"","server":"e51cef50.52714","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"{{payload.entity_id}}","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1120,"y":560,"wires":[[]]},{"id":"9cf51226fa62e6d4","type":"ha-get-entities","z":"e2370c149a2883ed","name":"","server":"e51cef50.52714","version":0,"rules":[{"property":"attributes.friendly_name","logic":"is","value":"{{payload.name}}","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":870,"y":560,"wires":[["2a762bdfc175fe27"]]},{"id":"e51cef50.52714","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"","enableGlobalContextStore":false}]

Something breaks between the switch and get entities steps. I’ve tried to parse the payload.name several ways, but I think I’m missing something in the get entities box itself to use the correctly formatted string.

EDIT: found it… I was using input type of “string” instead of “msg.” for the get entities Property compare field.

It often like that! :slight_smile:
You explain to others what is wrong and then you see it yourself :smiley: