Replace functools.partial with ServiceCall.hass in tibber (#133132)

This commit is contained in:
epenet 2024-12-13 13:29:42 +01:00 committed by GitHub
parent c7adc98408
commit 4a5e47d2f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,6 @@ from __future__ import annotations
import datetime as dt
from datetime import datetime
from functools import partial
from typing import Any, Final
import voluptuous as vol
@ -33,8 +32,8 @@ SERVICE_SCHEMA: Final = vol.Schema(
)
async def __get_prices(call: ServiceCall, *, hass: HomeAssistant) -> ServiceResponse:
tibber_connection = hass.data[DOMAIN]
async def __get_prices(call: ServiceCall) -> ServiceResponse:
tibber_connection = call.hass.data[DOMAIN]
start = __get_date(call.data.get(ATTR_START), "start")
end = __get_date(call.data.get(ATTR_END), "end")
@ -94,7 +93,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
hass.services.async_register(
DOMAIN,
PRICE_SERVICE_NAME,
partial(__get_prices, hass=hass),
__get_prices,
schema=SERVICE_SCHEMA,
supports_response=SupportsResponse.ONLY,
)