Fix watts unit for homekit_controller power sensors (#53877)

This commit is contained in:
Jc2k 2021-08-02 18:47:11 +01:00 committed by GitHub
parent 80a8f35a42
commit d414b58769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,6 @@
"""Make sure that existing Koogeek P1EU support isn't broken."""
from homeassistant.const import POWER_WATT
from homeassistant.helpers import device_registry as dr, entity_registry as er
from tests.components.homekit_controller.common import (
@ -48,6 +49,7 @@ async def test_koogeek_p1eu_setup(hass):
)
state = await helper.poll_and_get_state()
assert state.attributes["friendly_name"] == "Koogeek-P1-A00AA0 - Real Time Energy"
assert state.attributes["unit_of_measurement"] == POWER_WATT
# The sensor and switch should be part of the same device
assert entry.device_id == device.id

View file

@ -6,6 +6,7 @@ This Koogeek device has a custom power sensor that extra handling.
It should have 2 entities - the actual switch and a sensor for power usage.
"""
from homeassistant.const import POWER_WATT
from homeassistant.helpers import device_registry as dr, entity_registry as er
from tests.components.homekit_controller.common import (
@ -58,6 +59,7 @@ async def test_koogeek_ls1_setup(hass):
# Assert that the friendly name is detected correctly
assert state.attributes["friendly_name"] == "Koogeek-SW2-187A91 - Real Time Energy"
assert state.attributes["unit_of_measurement"] == POWER_WATT
device_registry = dr.async_get(hass)