mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add setup type hints to gpmdp (#63787)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
4c8dac9607
commit
4f3fa0dbbe
@ -28,7 +28,10 @@ from homeassistant.const import (
|
|||||||
STATE_PAUSED,
|
STATE_PAUSED,
|
||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util.json import load_json, save_json
|
from homeassistant.util.json import load_json, save_json
|
||||||
|
|
||||||
_CONFIGURING: dict[str, Any] = {}
|
_CONFIGURING: dict[str, Any] = {}
|
||||||
@ -155,11 +158,16 @@ def setup_gpmdp(hass, config, code, add_entities):
|
|||||||
add_entities([GPMDP(name, url, code)], True)
|
add_entities([GPMDP(name, url, code)], True)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up the GPMDP platform."""
|
"""Set up the GPMDP platform."""
|
||||||
codeconfig = load_json(hass.config.path(GPMDP_CONFIG_FILE))
|
codeconfig = load_json(hass.config.path(GPMDP_CONFIG_FILE))
|
||||||
if codeconfig:
|
if codeconfig:
|
||||||
code = codeconfig.get("CODE")
|
code = codeconfig.get("CODE") if isinstance(codeconfig, dict) else None
|
||||||
elif discovery_info is not None:
|
elif discovery_info is not None:
|
||||||
if "gpmdp" in _CONFIGURING:
|
if "gpmdp" in _CONFIGURING:
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user