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.57k stars 30.74k forks source link

Litter Robot Error when calling a platform-specific command: rest_waste_drawer #50219

Closed andrew-jacob closed 3 years ago

andrew-jacob commented 3 years ago

The problem

I am attempting to call the 'reset_waste_drawer' command but I get an error: "Failed to call service vacuum.send_command. Unknown error"

What is version of Home Assistant Core has the issue?

core-2021.5.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Litter-Robot

Link to integration documentation on our website

https://www.home-assistant.io/integrations/litterrobot

Example YAML snippet

service: vacuum.send_command
target:
  entity_id: vacuum.lr_litter_box
data:
  command: reset_waste_drawer

Anything in the logs that might be useful for us?

2021-05-07 01:44:10 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281473279828848] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 21, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 482, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1209, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 345, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 563, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1481, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1516, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 726, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/vacuum/__init__.py", line 252, in async_send_command
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/vacuum/__init__.py", line 245, in send_command
raise NotImplementedError()
NotImplementedError

Additional information

No response

andrew-jacob commented 3 years ago

Is @natekspencer still the codeowner?

probot-home-assistant[bot] commented 3 years ago

Hey there @natekspencer, mind taking a look at this issue as its been labeled with an integration (litterrobot) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

natekspencer commented 3 years ago

@andrew-jacob this changed in release 2021.5 to using its own service. See "Litter-Robot" under:

https://www.home-assistant.io/blog/2021/05/05/release-20215/#breaking-changes

So now, you'd call it like:

service: litterrobot.reset_waste_drawer
target:
  entity_id: vacuum.lr_litter_box

I'll get the documentation updated so it correctly reflects this though!

andrew-jacob commented 3 years ago

That solved my problem; I would consider this issue closed with updated documentation. Thank you for the prompt reply!

natekspencer commented 3 years ago

Will be resolved with https://github.com/home-assistant/home-assistant.io/pull/17743

mkanet commented 3 years ago

@natekspencer , the script below never worked for me using Home Assistant 2021.5.x, I keep getting the error messages below each time I execute the script:

2021-05-11 17:41:51 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities vacuum.lr_litter_box
2021-05-11 17:42:00 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities vacuum.lr_litter_box
2021-05-11 17:42:02 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities vacuum.lr_litter_box
2021-05-11 17:42:09 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities vacuum.lr_litter_box
2021-05-11 17:42:23 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities vacuum.lr_litter_box

Script:

reset_litter_robot_waste_drawer:
  alias: Reset Litter-Robot waste drawer
  sequence:
  - service: litterrobot.reset_waste_drawer
    target:
      entity_id: vacuum.lr_litter_box
  mode: single

The old script used to work perfectly before this breaking change. What am I doing wrong? I even tried it via Developer tools. It can't find the respective entity vacuum.lr_litter_box for service litterrobot.reset_waste_drawer.

PS: I also noticed that once the Integration loses contact with the Litter-Robot; such a from a temporary Internet outage, the Integration will not try to reconnect. I had to reboot my entire Home Assistant VM for it to work again. Is there a way to get it to automatically recover without rebooting Home Assistant?

natekspencer commented 3 years ago

@mkanet you've got to use the actual name of your litter box vacuum entity. The script here is just an example.

mkanet commented 3 years ago

@natekspencer I feel so dumb. Thank you! The script is working now.

Just one more thing... I also noticed that once this Integration loses contact with the Litter-Robot; such a from a temporary Internet outage, the Integration will not try to reconnect to the litter-robot. I had to reboot my entire Home Assistant VM for it to update its sensors again. Is there a way to get the Integration to automatically recover without rebooting Home Assistant? Seems kind of extreme to reboot Home Assistant.

natekspencer commented 3 years ago

@natekspencer I feel so dumb. Thank you! The script is working now.

Just one more thing... I also noticed that once this Integration loses contact with the Litter-Robot; such a from a temporary Internet outage, the Integration will not try to reconnect to the litter-robot. I had to reboot my entire Home Assistant VM for it to update its sensors again. Is there a way to get the Integration to automatically recover without rebooting Home Assistant? Seems kind of extreme to reboot Home Assistant.

It should already do that. If it happens again, please open a new ticket. Also, for general questions/troubleshooting, please consider using the discord channel or community forums rather than adding additional/unrelated requests to tickets. It makes it harder to triage if we have to read through multiple comments.

Thank you!

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.