Unable to find referenced entities light.kitchen

I’m getting this in my logs fairly regularly:

Unable to find referenced entities light.kitchen
12:12:06 PM – helpers/service.py (WARNING)

I get that there’s probably an automation or something that’s referencing a hue group that I had originally imported (I turned that off as it was filling my gui with groups) but I can’t figure out what the cause is. Is there any way to narrow things down so I can see what’s trying to reference the entity so I can fix it?

Using an text editor/IDE with global search would make it easy to find that entity.

AH! That worked perfectly. It was an old appdaemon app I was playing with. Thanks!

I’m seeing this error occur in the logs each time an automation runs: Unable to find referenced entities switch.light2_tower_power

Its a smart switch connected to my computer’s monitors. the weird thing is that this entity does exist, and is available in home assistant.

The entity is correct, it’s accessible and it’s working outside of node-red.
node-red can see the entity as the type ahead for the entity field shows it.

But I’m getting this error in the logs, whenever node-red attempts to turn on or off the switch.

2020-07-09 13:53:50 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.outdoor_front_lights_switch

I had similar issues a while back and it took me a while to figure out. It turned out to be something in either an automation or a script (pretty sure it was a script), where I had “light.turn_off” as the service and had also included a switch entity in the list. This used to be allowed a while back, but was disallowed in one of the updates.

Try doing a global search for the entity (I use VSCode) and make sure its included alongside it’s respective service.

4 Likes

Saved me again Stephen! I totally missed that. Scratching my head all day.
Thanks

Yeah…it had me scratching my head for while too. The error log isn’t very helpful…In fact it’s a bit misleading.

I have the same problem but it is for a custom service I’m trying to setup in HA.
service is registered correctly and is available in dev tool.
Custom_component is registered to the new service
[custom_components.sinope.climate] Registered to service set_outside_temperature
But when I try it in dev tool I get the following error
[homeassistant.helpers.service] Unable to find referenced entities climate.sinope_climate_bureau
That entity_id exist. I picked it in the drop down entity list in the dev tool


It’s a fresh install of HA with almost nothing except what I need to test my new custom service

I recently encountered this issue and found the cause. Adding in case there’s a chance that it’ll help someone else, since it doesn’t look like anyone else ran into my particular scenario.

I was having the same problem with entities for known z-wave controlled outlets that control some plug-in lights in my kitchen. I also have some hue bulbs, and I had everything in a group, with automations to turn the lights on or off if motion is detected or not. Since I had switches and lights in the same group, I had to call both the switch.turn_on and light.turn_on services from the automation. This seems to be what was causing warnings about not being able to find referenced entities.

I had already set up light entities in my config to control the switched outlets using the Light Switch integration, so I was able to resolve by just replacing the switch entities in my group with their corresponding light entities and then removing the calls to switch.turn_on and switch.turn_off services from my automations.

I am having the same issue with 2 lights.
One of them I know is off, the other is not.
I am turning off and on and is working for some hours…or maybe couple of days.
And after that it becomes inactive again.
1

I’m getting similar errors. I have seven folders named “helpers,” and none of them contain a file named service.py. Any ideas?

You should be looking for the referenced entities. Did you try that?

That’s what I want to do, yes… but where to look? They’re not in entitles: https://myIP:8123/config/entities

I can’t find the services.py file anywhere.

I did find one of the referenced entitles in my groups.yaml file… I guess what I’m saying is, if the entities could be referenced just about anywhere in HA, finding them with a text search as suggested above could be a slog unless someone knows of a better way than what I’m doing (opening text files individually and looking around).

EDIT: found another in a Node-RED flow. I guess they’re just sprinkled around everywhere: old entities either retired or renamed.

1 Like

I used the search in the VS Code add on. It can search all the files at once.

1 Like

Excellent tip, downloaded! Thanks.

Echoing some comments from above, I was also experiencing

Logger: homeassistant.helpers.service
Source: helpers/service.py:130
First occurred: March 3, 2022, 1:06:51 PM (4 occurrences)
Last logged: 8:38:55 AM

Unable to find referenced entities media_player.lenovosmartdisplay9594

I checked ALL the config files, nothing.
It turned out to be in a NodeRED flow (I know this has been posted above, just echoing)

you could do grep from terminal
grep -r 'light.kitchen' /config

Apologies for necroposting, but i am having this issue and cannot figure out where the error lies. Every reboot of HA posts this warning:

But when looking at my entities, it is there:

i did a search in the terminal, but it is only found in some dashboards that i use, whcih also use similar entities that do not throw this error.

➜  ~ grep -r 'light.hallway_lights' /config
/config/home-assistant_v2.dblight.hallway_lightsoff2022-07-10 15:55:14.498605|01G7MD4W6285PAJ1QQ9VPQPWKAa�}
/config/ui_lovelace_minimalist/dashboard/views/home-downstairs.yaml:        entity: light.hallway_lights
/config/ui_lovelace_minimalist/dashboard/views/min-downstairs.yaml:        entity: light.hallway_lights
/config/integrations/entity_controller.yaml:  entity: light.hallway_lights
/config/home-assistant.log:2023-10-06 13:42:37.752 WARNING (MainThread) [homeassistant.helpers.service] Referenced entities light.hallway_lights are missing or not currently available
/config/.storage/zwave_js.legacy_zwave_migration:            "light.hallway_lights": {
/config/.storage/zwave_js.legacy_zwave_migration:                "entity_id": "light.hallway_lights",
/config/.storage/core.entity_registry:        "entity_id": "light.hallway_lights",
/config/.storage/core.config_entries:            "light.hallway_lights",

anyone have any ideas on how to find which helper could be using this one entity?