Add switches and sensors to Litter-Robot (#46942)

This commit is contained in:
Nathan Spencer 2021-02-23 19:34:25 -07:00 committed by GitHub
parent d4d68ebc64
commit b8f7bc12ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 242 additions and 23 deletions

View file

@ -0,0 +1,20 @@
"""Test the Litter-Robot sensor entity."""
from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN
from homeassistant.const import PERCENTAGE
from .conftest import setup_hub
ENTITY_ID = "sensor.test_waste_drawer"
async def test_sensor(hass, mock_hub):
"""Tests the sensor entity was set up."""
await setup_hub(hass, mock_hub, PLATFORM_DOMAIN)
sensor = hass.states.get(ENTITY_ID)
assert sensor
assert sensor.state == "50"
assert sensor.attributes["cycle_count"] == 15
assert sensor.attributes["cycle_capacity"] == 30
assert sensor.attributes["cycles_after_drawer_full"] == 0
assert sensor.attributes["unit_of_measurement"] == PERCENTAGE