Fix watts unit for homekit_controller power sensors (#53877)
This commit is contained in:
parent
80a8f35a42
commit
d414b58769
3 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue