From cedc291872c91ac2f515222ff3e2f46dfad91127 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 11 Feb 2026 19:15:38 +0100 Subject: [PATCH] Use service helper to extract tado config entry (#162812) --- homeassistant/components/tado/services.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/tado/services.py b/homeassistant/components/tado/services.py index a855f323978..57f0d379838 100644 --- a/homeassistant/components/tado/services.py +++ b/homeassistant/components/tado/services.py @@ -5,8 +5,8 @@ import logging import voluptuous as vol from homeassistant.core import HomeAssistant, ServiceCall, callback -from homeassistant.exceptions import HomeAssistantError, ServiceValidationError -from homeassistant.helpers import selector +from homeassistant.exceptions import HomeAssistantError +from homeassistant.helpers import selector, service from .const import ( ATTR_MESSAGE, @@ -15,6 +15,7 @@ from .const import ( DOMAIN, SERVICE_ADD_METER_READING, ) +from .coordinator import TadoConfigEntry _LOGGER = logging.getLogger(__name__) SCHEMA_ADD_METER_READING = vol.Schema( @@ -31,13 +32,12 @@ SCHEMA_ADD_METER_READING = vol.Schema( async def _add_meter_reading(call: ServiceCall) -> None: """Send meter reading to Tado.""" - entry_id: str = call.data[CONF_CONFIG_ENTRY] reading: int = call.data[CONF_READING] _LOGGER.debug("Add meter reading %s", reading) - entry = call.hass.config_entries.async_get_entry(entry_id) - if entry is None: - raise ServiceValidationError("Config entry not found") + entry: TadoConfigEntry = service.async_get_config_entry( + call.hass, DOMAIN, call.data[CONF_CONFIG_ENTRY] + ) coordinator = entry.runtime_data.coordinator response: dict = await coordinator.set_meter_reading(call.data[CONF_READING])