Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service "homeassistant.disable_entity" error with entity without unique_id #218

Closed
alesoft73 opened this issue Jun 6, 2023 · 1 comment

Comments

@alesoft73
Copy link

alesoft73 commented Jun 6, 2023

I have test to disable and enable the device_tracker with service "homeassistant.disable_entity" or "enable".

service: homeassistant.disable_entity
data:
entity_id: device_tracker.test_1

The service don't work with device_tracker don't have unique_id ex: "ble tracker"
I have this error:
139955523604528] Error handling message: Unknown error (unknown_error) Alesoft73 from 95.232.27.3 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0)

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 647, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1533, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 410, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 454, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 477, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 452, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1849, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1889, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 874, in admin_handler
await result
File "/config/custom_components/spook/services/homeassistant_disable_entity.py", line 28, in async_handle_service
entity_registry.async_update_entity(
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 884, in async_update_entity
return self._async_update_entity(
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 760, in _async_update_entity
old = self.entities[entity_id]
File "/usr/local/lib/python3.10/collections/init.py", line 1106, in getitem
raise KeyError(key)
KeyError: 'device_tracker.test_1'

Many thanks ;)

@frenck
Copy link
Owner

frenck commented Jun 6, 2023

Correct, there is no way to disable such entities.

../Frenck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants