Export MQTT subscription helpers at integration level (#116150)
This commit is contained in:
parent
6da432a5c3
commit
589104f63d
3 changed files with 35 additions and 1 deletions
|
@ -87,6 +87,12 @@ from .models import ( # noqa: F401
|
||||||
ReceiveMessage,
|
ReceiveMessage,
|
||||||
ReceivePayloadType,
|
ReceivePayloadType,
|
||||||
)
|
)
|
||||||
|
from .subscription import ( # noqa: F401
|
||||||
|
EntitySubscription,
|
||||||
|
async_prepare_subscribe_topics,
|
||||||
|
async_subscribe_topics,
|
||||||
|
async_unsubscribe_topics,
|
||||||
|
)
|
||||||
from .util import ( # noqa: F401
|
from .util import ( # noqa: F401
|
||||||
async_create_certificate_temp_files,
|
async_create_certificate_temp_files,
|
||||||
async_forward_entry_setup_and_setup_discovery,
|
async_forward_entry_setup_and_setup_discovery,
|
||||||
|
|
|
@ -16,7 +16,7 @@ from hatasmota.models import TasmotaDeviceConfig
|
||||||
from hatasmota.mqtt import TasmotaMQTTClient
|
from hatasmota.mqtt import TasmotaMQTTClient
|
||||||
|
|
||||||
from homeassistant.components import mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.mqtt.subscription import (
|
from homeassistant.components.mqtt import (
|
||||||
async_prepare_subscribe_topics,
|
async_prepare_subscribe_topics,
|
||||||
async_subscribe_topics,
|
async_subscribe_topics,
|
||||||
async_unsubscribe_topics,
|
async_unsubscribe_topics,
|
||||||
|
|
|
@ -4491,3 +4491,31 @@ async def test_loop_write_failure(
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "Disconnected from MQTT server mock-broker:1883 (7)" in caplog.text
|
assert "Disconnected from MQTT server mock-broker:1883 (7)" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"attr",
|
||||||
|
[
|
||||||
|
"EntitySubscription",
|
||||||
|
"MqttCommandTemplate",
|
||||||
|
"MqttValueTemplate",
|
||||||
|
"PayloadSentinel",
|
||||||
|
"PublishPayloadType",
|
||||||
|
"ReceiveMessage",
|
||||||
|
"ReceivePayloadType",
|
||||||
|
"async_prepare_subscribe_topics",
|
||||||
|
"async_publish",
|
||||||
|
"async_subscribe",
|
||||||
|
"async_subscribe_topics",
|
||||||
|
"async_unsubscribe_topics",
|
||||||
|
"async_wait_for_mqtt_client",
|
||||||
|
"publish",
|
||||||
|
"subscribe",
|
||||||
|
"valid_publish_topic",
|
||||||
|
"valid_qos_schema",
|
||||||
|
"valid_subscribe_topic",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
async def test_mqtt_integration_level_imports(hass: HomeAssistant, attr: str) -> None:
|
||||||
|
"""Test mqtt integration level public published imports are available."""
|
||||||
|
assert hasattr(mqtt, attr)
|
||||||
|
|
Loading…
Add table
Reference in a new issue