Improve typing in ihc util (#87069)
This commit is contained in:
parent
a79be493e5
commit
22c295fbdc
1 changed files with 15 additions and 5 deletions
|
@ -2,10 +2,14 @@
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from ihcsdk.ihccontroller import IHCController
|
||||||
|
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
|
||||||
|
|
||||||
async def async_pulse(hass, ihc_controller, ihc_id: int):
|
async def async_pulse(
|
||||||
|
hass: HomeAssistant, ihc_controller: IHCController, ihc_id: int
|
||||||
|
) -> None:
|
||||||
"""Send a short on/off pulse to an IHC controller resource."""
|
"""Send a short on/off pulse to an IHC controller resource."""
|
||||||
await async_set_bool(hass, ihc_controller, ihc_id, True)
|
await async_set_bool(hass, ihc_controller, ihc_id, True)
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
@ -13,7 +17,9 @@ async def async_pulse(hass, ihc_controller, ihc_id: int):
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_set_bool(hass, ihc_controller, ihc_id: int, value: bool):
|
def async_set_bool(
|
||||||
|
hass: HomeAssistant, ihc_controller: IHCController, ihc_id: int, value: bool
|
||||||
|
) -> asyncio.Future[bool]:
|
||||||
"""Set a bool value on an IHC controller resource."""
|
"""Set a bool value on an IHC controller resource."""
|
||||||
return hass.async_add_executor_job(
|
return hass.async_add_executor_job(
|
||||||
ihc_controller.set_runtime_value_bool, ihc_id, value
|
ihc_controller.set_runtime_value_bool, ihc_id, value
|
||||||
|
@ -21,7 +27,9 @@ def async_set_bool(hass, ihc_controller, ihc_id: int, value: bool):
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_set_int(hass, ihc_controller, ihc_id: int, value: int):
|
def async_set_int(
|
||||||
|
hass: HomeAssistant, ihc_controller: IHCController, ihc_id: int, value: int
|
||||||
|
) -> asyncio.Future[bool]:
|
||||||
"""Set a int value on an IHC controller resource."""
|
"""Set a int value on an IHC controller resource."""
|
||||||
return hass.async_add_executor_job(
|
return hass.async_add_executor_job(
|
||||||
ihc_controller.set_runtime_value_int, ihc_id, value
|
ihc_controller.set_runtime_value_int, ihc_id, value
|
||||||
|
@ -29,7 +37,9 @@ def async_set_int(hass, ihc_controller, ihc_id: int, value: int):
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_set_float(hass, ihc_controller, ihc_id: int, value: float):
|
def async_set_float(
|
||||||
|
hass: HomeAssistant, ihc_controller: IHCController, ihc_id: int, value: float
|
||||||
|
) -> asyncio.Future[bool]:
|
||||||
"""Set a float value on an IHC controller resource."""
|
"""Set a float value on an IHC controller resource."""
|
||||||
return hass.async_add_executor_job(
|
return hass.async_add_executor_job(
|
||||||
ihc_controller.set_runtime_value_float, ihc_id, value
|
ihc_controller.set_runtime_value_float, ihc_id, value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue