mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add battery sensor to fritzbox smart home devices (#49374)
This commit is contained in:
@@ -13,6 +13,7 @@ from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
PERCENTAGE,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
@@ -47,6 +48,13 @@ async def test_setup(hass: HomeAssistantType, fritz: Mock):
|
||||
assert state.attributes[ATTR_STATE_LOCKED] == "fake_locked"
|
||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == TEMP_CELSIUS
|
||||
|
||||
state = hass.states.get(f"{ENTITY_ID}_battery")
|
||||
|
||||
assert state
|
||||
assert state.state == "23"
|
||||
assert state.attributes[ATTR_FRIENDLY_NAME] == "fake_name Battery"
|
||||
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == PERCENTAGE
|
||||
|
||||
|
||||
async def test_update(hass: HomeAssistantType, fritz: Mock):
|
||||
"""Test update with error."""
|
||||
|
||||
Reference in New Issue
Block a user