From db0486c5e14a5bf43b51e9eff488be48ce3bc861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noah=20Gro=C3=9F?= Date: Wed, 31 Jan 2024 09:01:17 +0100 Subject: [PATCH] Use constants in Picnic service functions (#109170) Co-authored-by: Franck Nijhof --- homeassistant/components/picnic/services.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/picnic/services.py b/homeassistant/components/picnic/services.py index 2aafb20abaf..03b7576703d 100644 --- a/homeassistant/components/picnic/services.py +++ b/homeassistant/components/picnic/services.py @@ -61,17 +61,17 @@ async def handle_add_product( hass: HomeAssistant, api_client: PicnicAPI, call: ServiceCall ) -> None: """Handle the call for the add_product service.""" - product_id = call.data.get("product_id") + product_id = call.data.get(ATTR_PRODUCT_ID) if not product_id: product_id = await hass.async_add_executor_job( - product_search, api_client, cast(str, call.data["product_name"]) + product_search, api_client, cast(str, call.data[ATTR_PRODUCT_NAME]) ) if not product_id: raise PicnicServiceException("No product found or no product ID given!") await hass.async_add_executor_job( - api_client.add_product, product_id, call.data.get("amount", 1) + api_client.add_product, product_id, call.data.get(ATTR_AMOUNT, 1) )