Add support to entity registry for overriding device_class (#59985)
This commit is contained in:
parent
67e13b35db
commit
49a27e12ad
31 changed files with 136 additions and 69 deletions
|
@ -1118,14 +1118,14 @@ async def test_homekit_finds_linked_batteries(
|
|||
"powerwall",
|
||||
"battery_charging",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
original_device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
)
|
||||
battery_sensor = entity_reg.async_get_or_create(
|
||||
"sensor",
|
||||
"powerwall",
|
||||
"battery",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_BATTERY,
|
||||
original_device_class=DEVICE_CLASS_BATTERY,
|
||||
)
|
||||
light = entity_reg.async_get_or_create(
|
||||
"light", "powerwall", "demo", device_id=device_entry.id
|
||||
|
@ -1187,14 +1187,14 @@ async def test_homekit_async_get_integration_fails(
|
|||
"invalid_integration_does_not_exist",
|
||||
"battery_charging",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
original_device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
)
|
||||
battery_sensor = entity_reg.async_get_or_create(
|
||||
"sensor",
|
||||
"invalid_integration_does_not_exist",
|
||||
"battery",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_BATTERY,
|
||||
original_device_class=DEVICE_CLASS_BATTERY,
|
||||
)
|
||||
light = entity_reg.async_get_or_create(
|
||||
"light", "invalid_integration_does_not_exist", "demo", device_id=device_entry.id
|
||||
|
@ -1334,14 +1334,14 @@ async def test_homekit_ignored_missing_devices(
|
|||
"powerwall",
|
||||
"battery_charging",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
original_device_class=DEVICE_CLASS_BATTERY_CHARGING,
|
||||
)
|
||||
entity_reg.async_get_or_create(
|
||||
"sensor",
|
||||
"powerwall",
|
||||
"battery",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_BATTERY,
|
||||
original_device_class=DEVICE_CLASS_BATTERY,
|
||||
)
|
||||
light = entity_reg.async_get_or_create(
|
||||
"light", "powerwall", "demo", device_id=device_entry.id
|
||||
|
@ -1404,7 +1404,7 @@ async def test_homekit_finds_linked_motion_sensors(
|
|||
"camera",
|
||||
"motion_sensor",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_MOTION,
|
||||
original_device_class=DEVICE_CLASS_MOTION,
|
||||
)
|
||||
camera = entity_reg.async_get_or_create(
|
||||
"camera", "camera", "demo", device_id=device_entry.id
|
||||
|
@ -1466,7 +1466,7 @@ async def test_homekit_finds_linked_humidity_sensors(
|
|||
"humidifier",
|
||||
"humidity_sensor",
|
||||
device_id=device_entry.id,
|
||||
device_class=DEVICE_CLASS_HUMIDITY,
|
||||
original_device_class=DEVICE_CLASS_HUMIDITY,
|
||||
)
|
||||
humidifier = entity_reg.async_get_or_create(
|
||||
"humidifier", "humidifier", "demo", device_id=device_entry.id
|
||||
|
|
|
@ -506,7 +506,7 @@ async def test_windowcovering_basic_restore(hass, hk_driver, events):
|
|||
suggested_object_id="all_info_set",
|
||||
capabilities={},
|
||||
supported_features=SUPPORT_STOP,
|
||||
device_class="mock-device-class",
|
||||
original_device_class="mock-device-class",
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
@ -544,7 +544,7 @@ async def test_windowcovering_restore(hass, hk_driver, events):
|
|||
suggested_object_id="all_info_set",
|
||||
capabilities={},
|
||||
supported_features=SUPPORT_STOP,
|
||||
device_class="mock-device-class",
|
||||
original_device_class="mock-device-class",
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
|
|
@ -546,7 +546,7 @@ async def test_fan_restore(hass, hk_driver, events):
|
|||
suggested_object_id="all_info_set",
|
||||
capabilities={"speed_list": ["off", "low", "medium", "high"]},
|
||||
supported_features=SUPPORT_SET_SPEED | SUPPORT_OSCILLATE | SUPPORT_DIRECTION,
|
||||
device_class="mock-device-class",
|
||||
original_device_class="mock-device-class",
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
|
|
@ -546,7 +546,7 @@ async def test_light_restore(hass, hk_driver, events):
|
|||
suggested_object_id="all_info_set",
|
||||
capabilities={"supported_color_modes": ["brightness"], "max": 100},
|
||||
supported_features=5,
|
||||
device_class="mock-device-class",
|
||||
original_device_class="mock-device-class",
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
|
|
@ -431,7 +431,7 @@ async def test_tv_restore(hass, hk_driver, events):
|
|||
"generic",
|
||||
"1234",
|
||||
suggested_object_id="simple",
|
||||
device_class=DEVICE_CLASS_TV,
|
||||
original_device_class=DEVICE_CLASS_TV,
|
||||
)
|
||||
registry.async_get_or_create(
|
||||
"media_player",
|
||||
|
@ -442,7 +442,7 @@ async def test_tv_restore(hass, hk_driver, events):
|
|||
ATTR_INPUT_SOURCE_LIST: ["HDMI 1", "HDMI 2", "HDMI 3", "HDMI 4"],
|
||||
},
|
||||
supported_features=3469,
|
||||
device_class=DEVICE_CLASS_TV,
|
||||
original_device_class=DEVICE_CLASS_TV,
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
|
|
@ -333,14 +333,14 @@ async def test_sensor_restore(hass, hk_driver, events):
|
|||
"generic",
|
||||
"1234",
|
||||
suggested_object_id="temperature",
|
||||
device_class="temperature",
|
||||
original_device_class="temperature",
|
||||
)
|
||||
registry.async_get_or_create(
|
||||
"sensor",
|
||||
"generic",
|
||||
"12345",
|
||||
suggested_object_id="humidity",
|
||||
device_class="humidity",
|
||||
original_device_class="humidity",
|
||||
unit_of_measurement=PERCENTAGE,
|
||||
)
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
|
|
@ -1018,7 +1018,7 @@ async def test_thermostat_restore(hass, hk_driver, events):
|
|||
ATTR_HVAC_MODES: [HVAC_MODE_HEAT_COOL, HVAC_MODE_OFF],
|
||||
},
|
||||
supported_features=0,
|
||||
device_class="mock-device-class",
|
||||
original_device_class="mock-device-class",
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
@ -1826,7 +1826,7 @@ async def test_water_heater_restore(hass, hk_driver, events):
|
|||
suggested_object_id="all_info_set",
|
||||
capabilities={ATTR_MIN_TEMP: 60, ATTR_MAX_TEMP: 70},
|
||||
supported_features=0,
|
||||
device_class="mock-device-class",
|
||||
original_device_class="mock-device-class",
|
||||
)
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START, {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue