Don't inherit SensorEntity/NumberEntity and RestoreEntity in Shelly integration (#93531)
* Use RestoreNumber and Restore Sensor for block entities * Update tests * Use RestoreSensor for RPC entities * Fix test for number platform
This commit is contained in:
parent
7c02e1ca99
commit
fe61672792
7 changed files with 106 additions and 39 deletions
|
@ -17,7 +17,7 @@ from homeassistant.exceptions import HomeAssistantError
|
|||
|
||||
from . import init_integration, register_device, register_entity
|
||||
|
||||
from tests.common import mock_restore_cache
|
||||
from tests.common import mock_restore_cache_with_extra_data
|
||||
|
||||
DEVICE_BLOCK_ID = 4
|
||||
|
||||
|
@ -62,7 +62,14 @@ async def test_block_restored_number(
|
|||
entry,
|
||||
capabilities,
|
||||
)
|
||||
mock_restore_cache(hass, [State(entity_id, "40")])
|
||||
extra_data = {
|
||||
"native_max_value": 100,
|
||||
"native_min_value": 0,
|
||||
"native_step": 1,
|
||||
"native_unit_of_measurement": "%",
|
||||
"native_value": "40",
|
||||
}
|
||||
mock_restore_cache_with_extra_data(hass, ((State(entity_id, ""), extra_data),))
|
||||
|
||||
monkeypatch.setattr(mock_block_device, "initialized", False)
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue