home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.65k stars 30.79k forks source link

Unable to find referenced entities warning since 0.106.x #36128

Closed kmlucy closed 3 years ago

kmlucy commented 4 years ago

The Problem

On Home Assistant startup, I sometimes get errors like this:

2020-05-24 10:53:40 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.server_room_lights

Sometimes it's a different switch, sometimes it's multiple, sometimes it's none. The switches are z-wave. Despite the warnings, everything seems to work fine.

Environment

Problem-Relevant configuration.yaml

N/A

Traceback/Error logs

2020-05-24 10:53:40 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.server_room_lights

Additional information

Probably the same issue from #33012, but that one was closed due to referencing home-assistant-remote. I don't use that custom component, or Node-Red. My only custom components are HACS and Browser Mod, neither of which have any effect here.

dshokouhi commented 4 years ago

So this is only impacting zwave switches? Is it always the same ones? Where are you using these entities that it complains about it? Other than automation like any other integration depends on them?

kmlucy commented 4 years ago

There are two entities that this seems to occur with. Both are zwave switches. Sometimes it happens with one, sometimes the other, sometimes both, sometimes neither.

They are used in scenes, automations, groups, automations, scripts, google assistant, and lovelace. I have dozens of other switches used in the same ways that don't trigger this, however.

dshokouhi commented 4 years ago

Are there any errors above or below it that may give a clue whats having the issue? Something is using that helper service. Maybe try enabling debug logging as a whole to see if it gives any clues?

https://www.home-assistant.io/integrations/logger/#default

kmlucy commented 4 years ago

I enabled logging and am suddenly seeing way more of this warning:

Logger: homeassistant.helpers.service
Source: helpers/service.py:423
First occurred: 4:44:48 PM (5 occurrences)
Last logged: 4:44:51 PM

Unable to find referenced entities light.bathroom_lights, light.craft_room_light, light.dining_room_light, light.office_light, light.scuba_lamp
Unable to find referenced entities switch.bathroom_fan, switch.bedroom_light, switch.bedside_lamp, switch.bird_lamp, switch.counter_lights, switch.desk_lamp, switch.entry_light, switch.flower_lamp, switch.guest_bathroom_fan, switch.guest_bathroom_lights, switch.hall_lights, switch.kitchen_lights, switch.laundry_hall_light, switch.living_room_lamps, switch.living_room_light, switch.master_closet_light, switch.server_room_lights, switch.sunroom_closet_light, switch.sunroom_light, switch.under_bed_lights
Unable to find referenced entities fan.bedroom_fan, fan.living_room_fan, fan.office_fan
Unable to find referenced entities lock.front_door
Unable to find referenced entities switch.server_room_lights

I'm pretty sure that's all my zwave devices. Only the last one shows up without debug logging.

Here are the logs proceeding some of the warning that look possibly relevant. Here is without debug logging:

2020-05-25 20:22:20 INFO (MainThread) [homeassistant.components.automation] Executing Turn off server room lights on door close
2020-05-25 20:22:20 INFO (MainThread) [homeassistant.components.automation] Turn off server room lights on door close: Running script
2020-05-25 20:22:20 INFO (MainThread) [homeassistant.components.automation] Turn off server room lights on door close: Executing step call service
2020-05-25 20:22:20 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.server_room_lights

And this is with: https://termbin.com/k1kr

viggenz commented 4 years ago

I have a similar problem with deconz lights and light groups (other deconz/zigbee devices work fine):

Home Assistant 0.110.3

Logger: homeassistant.helpers.service
Source: helpers/service.py:423
First occurred: 1:11:54 AM (1 occurrences)
Last logged: 1:11:54 AM

Unable to find referenced entities light.bedroom, light.kitchen, light.living_room

EDIT: it appears the supervisor 225 has fixed the issue.

ronytomen commented 4 years ago

Running Core in a Python Env and have the same 2 ZWave devices give this warning on startup. The only thing I can figure is the entities are being referenced in an automation. I'm not sure adding conditions will help for those automation, the warning might be related to registering the listener for the automation triggers before Zwave has added the entities.

derekatkins commented 4 years ago

For what it's worth I am seeing this from an automation from an isy994 integration in 0.114.3. I get the error when the automation fires, so it is unlikely to do with a delay in when the entity arrives into the system -- I can reload my automations and make this error appear. However, in my case it is somewhat ISY-specific -- if I do:

     - service: switch.turn_on
       entity_id: switch.my_switch_name

it works fine, but if I use the ISY-specific service then I have this issue (NB: doesn't matter if I move the entity_id up one level, I get the same error):

     - service: isy994.send_node_command
       data:
         entity_id: switch.my_switch_name
         command: fast_on

We are tracking the ISY-specific bug in https://github.com/home-assistant/core/issues/38498 but it is certainly possible that it is a generic issue.

shbatm commented 4 years ago

I'm not sure if the ISY994 issue #38498 is the same as what's causing this issue. It looks as though #37313 is the issue over there, which didn't come around until July.

Just FYI from that issue, after the change made in #37313, the common entity services that are common used across all platform domains (light, switch, lock, etc) stopped working. A user would call the service for light.whatever and the entity service will only look in binary_sensors (the first platform loaded) for that entity_id before giving up.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.