mirror of
https://github.com/elisspace/core.git
synced 2026-09-18 16:51:50 +00:00
Use entity name translations in Renault (#90697)
This commit is contained in:
@@ -92,7 +92,7 @@ def check_entities_unavailable(
|
||||
for expected_entity in expected_entities:
|
||||
entity_id = expected_entity[ATTR_ENTITY_ID]
|
||||
registry_entry = entity_registry.entities.get(entity_id)
|
||||
assert registry_entry is not None
|
||||
assert registry_entry is not None, f"{entity_id} not found in registry"
|
||||
assert registry_entry.unique_id == expected_entity[ATTR_UNIQUE_ID]
|
||||
state = hass.states.get(entity_id)
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
||||
@@ -84,7 +84,7 @@ MOCK_VEHICLES = {
|
||||
Platform.BINARY_SENSOR: [
|
||||
{
|
||||
ATTR_DEVICE_CLASS: BinarySensorDeviceClass.PLUG,
|
||||
ATTR_ENTITY_ID: "binary_sensor.reg_number_plugged_in",
|
||||
ATTR_ENTITY_ID: "binary_sensor.reg_number_plug",
|
||||
ATTR_STATE: STATE_ON,
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plugged_in",
|
||||
},
|
||||
@@ -160,7 +160,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_battery_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_battery_activity",
|
||||
ATTR_STATE: "2020-01-12T21:40:16+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_battery_last_activity",
|
||||
},
|
||||
@@ -231,7 +231,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_hvac_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_hvac_activity",
|
||||
ATTR_STATE: STATE_UNKNOWN,
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_hvac_last_activity",
|
||||
},
|
||||
@@ -276,7 +276,7 @@ MOCK_VEHICLES = {
|
||||
Platform.BINARY_SENSOR: [
|
||||
{
|
||||
ATTR_DEVICE_CLASS: BinarySensorDeviceClass.PLUG,
|
||||
ATTR_ENTITY_ID: "binary_sensor.reg_number_plugged_in",
|
||||
ATTR_ENTITY_ID: "binary_sensor.reg_number_plug",
|
||||
ATTR_STATE: STATE_OFF,
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_plugged_in",
|
||||
},
|
||||
@@ -395,7 +395,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_battery_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_battery_activity",
|
||||
ATTR_STATE: "2020-11-17T08:06:48+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_battery_last_activity",
|
||||
},
|
||||
@@ -466,7 +466,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_hvac_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_hvac_activity",
|
||||
ATTR_STATE: "2020-12-03T00:00:00+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_hvac_last_activity",
|
||||
},
|
||||
@@ -481,7 +481,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_location_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_location_activity",
|
||||
ATTR_STATE: "2020-02-18T16:58:38+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777999_location_last_activity",
|
||||
},
|
||||
@@ -517,7 +517,7 @@ MOCK_VEHICLES = {
|
||||
Platform.BINARY_SENSOR: [
|
||||
{
|
||||
ATTR_DEVICE_CLASS: BinarySensorDeviceClass.PLUG,
|
||||
ATTR_ENTITY_ID: "binary_sensor.reg_number_plugged_in",
|
||||
ATTR_ENTITY_ID: "binary_sensor.reg_number_plug",
|
||||
ATTR_STATE: STATE_ON,
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777123_plugged_in",
|
||||
},
|
||||
@@ -630,7 +630,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_battery_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_battery_activity",
|
||||
ATTR_STATE: "2020-01-12T21:40:16+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777123_battery_last_activity",
|
||||
},
|
||||
@@ -713,7 +713,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_location_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_location_activity",
|
||||
ATTR_STATE: "2020-02-18T16:58:38+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777123_location_last_activity",
|
||||
},
|
||||
@@ -830,7 +830,7 @@ MOCK_VEHICLES = {
|
||||
{
|
||||
ATTR_DEFAULT_DISABLED: True,
|
||||
ATTR_DEVICE_CLASS: SensorDeviceClass.TIMESTAMP,
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_location_last_activity",
|
||||
ATTR_ENTITY_ID: "sensor.reg_number_last_location_activity",
|
||||
ATTR_STATE: "2020-02-18T16:58:38+00:00",
|
||||
ATTR_UNIQUE_ID: "vf1aaaaa555777123_location_last_activity",
|
||||
},
|
||||
|
||||
@@ -36,6 +36,7 @@ def _check_and_enable_disabled_entities(
|
||||
if expected_entity.get(ATTR_DEFAULT_DISABLED):
|
||||
entity_id = expected_entity[ATTR_ENTITY_ID]
|
||||
registry_entry = entity_registry.entities.get(entity_id)
|
||||
assert registry_entry, f"{entity_id} not found in registry"
|
||||
assert registry_entry.disabled
|
||||
assert registry_entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
||||
entity_registry.async_update_entity(entity_id, **{"disabled_by": None})
|
||||
|
||||
Reference in New Issue
Block a user