hass-core/homeassistant/components/overkiz/const.py
Mick Vleeshouwer b4187540c0
Improve typing for Overkiz integration and address late feedback (#63483)
* Bump pyoverkiz to 1.0.2

* Remove cast for str enum.

* Address feedback on coordinator

* Change datatype to Callable

* Address feedback

* Move scenarios to seperate list

* Cast Device to avoid issues with DataUpdateCoordinator default

* Remove unnecessary casts and improve type notation

* Check if state.value exists

* Fix last mypy error (thanks @epenet)

* Remove extra string cast

* Improve sensor typing

* Update pyoverkiz and remove typing

* Small code improvement

* Fix assert to reflect real world

* Properly type Callable to not return Any

* Remove unnecessary cast

* Add OverkizStateType

* Bugfix

* Address feedback - multiline lambda

* Pylint fix

* Remove added binary sensor
2022-01-08 10:53:15 +01:00

41 lines
1.1 KiB
Python

"""Constants for the Overkiz (by Somfy) integration."""
from __future__ import annotations
from datetime import timedelta
from typing import Any, Dict, Final, List, Union
from pyoverkiz.enums import UIClass
from pyoverkiz.enums.ui import UIWidget
from homeassistant.const import Platform
DOMAIN: Final = "overkiz"
CONF_HUB: Final = "hub"
DEFAULT_HUB: Final = "somfy_europe"
UPDATE_INTERVAL: Final = timedelta(seconds=30)
UPDATE_INTERVAL_ALL_ASSUMED_STATE: Final = timedelta(minutes=60)
PLATFORMS: list[Platform] = [
Platform.BINARY_SENSOR,
Platform.BUTTON,
Platform.LIGHT,
Platform.LOCK,
Platform.NUMBER,
Platform.SCENE,
Platform.SENSOR,
]
IGNORED_OVERKIZ_DEVICES: list[UIClass | UIWidget] = [
UIClass.PROTOCOL_GATEWAY,
UIClass.POD,
]
# Used to map the Somfy widget and ui_class to the Home Assistant platform
OVERKIZ_DEVICE_TO_PLATFORM: dict[UIClass | UIWidget, Platform] = {
UIClass.DOOR_LOCK: Platform.LOCK,
UIClass.LIGHT: Platform.LIGHT,
}
OverkizStateType = Union[str, int, float, bool, Dict[Any, Any], List[Any], None]