Fix type issues [litterrobot] (#67092)
This commit is contained in:
parent
fda3877852
commit
636d791b37
4 changed files with 14 additions and 41 deletions
|
@ -9,7 +9,7 @@ from typing import Any
|
|||
from pylitterbot import Robot
|
||||
from pylitterbot.exceptions import InvalidCommandException
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -60,7 +60,7 @@ class LitterRobotControlEntity(LitterRobotEntity):
|
|||
def __init__(self, robot: Robot, entity_type: str, hub: LitterRobotHub) -> None:
|
||||
"""Init a Litter-Robot control entity."""
|
||||
super().__init__(robot=robot, entity_type=entity_type, hub=hub)
|
||||
self._refresh_callback = None
|
||||
self._refresh_callback: CALLBACK_TYPE | None = None
|
||||
|
||||
async def perform_action_and_refresh(
|
||||
self, action: MethodType, *args: Any, **kwargs: Any
|
||||
|
@ -99,8 +99,11 @@ class LitterRobotControlEntity(LitterRobotEntity):
|
|||
self._refresh_callback = None
|
||||
|
||||
@staticmethod
|
||||
def parse_time_at_default_timezone(time_str: str) -> time | None:
|
||||
def parse_time_at_default_timezone(time_str: str | None) -> time | None:
|
||||
"""Parse a time string and add default timezone."""
|
||||
if time_str is None:
|
||||
return None
|
||||
|
||||
if (parsed_time := dt_util.parse_time(time_str)) is None:
|
||||
return None
|
||||
|
||||
|
@ -127,7 +130,7 @@ class LitterRobotConfigEntity(LitterRobotControlEntity):
|
|||
|
||||
async def perform_action_and_assume_state(
|
||||
self, action: MethodType, assumed_state: Any
|
||||
) -> bool:
|
||||
) -> None:
|
||||
"""Perform an action and assume the state passed in if call is successful."""
|
||||
if await self.perform_action_and_refresh(action, assumed_state):
|
||||
self._assumed_state = assumed_state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue