Use device name as entity name in Eheim digital climate (#136997)

This commit is contained in:
Joost Lekkerkerker 2025-01-31 16:32:11 +01:00 committed by GitHub
parent 84ae476b67
commit 6f1539f60d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 18 deletions

View File

@ -76,6 +76,7 @@ class EheimDigitalHeaterClimate(EheimDigitalEntity[EheimDigitalHeater], ClimateE
_attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_preset_mode = PRESET_NONE _attr_preset_mode = PRESET_NONE
_attr_translation_key = "heater" _attr_translation_key = "heater"
_attr_name = None
def __init__( def __init__(
self, coordinator: EheimDigitalUpdateCoordinator, device: EheimDigitalHeater self, coordinator: EheimDigitalUpdateCoordinator, device: EheimDigitalHeater

View File

@ -1,5 +1,5 @@
# serializer version: 1 # serializer version: 1
# name: test_dynamic_new_devices[climate.mock_heater_none-entry] # name: test_dynamic_new_devices[climate.mock_heater-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
}), }),
@ -24,7 +24,7 @@
'disabled_by': None, 'disabled_by': None,
'domain': 'climate', 'domain': 'climate',
'entity_category': None, 'entity_category': None,
'entity_id': 'climate.mock_heater_none', 'entity_id': 'climate.mock_heater',
'has_entity_name': True, 'has_entity_name': True,
'hidden_by': None, 'hidden_by': None,
'icon': None, 'icon': None,
@ -45,11 +45,11 @@
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
# --- # ---
# name: test_dynamic_new_devices[climate.mock_heater_none-state] # name: test_dynamic_new_devices[climate.mock_heater-state]
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'current_temperature': 24.2, 'current_temperature': 24.2,
'friendly_name': 'Mock Heater None', 'friendly_name': 'Mock Heater',
'hvac_action': <HVACAction.HEATING: 'heating'>, 'hvac_action': <HVACAction.HEATING: 'heating'>,
'hvac_modes': list([ 'hvac_modes': list([
<HVACMode.OFF: 'off'>, <HVACMode.OFF: 'off'>,
@ -68,14 +68,14 @@
'temperature': 25.5, 'temperature': 25.5,
}), }),
'context': <ANY>, 'context': <ANY>,
'entity_id': 'climate.mock_heater_none', 'entity_id': 'climate.mock_heater',
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': 'auto', 'state': 'auto',
}) })
# --- # ---
# name: test_setup_heater[climate.mock_heater_none-entry] # name: test_setup_heater[climate.mock_heater-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({
}), }),
@ -100,7 +100,7 @@
'disabled_by': None, 'disabled_by': None,
'domain': 'climate', 'domain': 'climate',
'entity_category': None, 'entity_category': None,
'entity_id': 'climate.mock_heater_none', 'entity_id': 'climate.mock_heater',
'has_entity_name': True, 'has_entity_name': True,
'hidden_by': None, 'hidden_by': None,
'icon': None, 'icon': None,
@ -121,11 +121,11 @@
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
# --- # ---
# name: test_setup_heater[climate.mock_heater_none-state] # name: test_setup_heater[climate.mock_heater-state]
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'current_temperature': 24.2, 'current_temperature': 24.2,
'friendly_name': 'Mock Heater None', 'friendly_name': 'Mock Heater',
'hvac_action': <HVACAction.HEATING: 'heating'>, 'hvac_action': <HVACAction.HEATING: 'heating'>,
'hvac_modes': list([ 'hvac_modes': list([
<HVACMode.OFF: 'off'>, <HVACMode.OFF: 'off'>,
@ -144,7 +144,7 @@
'temperature': 25.5, 'temperature': 25.5,
}), }),
'context': <ANY>, 'context': <ANY>,
'entity_id': 'climate.mock_heater_none', 'entity_id': 'climate.mock_heater',
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,

View File

@ -123,7 +123,7 @@ async def test_set_preset_mode(
await hass.services.async_call( await hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,
SERVICE_SET_PRESET_MODE, SERVICE_SET_PRESET_MODE,
{ATTR_ENTITY_ID: "climate.mock_heater_none", ATTR_PRESET_MODE: preset_mode}, {ATTR_ENTITY_ID: "climate.mock_heater", ATTR_PRESET_MODE: preset_mode},
blocking=True, blocking=True,
) )
@ -132,7 +132,7 @@ async def test_set_preset_mode(
await hass.services.async_call( await hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,
SERVICE_SET_PRESET_MODE, SERVICE_SET_PRESET_MODE,
{ATTR_ENTITY_ID: "climate.mock_heater_none", ATTR_PRESET_MODE: preset_mode}, {ATTR_ENTITY_ID: "climate.mock_heater", ATTR_PRESET_MODE: preset_mode},
blocking=True, blocking=True,
) )
@ -161,7 +161,7 @@ async def test_set_temperature(
await hass.services.async_call( await hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE, SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: "climate.mock_heater_none", ATTR_TEMPERATURE: 26.0}, {ATTR_ENTITY_ID: "climate.mock_heater", ATTR_TEMPERATURE: 26.0},
blocking=True, blocking=True,
) )
@ -170,7 +170,7 @@ async def test_set_temperature(
await hass.services.async_call( await hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE, SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: "climate.mock_heater_none", ATTR_TEMPERATURE: 26.0}, {ATTR_ENTITY_ID: "climate.mock_heater", ATTR_TEMPERATURE: 26.0},
blocking=True, blocking=True,
) )
@ -204,7 +204,7 @@ async def test_set_hvac_mode(
await hass.services.async_call( await hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,
SERVICE_SET_HVAC_MODE, SERVICE_SET_HVAC_MODE,
{ATTR_ENTITY_ID: "climate.mock_heater_none", ATTR_HVAC_MODE: hvac_mode}, {ATTR_ENTITY_ID: "climate.mock_heater", ATTR_HVAC_MODE: hvac_mode},
blocking=True, blocking=True,
) )
@ -213,7 +213,7 @@ async def test_set_hvac_mode(
await hass.services.async_call( await hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,
SERVICE_SET_HVAC_MODE, SERVICE_SET_HVAC_MODE,
{ATTR_ENTITY_ID: "climate.mock_heater_none", ATTR_HVAC_MODE: hvac_mode}, {ATTR_ENTITY_ID: "climate.mock_heater", ATTR_HVAC_MODE: hvac_mode},
blocking=True, blocking=True,
) )
@ -239,7 +239,7 @@ async def test_state_update(
) )
await hass.async_block_till_done() await hass.async_block_till_done()
assert (state := hass.states.get("climate.mock_heater_none")) assert (state := hass.states.get("climate.mock_heater"))
assert state.attributes["hvac_action"] == HVACAction.IDLE assert state.attributes["hvac_action"] == HVACAction.IDLE
assert state.attributes["preset_mode"] == HEATER_BIO_MODE assert state.attributes["preset_mode"] == HEATER_BIO_MODE
@ -249,6 +249,6 @@ async def test_state_update(
await eheimdigital_hub_mock.call_args.kwargs["receive_callback"]() await eheimdigital_hub_mock.call_args.kwargs["receive_callback"]()
assert (state := hass.states.get("climate.mock_heater_none")) assert (state := hass.states.get("climate.mock_heater"))
assert state.state == HVACMode.OFF assert state.state == HVACMode.OFF
assert state.attributes["preset_mode"] == HEATER_SMART_MODE assert state.attributes["preset_mode"] == HEATER_SMART_MODE