mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +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
|
import datetime as dt
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import partial
|
|
||||||
from typing import Any, Final
|
from typing import Any, Final
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -33,8 +32,8 @@ SERVICE_SCHEMA: Final = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def __get_prices(call: ServiceCall, *, hass: HomeAssistant) -> ServiceResponse:
|
async def __get_prices(call: ServiceCall) -> ServiceResponse:
|
||||||
tibber_connection = hass.data[DOMAIN]
|
tibber_connection = call.hass.data[DOMAIN]
|
||||||
|
|
||||||
start = __get_date(call.data.get(ATTR_START), "start")
|
start = __get_date(call.data.get(ATTR_START), "start")
|
||||||
end = __get_date(call.data.get(ATTR_END), "end")
|
end = __get_date(call.data.get(ATTR_END), "end")
|
||||||
@ -94,7 +93,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
|||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
PRICE_SERVICE_NAME,
|
PRICE_SERVICE_NAME,
|
||||||
partial(__get_prices, hass=hass),
|
__get_prices,
|
||||||
schema=SERVICE_SCHEMA,
|
schema=SERVICE_SCHEMA,
|
||||||
supports_response=SupportsResponse.ONLY,
|
supports_response=SupportsResponse.ONLY,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user