home-assistant / home-assistant.io

:blue_book: Home Assistant User documentation
https://www.home-assistant.io
Other
4.96k stars 7.28k forks source link

Litter-Robot integration - Missing Waste Drawer sensor entity attributes #17656

Closed mkanet closed 3 years ago

mkanet commented 3 years ago

Feedback

Litter-Robot documentation shows that the "WASTE DRAWER SENSOR ENTITY" should have the following attributes:

However, when using a brand new Litter-Robot Connect, I can't find these attributes: Screenshot 05-01-2021 at 02 10 21 AM


Also...

Entity: vacuum.litter_robot_litterbox

When this entity switched to a Docked state after a cleaning cycle (see below screenshot), I don't have the ability to turn off the Litter-Robot via this entity anymore. This entity seems to get stuck showing the Docked state indefinitely. I'm forced to use the official Litter-Robot Android app to power off the Litter-Robot. Once I power off the device from the official app, this entity will allow me to power it off and on again.

Stuck showing "Docked" indefinitely:

Screenshot 05-01-2021 at 03 45 12 PM

In the official app (concurrently) it looks like this:

Screenshot_20210501-154540_Litter-Robot

Could you please see if there a way to fix this issue so there's a dedicated Power ON/OFF switch for this integration similar to the official app? That way, when the device is in a docked state, I still have the ability to turn off the device. Currently, I have to switch between both apps. I'd prefer to just use the Integration.

Thank you so much for your time!

URL

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

Version

2021.4.6

Additional information

No response

natekspencer commented 3 years ago

Hello, @mkanet!

Those attributes were removed as the Litter-Robot API is inconsistent with those values (they suddenly change +/-10 when the drawer level is reported as "full"). As such, it actually seemed to create more confusion than not. Hopefully they resolve it and it can be added back later. The attributes will probably be their own entities (per guidance from the Home Assistant team) in the future though if they are eventually added back in.

Also, the current documentation has been updated in the latest release and correctly reflects the attributes that are actually available: https://www.home-assistant.io/integrations/litterrobot/

There is another update pending that updates the documentation to correctly reflect the services available: https://github.com/home-assistant/home-assistant.io/pull/17743

Lastly, the ability to turn off the unit still exists by calling the vacuum.turn_off service with the target set to your litter-robot vacuum entity. The docked state issue that you report here is more of an issue with the way the vacuum entity displays available commands when in this state. Similar to the "Reset Waste Drawer" script you have setup, you could create one for turning off the unit.

mkanet commented 3 years ago

@natekspencer thank you so much for taking the time to answer my questions! I'm curious, is there a way for me to set up a custom On/Off switch toggle (vacuum.turn_on, vacuum.turn_off, respectively) in Home Assistant? Below, is my best attempt to do this. Do you mind checking to see if I did it correctly below?

Ultimately, I would like to create a real power on/power off switch entity... and a separate entity for status (docked, cleaning, etc). That way, I can always turn it on and off and still see the status completely independent of each other, just like the official app.

PS: Maybe this is something you might consider doing in the litter-robot integration? :)

switch:
  - platform: template
    switches:
      litter_robot_on_off:
        turn_on:
          service: vacuum.turn_on
          target:
            entity_id: vacuum.litter_robot_litter_box
        turn_off:
          service: vacuum.turn_off
          target:
            entity_id: vacuum.litter_robot_litter_box
mkanet commented 3 years ago

@natekspencer I'm truly sorry to bother you again. Today I started getting a NotImplemented exception every time I execute script.reset_litter_robot_waste_drawer. My script used to work perfectly before. I'm not sure what changed. Can you please tell me what I'm doing wrong? I had to use the official Litter-Robot app to reset the waste drawer level to 0. I'd really appreciate your help. If you need me to open a new issue, I can do that. Thank you for your time and patience!

2021-05-07 14:26:15 ERROR (MainThread) [homeassistant.components.script.reset_litter_robot_waste_drawer] Reset Litter-Robot waste drawer: Error executing script. Unexpected error for call_service at pos 1: 
Traceback (most recent call last):
  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
2021-05-07 14:26:15 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 404, in _async_run
    return await self.script.async_run(variables, 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

script.reset_litter_robot_waste_drawer

reset_litter_robot_waste_drawer:
  alias: Reset Litter-Robot waste drawer
  sequence:
  - service: vacuum.send_command
    target:
      entity_id: vacuum.litter_robot_litter_box
    data:
      command: reset_waste_drawer
  mode: single
natekspencer commented 3 years ago

@mkanet, see https://github.com/home-assistant/core/issues/50219#issuecomment-834619200 for the changes from commands to services

natekspencer commented 3 years ago

@natekspencer thank you so much for taking the time to answer my questions! I'm curious, is there a way for me to set up a custom On/Off switch toggle (vacuum.turn_on, vacuum.turn_off, respectively) in Home Assistant? Below, is my best attempt to do this. Do you mind checking to see if I did it correctly below?

Ultimately, I would like to create a real power on/power off switch entity... and a separate entity for status (docked, cleaning, etc). That way, I can always turn it on and off and still see the status completely independent of each other, just like the official app.

PS: Maybe this is something you might consider doing in the litter-robot integration? :)

switch:
  - platform: template
    switches:
      litter_robot_on_off:
        turn_on:
          service: vacuum.turn_on
          target:
            entity_id: vacuum.litter_robot_litter_box
        turn_off:
          service: vacuum.turn_off
          target:
            entity_id: vacuum.litter_robot_litter_box

You're just missing a value_template section. I think this would work:

switch:
  - platform: template
    switches:
      litter_robot_on_off:
        value_template: "{{ not is_state('vacuum.litter_robot_litter_box', 'off') }}"
        turn_on:
          service: vacuum.turn_on
          target:
            entity_id: vacuum.litter_robot_litter_box
        turn_off:
          service: vacuum.turn_off
          target:
            entity_id: vacuum.litter_robot_litter_box
mkanet commented 3 years ago

Thank you very much @natekspencer. I updated my empty waste drawer script. BTW: Do you know how I can display vacuum.litter_robot_litter_box: (attribute status) below, so it lines up with the rest of the items in the card below? The text is off to the right. Is it supposed to be like that?

Screenshot 05-08-2021 at 01 20 49 AM

type: entities
entities:
  - entity: switch.litter_robot_on_off
    name: Power
  - type: attribute
    entity: vacuum.litter_robot_litter_box
    name: Status
    attribute: status
  - entity: switch.litter_robot_night_light_mode
    name: Night Light
  - entity: switch.litter_robot_panel_lockout
    name: Panel Lockout
  - entity: sensor.litter_robot_waste_drawer
    name: Waste Drawer
  - type: conditional
    conditions:
      - entity: sensor.litter_robot_sleep_mode_start_time
        state_not: unknown
    row: sensor.litter_robot_sleep_mode_start_time
    name: Sleep Mode Start Time
  - type: conditional
    conditions:
      - entity: sensor.litter_robot_sleep_mode_end_time
        state_not: unknown
    row: sensor.litter_robot_sleep_mode_end_time
    name: Sleep Mode Stop Time
  - entity: script.reset_litter_robot_waste_drawer
    name: Reset Waste Drawer
title: Litter-Robot
state_color: true
show_header_toggle: false
natekspencer commented 3 years ago

@mkanet that I don't know about. I've never been too worried about the left/right alignment of the entities and statuses.

mkanet commented 3 years ago

No worries. Anyway, thank you so much for all your help!