Integrations m*: Rename HomeAssistantType to HomeAssistant. (#49567)
This commit is contained in:
parent
90ede05c82
commit
9410aefd0d
23 changed files with 79 additions and 73 deletions
|
@ -13,10 +13,10 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||
from homeassistant.const import CONF_TOKEN, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -41,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigEntry):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigEntry):
|
||||
"""Establish connection with MELCloud."""
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
@ -58,7 +58,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigEntry):
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Establish connection with MELClooud."""
|
||||
conf = entry.data
|
||||
mel_devices = await mel_devices_setup(hass, conf[CONF_TOKEN])
|
||||
|
|
|
@ -30,8 +30,8 @@ from homeassistant.components.climate.const import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import MelCloudDevice
|
||||
from .const import (
|
||||
|
@ -67,7 +67,7 @@ ATW_ZONE_HVAC_MODE_REVERSE_LOOKUP = {v: k for k, v in ATW_ZONE_HVAC_MODE_LOOKUP.
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
):
|
||||
"""Set up MelCloud device climate based on config_entry."""
|
||||
mel_devices = hass.data[DOMAIN][entry.entry_id]
|
||||
|
|
|
@ -15,14 +15,14 @@ from homeassistant.components.water_heater import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN, MelCloudDevice
|
||||
from .const import ATTR_STATUS
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
):
|
||||
"""Set up MelCloud device climate based on config_entry."""
|
||||
mel_devices = hass.data[DOMAIN][entry.entry_id]
|
||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.components.weather import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_MODE, TEMP_CELSIUS
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -44,7 +44,7 @@ def format_condition(condition: str):
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the Meteo-France weather platform."""
|
||||
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR_FORECAST]
|
||||
|
|
|
@ -10,8 +10,8 @@ from homeassistant.const import (
|
|||
TEMP_CELSIUS,
|
||||
UV_INDEX,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
ATTRIBUTION,
|
||||
|
@ -78,7 +78,7 @@ SENSOR_TYPES = {
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigType, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigType, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the Met Office weather sensor platform."""
|
||||
hass_data = hass.data[DOMAIN][entry.entry_id]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Support for UK Met Office weather service."""
|
||||
from homeassistant.components.weather import WeatherEntity
|
||||
from homeassistant.const import LENGTH_KILOMETERS, TEMP_CELSIUS
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
ATTRIBUTION,
|
||||
|
@ -18,7 +18,7 @@ from .const import (
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigType, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigType, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the Met Office weather sensor platform."""
|
||||
hass_data = hass.data[DOMAIN][entry.entry_id]
|
||||
|
|
|
@ -31,11 +31,18 @@ from homeassistant.const import (
|
|||
EVENT_HOMEASSISTANT_STARTED,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import CoreState, Event, HassJob, ServiceCall, callback
|
||||
from homeassistant.core import (
|
||||
CoreState,
|
||||
Event,
|
||||
HassJob,
|
||||
HomeAssistant,
|
||||
ServiceCall,
|
||||
callback,
|
||||
)
|
||||
from homeassistant.exceptions import HomeAssistantError, Unauthorized
|
||||
from homeassistant.helpers import config_validation as cv, event, template
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceDataType
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceDataType
|
||||
from homeassistant.loader import bind_hass
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.async_ import run_callback_threadsafe
|
||||
|
@ -245,7 +252,7 @@ def _build_publish_data(topic: Any, qos: int, retain: bool) -> ServiceDataType:
|
|||
|
||||
|
||||
@bind_hass
|
||||
def publish(hass: HomeAssistantType, topic, payload, qos=None, retain=None) -> None:
|
||||
def publish(hass: HomeAssistant, topic, payload, qos=None, retain=None) -> None:
|
||||
"""Publish message to an MQTT topic."""
|
||||
hass.add_job(async_publish, hass, topic, payload, qos, retain)
|
||||
|
||||
|
@ -253,7 +260,7 @@ def publish(hass: HomeAssistantType, topic, payload, qos=None, retain=None) -> N
|
|||
@callback
|
||||
@bind_hass
|
||||
def async_publish(
|
||||
hass: HomeAssistantType, topic: Any, payload, qos=None, retain=None
|
||||
hass: HomeAssistant, topic: Any, payload, qos=None, retain=None
|
||||
) -> None:
|
||||
"""Publish message to an MQTT topic."""
|
||||
data = _build_publish_data(topic, qos, retain)
|
||||
|
@ -263,7 +270,7 @@ def async_publish(
|
|||
|
||||
@bind_hass
|
||||
def publish_template(
|
||||
hass: HomeAssistantType, topic, payload_template, qos=None, retain=None
|
||||
hass: HomeAssistant, topic, payload_template, qos=None, retain=None
|
||||
) -> None:
|
||||
"""Publish message to an MQTT topic."""
|
||||
hass.add_job(async_publish_template, hass, topic, payload_template, qos, retain)
|
||||
|
@ -271,7 +278,7 @@ def publish_template(
|
|||
|
||||
@bind_hass
|
||||
def async_publish_template(
|
||||
hass: HomeAssistantType, topic, payload_template, qos=None, retain=None
|
||||
hass: HomeAssistant, topic, payload_template, qos=None, retain=None
|
||||
) -> None:
|
||||
"""Publish message to an MQTT topic using a template payload."""
|
||||
data = _build_publish_data(topic, qos, retain)
|
||||
|
@ -308,7 +315,7 @@ def wrap_msg_callback(msg_callback: MessageCallbackType) -> MessageCallbackType:
|
|||
|
||||
@bind_hass
|
||||
async def async_subscribe(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
topic: str,
|
||||
msg_callback: MessageCallbackType,
|
||||
qos: int = DEFAULT_QOS,
|
||||
|
@ -353,7 +360,7 @@ async def async_subscribe(
|
|||
|
||||
@bind_hass
|
||||
def subscribe(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
topic: str,
|
||||
msg_callback: MessageCallbackType,
|
||||
qos: int = DEFAULT_QOS,
|
||||
|
@ -372,7 +379,7 @@ def subscribe(
|
|||
|
||||
|
||||
async def _async_setup_discovery(
|
||||
hass: HomeAssistantType, conf: ConfigType, config_entry
|
||||
hass: HomeAssistant, conf: ConfigType, config_entry
|
||||
) -> bool:
|
||||
"""Try to start the discovery of MQTT devices.
|
||||
|
||||
|
@ -385,7 +392,7 @@ async def _async_setup_discovery(
|
|||
return success
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Start the MQTT protocol service."""
|
||||
conf: ConfigType | None = config.get(DOMAIN)
|
||||
|
||||
|
@ -542,7 +549,7 @@ class MQTT:
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config_entry,
|
||||
conf,
|
||||
) -> None:
|
||||
|
|
|
@ -26,10 +26,10 @@ from homeassistant.const import (
|
|||
STATE_ALARM_PENDING,
|
||||
STATE_ALARM_TRIGGERED,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
|
@ -87,7 +87,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT alarm control panel through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -18,12 +18,12 @@ from homeassistant.const import (
|
|||
CONF_PAYLOAD_ON,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.helpers.event as evt
|
||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import CONF_QOS, CONF_STATE_TOPIC, DOMAIN, PLATFORMS, subscription
|
||||
|
@ -59,7 +59,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT binary sensor through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -6,10 +6,10 @@ import voluptuous as vol
|
|||
from homeassistant.components import camera
|
||||
from homeassistant.components.camera import Camera
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import CONF_QOS, DOMAIN, PLATFORMS, subscription
|
||||
from .. import mqtt
|
||||
|
@ -28,7 +28,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT camera through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -46,10 +46,10 @@ from homeassistant.const import (
|
|||
PRECISION_WHOLE,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
CONF_QOS,
|
||||
|
@ -251,7 +251,7 @@ PLATFORM_SCHEMA = SCHEMA_BASE.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, async_add_entities, config: ConfigType, discovery_info=None
|
||||
hass: HomeAssistant, async_add_entities, config: ConfigType, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT climate device through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -30,10 +30,10 @@ from homeassistant.const import (
|
|||
STATE_OPENING,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
|
@ -184,7 +184,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT cover through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -3,7 +3,7 @@ from collections import deque
|
|||
from functools import wraps
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import ATTR_DISCOVERY_PAYLOAD, ATTR_DISCOVERY_TOPIC
|
||||
from .models import MessageCallbackType
|
||||
|
@ -12,7 +12,7 @@ DATA_MQTT_DEBUG_INFO = "mqtt_debug_info"
|
|||
STORED_MESSAGES = 10
|
||||
|
||||
|
||||
def log_messages(hass: HomeAssistantType, entity_id: str) -> MessageCallbackType:
|
||||
def log_messages(hass: HomeAssistant, entity_id: str) -> MessageCallbackType:
|
||||
"""Wrap an MQTT message callback to support message logging."""
|
||||
|
||||
def _log_message(msg):
|
||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import CONF_PAYLOAD, CONF_QOS, DOMAIN, debug_info, trigger as mqtt_trigger
|
||||
from .. import mqtt
|
||||
|
@ -120,7 +120,7 @@ class Trigger:
|
|||
|
||||
device_id: str = attr.ib()
|
||||
discovery_data: dict = attr.ib()
|
||||
hass: HomeAssistantType = attr.ib()
|
||||
hass: HomeAssistant = attr.ib()
|
||||
payload: str = attr.ib()
|
||||
qos: int = attr.ib()
|
||||
remove_signal: Callable[[], None] = attr.ib()
|
||||
|
|
|
@ -8,11 +8,11 @@ import re
|
|||
import time
|
||||
|
||||
from homeassistant.const import CONF_DEVICE, CONF_PLATFORM
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.loader import async_get_mqtt
|
||||
|
||||
from .. import mqtt
|
||||
|
@ -79,9 +79,7 @@ class MQTTConfig(dict):
|
|||
"""Dummy class to allow adding attributes."""
|
||||
|
||||
|
||||
async def async_start(
|
||||
hass: HomeAssistantType, discovery_topic, config_entry=None
|
||||
) -> bool:
|
||||
async def async_start(hass: HomeAssistant, discovery_topic, config_entry=None) -> bool:
|
||||
"""Start MQTT Discovery."""
|
||||
mqtt_integrations = {}
|
||||
|
||||
|
@ -295,7 +293,7 @@ async def async_start(
|
|||
return True
|
||||
|
||||
|
||||
async def async_stop(hass: HomeAssistantType) -> bool:
|
||||
async def async_stop(hass: HomeAssistant) -> bool:
|
||||
"""Stop MQTT Discovery."""
|
||||
if DISCOVERY_UNSUBSCRIBE in hass.data:
|
||||
for unsub in hass.data[DISCOVERY_UNSUBSCRIBE]:
|
||||
|
|
|
@ -28,10 +28,10 @@ from homeassistant.const import (
|
|||
CONF_PAYLOAD_ON,
|
||||
CONF_STATE,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util.percentage import (
|
||||
int_states_in_range,
|
||||
ordered_list_item_to_percentage,
|
||||
|
@ -181,7 +181,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT fan through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -6,10 +6,10 @@ import voluptuous as vol
|
|||
from homeassistant.components import lock
|
||||
from homeassistant.components.lock import LockEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_OPTIMISTIC, CONF_VALUE_TEMPLATE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
|
@ -50,7 +50,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_RW_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT lock panel through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -7,11 +7,11 @@ import voluptuous as vol
|
|||
from homeassistant.components import number
|
||||
from homeassistant.components.number import NumberEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_OPTIMISTIC
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
|
@ -40,7 +40,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_RW_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT number through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -6,9 +6,10 @@ import voluptuous as vol
|
|||
from homeassistant.components import scene
|
||||
from homeassistant.components.scene import Scene
|
||||
from homeassistant.const import CONF_ICON, CONF_NAME, CONF_PAYLOAD_ON, CONF_UNIQUE_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import CONF_COMMAND_TOPIC, CONF_QOS, CONF_RETAIN, DOMAIN, PLATFORMS
|
||||
from .. import mqtt
|
||||
|
@ -35,7 +36,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT scene through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -15,11 +15,11 @@ from homeassistant.const import (
|
|||
CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import CONF_QOS, CONF_STATE_TOPIC, DOMAIN, PLATFORMS, subscription
|
||||
|
@ -48,7 +48,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT sensors through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Callable
|
|||
|
||||
import attr
|
||||
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
from . import debug_info
|
||||
|
@ -18,7 +18,7 @@ from .models import MessageCallbackType
|
|||
class EntitySubscription:
|
||||
"""Class to hold data about an active entity topic subscription."""
|
||||
|
||||
hass: HomeAssistantType = attr.ib()
|
||||
hass: HomeAssistant = attr.ib()
|
||||
topic: str = attr.ib()
|
||||
message_callback: MessageCallbackType = attr.ib()
|
||||
unsubscribe_callback: Callable[[], None] | None = attr.ib()
|
||||
|
@ -63,7 +63,7 @@ class EntitySubscription:
|
|||
|
||||
@bind_hass
|
||||
async def async_subscribe_topics(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
new_state: dict[str, EntitySubscription] | None,
|
||||
topics: dict[str, Any],
|
||||
):
|
||||
|
@ -106,6 +106,6 @@ async def async_subscribe_topics(
|
|||
|
||||
|
||||
@bind_hass
|
||||
async def async_unsubscribe_topics(hass: HomeAssistantType, sub_state: dict):
|
||||
async def async_unsubscribe_topics(hass: HomeAssistant, sub_state: dict):
|
||||
"""Unsubscribe from all MQTT topics managed by async_subscribe_topics."""
|
||||
return await async_subscribe_topics(hass, sub_state, {})
|
||||
|
|
|
@ -13,11 +13,11 @@ from homeassistant.const import (
|
|||
CONF_VALUE_TEMPLATE,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
|
@ -52,7 +52,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_RW_PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT switch through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.components.meteo_france.const import (
|
|||
)
|
||||
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER
|
||||
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_MODE
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -214,7 +214,7 @@ async def test_abort_if_already_setup(hass, client_single):
|
|||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_options_flow(hass: HomeAssistantType):
|
||||
async def test_options_flow(hass: HomeAssistant):
|
||||
"""Test config flow options."""
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
|
|
Loading…
Add table
Reference in a new issue