Enable types from aiohomekit to be used by mypy for homekit_controller (#65433)

This commit is contained in:
Jc2k 2022-02-03 16:18:03 +00:00 committed by GitHub
parent 6c38a6b569
commit 714a952d73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 200 additions and 90 deletions

View file

@ -9,6 +9,11 @@ from __future__ import annotations
from aiohomekit.model.characteristics import Characteristic, CharacteristicsTypes
from homeassistant.components.number import NumberEntity, NumberEntityDescription
from homeassistant.components.number.const import (
DEFAULT_MAX_VALUE,
DEFAULT_MIN_VALUE,
DEFAULT_STEP,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import EntityCategory
@ -137,17 +142,17 @@ class HomeKitNumber(CharacteristicEntity, NumberEntity):
@property
def min_value(self) -> float:
"""Return the minimum value."""
return self._char.minValue
return self._char.minValue or DEFAULT_MIN_VALUE
@property
def max_value(self) -> float:
"""Return the maximum value."""
return self._char.maxValue
return self._char.maxValue or DEFAULT_MAX_VALUE
@property
def step(self) -> float:
"""Return the increment/decrement step."""
return self._char.minStep
return self._char.minStep or DEFAULT_STEP
@property
def value(self) -> float:
@ -181,17 +186,17 @@ class HomeKitEcobeeFanModeNumber(CharacteristicEntity, NumberEntity):
@property
def min_value(self) -> float:
"""Return the minimum value."""
return self._char.minValue
return self._char.minValue or DEFAULT_MIN_VALUE
@property
def max_value(self) -> float:
"""Return the maximum value."""
return self._char.maxValue
return self._char.maxValue or DEFAULT_MAX_VALUE
@property
def step(self) -> float:
"""Return the increment/decrement step."""
return self._char.minStep
return self._char.minStep or DEFAULT_STEP
@property
def value(self) -> float: