Export MQTT subscription helpers at integration level (#116150)

pull/117118/head
Jan Bouwhuis 2024-05-08 23:46:50 +02:00 committed by GitHub
parent 6da432a5c3
commit 589104f63d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

View File

@ -87,6 +87,12 @@ from .models import ( # noqa: F401
ReceiveMessage,
ReceivePayloadType,
)
from .subscription import ( # noqa: F401
EntitySubscription,
async_prepare_subscribe_topics,
async_subscribe_topics,
async_unsubscribe_topics,
)
from .util import ( # noqa: F401
async_create_certificate_temp_files,
async_forward_entry_setup_and_setup_discovery,

View File

@ -16,7 +16,7 @@ from hatasmota.models import TasmotaDeviceConfig
from hatasmota.mqtt import TasmotaMQTTClient
from homeassistant.components import mqtt
from homeassistant.components.mqtt.subscription import (
from homeassistant.components.mqtt import (
async_prepare_subscribe_topics,
async_subscribe_topics,
async_unsubscribe_topics,

View File

@ -4491,3 +4491,31 @@ async def test_loop_write_failure(
await hass.async_block_till_done()
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)