diff --git a/homeassistant/components/water_heater/device_action.py b/homeassistant/components/water_heater/device_action.py index 3ccfcfb5279d..375ab5c44b8c 100644 --- a/homeassistant/components/water_heater/device_action.py +++ b/homeassistant/components/water_heater/device_action.py @@ -1,14 +1,16 @@ """Provides device automations for Water Heater.""" +from typing import Any + import probatio from homeassistant.components.device_automation import async_validate_entity_schema from homeassistant.const import ( - ATTR_ENTITY_ID, CONF_DEVICE_ID, CONF_DOMAIN, CONF_ENTITY_ID, CONF_TYPE, + TargetKey, ) from homeassistant.core import Context, HomeAssistant from homeassistant.helpers import config_validation as cv, entity_registry as er @@ -63,7 +65,7 @@ async def async_call_action_from_config( context: Context | None, ) -> None: """Execute a device action.""" - service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]} + service_data: dict[str, Any] = {TargetKey.ENTITY_ID: config[CONF_ENTITY_ID]} if config[CONF_TYPE] == "turn_on": service = WaterHeaterService.TURN_ON diff --git a/homeassistant/components/water_heater/reproduce_state.py b/homeassistant/components/water_heater/reproduce_state.py index 02ef4ed18518..0dfd0a163776 100644 --- a/homeassistant/components/water_heater/reproduce_state.py +++ b/homeassistant/components/water_heater/reproduce_state.py @@ -5,7 +5,7 @@ from collections.abc import Iterable import logging from typing import Any -from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON +from homeassistant.const import STATE_OFF, STATE_ON, TargetKey from homeassistant.core import Context, HomeAssistant, State from . import ( @@ -65,7 +65,7 @@ async def _async_reproduce_state( ): return - service_data = {ATTR_ENTITY_ID: state.entity_id} + service_data: dict[str, Any] = {TargetKey.ENTITY_ID: state.entity_id} if state.state != cur_state.state: if state.state == STATE_ON: @@ -90,7 +90,7 @@ async def _async_reproduce_state( DOMAIN, WaterHeaterService.SET_TEMPERATURE, { - ATTR_ENTITY_ID: state.entity_id, + TargetKey.ENTITY_ID: state.entity_id, WaterHeaterServiceArgument.TEMPERATURE: state.attributes.get( WaterHeaterStateAttribute.TARGET_TEMPERATURE ), @@ -108,7 +108,7 @@ async def _async_reproduce_state( DOMAIN, WaterHeaterService.SET_AWAY_MODE, { - ATTR_ENTITY_ID: state.entity_id, + TargetKey.ENTITY_ID: state.entity_id, WaterHeaterServiceArgument.AWAY_MODE: state.attributes.get( WaterHeaterStateAttribute.AWAY_MODE ),