Remove ESPHome legacy entity naming (#123436)

* Remove ESPHome legacy entity naming

* Update test entity_ids to use sanitized name instead of object_id
This commit is contained in:
Jesse Hills 2024-08-09 21:43:02 +12:00 committed by GitHub
parent f8e1c2cfd4
commit 84d6f5ed07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 275 additions and 322 deletions

View file

@ -78,14 +78,14 @@ async def test_climate_entity(
user_service=user_service,
states=states,
)
state = hass.states.get("climate.test_myclimate")
state = hass.states.get("climate.test_my_climate")
assert state is not None
assert state.state == HVACMode.COOL
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_TEMPERATURE: 25},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_TEMPERATURE: 25},
blocking=True,
)
mock_client.climate_command.assert_has_calls([call(key=1, target_temperature=25.0)])
@ -130,14 +130,14 @@ async def test_climate_entity_with_step_and_two_point(
user_service=user_service,
states=states,
)
state = hass.states.get("climate.test_myclimate")
state = hass.states.get("climate.test_my_climate")
assert state is not None
assert state.state == HVACMode.COOL
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_TEMPERATURE: 25},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_TEMPERATURE: 25},
blocking=True,
)
mock_client.climate_command.assert_has_calls([call(key=1, target_temperature=25.0)])
@ -147,7 +147,7 @@ async def test_climate_entity_with_step_and_two_point(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY_ID: "climate.test_myclimate",
ATTR_ENTITY_ID: "climate.test_my_climate",
ATTR_HVAC_MODE: HVACMode.AUTO,
ATTR_TARGET_TEMP_LOW: 20,
ATTR_TARGET_TEMP_HIGH: 30,
@ -209,14 +209,14 @@ async def test_climate_entity_with_step_and_target_temp(
user_service=user_service,
states=states,
)
state = hass.states.get("climate.test_myclimate")
state = hass.states.get("climate.test_my_climate")
assert state is not None
assert state.state == HVACMode.COOL
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_TEMPERATURE: 25},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_TEMPERATURE: 25},
blocking=True,
)
mock_client.climate_command.assert_has_calls([call(key=1, target_temperature=25.0)])
@ -226,7 +226,7 @@ async def test_climate_entity_with_step_and_target_temp(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY_ID: "climate.test_myclimate",
ATTR_ENTITY_ID: "climate.test_my_climate",
ATTR_HVAC_MODE: HVACMode.AUTO,
ATTR_TARGET_TEMP_LOW: 20,
ATTR_TARGET_TEMP_HIGH: 30,
@ -249,7 +249,7 @@ async def test_climate_entity_with_step_and_target_temp(
CLIMATE_DOMAIN,
SERVICE_SET_HVAC_MODE,
{
ATTR_ENTITY_ID: "climate.test_myclimate",
ATTR_ENTITY_ID: "climate.test_my_climate",
ATTR_HVAC_MODE: HVACMode.HEAT,
},
blocking=True,
@ -267,7 +267,7 @@ async def test_climate_entity_with_step_and_target_temp(
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_PRESET_MODE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_PRESET_MODE: "away"},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_PRESET_MODE: "away"},
blocking=True,
)
mock_client.climate_command.assert_has_calls(
@ -283,7 +283,7 @@ async def test_climate_entity_with_step_and_target_temp(
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_PRESET_MODE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_PRESET_MODE: "preset1"},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_PRESET_MODE: "preset1"},
blocking=True,
)
mock_client.climate_command.assert_has_calls([call(key=1, custom_preset="preset1")])
@ -292,7 +292,7 @@ async def test_climate_entity_with_step_and_target_temp(
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_FAN_MODE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_FAN_MODE: FAN_HIGH},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_FAN_MODE: FAN_HIGH},
blocking=True,
)
mock_client.climate_command.assert_has_calls(
@ -303,7 +303,7 @@ async def test_climate_entity_with_step_and_target_temp(
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_FAN_MODE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_FAN_MODE: "fan2"},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_FAN_MODE: "fan2"},
blocking=True,
)
mock_client.climate_command.assert_has_calls([call(key=1, custom_fan_mode="fan2")])
@ -312,7 +312,7 @@ async def test_climate_entity_with_step_and_target_temp(
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_SWING_MODE,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_SWING_MODE: SWING_BOTH},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_SWING_MODE: SWING_BOTH},
blocking=True,
)
mock_client.climate_command.assert_has_calls(
@ -362,7 +362,7 @@ async def test_climate_entity_with_humidity(
user_service=user_service,
states=states,
)
state = hass.states.get("climate.test_myclimate")
state = hass.states.get("climate.test_my_climate")
assert state is not None
assert state.state == HVACMode.AUTO
attributes = state.attributes
@ -374,7 +374,7 @@ async def test_climate_entity_with_humidity(
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_HUMIDITY,
{ATTR_ENTITY_ID: "climate.test_myclimate", ATTR_HUMIDITY: 23},
{ATTR_ENTITY_ID: "climate.test_my_climate", ATTR_HUMIDITY: 23},
blocking=True,
)
mock_client.climate_command.assert_has_calls([call(key=1, target_humidity=23)])
@ -422,7 +422,7 @@ async def test_climate_entity_with_inf_value(
user_service=user_service,
states=states,
)
state = hass.states.get("climate.test_myclimate")
state = hass.states.get("climate.test_my_climate")
assert state is not None
assert state.state == HVACMode.AUTO
attributes = state.attributes
@ -484,7 +484,7 @@ async def test_climate_entity_attributes(
user_service=user_service,
states=states,
)
state = hass.states.get("climate.test_myclimate")
state = hass.states.get("climate.test_my_climate")
assert state is not None
assert state.state == HVACMode.COOL
assert state.attributes == snapshot(name="climate-entity-attributes")