mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Replace functools.partial with ServiceCall.hass in tibber (#133132)
This commit is contained in:
parent
c7adc98408
commit
4a5e47d2f0
@ -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,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user