mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Add TagProtocol as type hint in MQTT tag (#82134)
This commit is contained in:
parent
9eef5129f0
commit
285c61c0d7
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
import functools
|
import functools
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -27,6 +28,9 @@ from .models import MqttValueTemplate, ReceiveMessage, ReceivePayloadType
|
|||||||
from .subscription import EntitySubscription
|
from .subscription import EntitySubscription
|
||||||
from .util import get_mqtt_data, valid_subscribe_topic
|
from .util import get_mqtt_data, valid_subscribe_topic
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from homeassistant.components.tag import TagProtocol
|
||||||
|
|
||||||
LOG_NAME = "Tag"
|
LOG_NAME = "Tag"
|
||||||
|
|
||||||
TAG = "tag"
|
TAG = "tag"
|
||||||
@ -137,7 +141,7 @@ class MQTTTagScanner(MqttDiscoveryDeviceUpdate):
|
|||||||
|
|
||||||
# Importing tag via hass.components in case it is overridden
|
# Importing tag via hass.components in case it is overridden
|
||||||
# in a custom_components (custom_components.tag)
|
# in a custom_components (custom_components.tag)
|
||||||
tag = self.hass.components.tag
|
tag: TagProtocol = self.hass.components.tag
|
||||||
await tag.async_scan_tag(tag_id, self.device_id)
|
await tag.async_scan_tag(tag_id, self.device_id)
|
||||||
|
|
||||||
self._sub_state = subscription.async_prepare_subscribe_topics(
|
self._sub_state = subscription.async_prepare_subscribe_topics(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user