Skip to content

Commit

Permalink
Fix Import ReceivePayloadType (home-assistant#124431)
Browse files Browse the repository at this point in the history
* Fix Import ReceivePayloadType

* Do not assert export `ReceivePayloadType` on mqtt integration level as helper should be used.
  • Loading branch information
jbouwh authored Aug 22, 2024
1 parent 7887bcb commit e13f899
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 24 deletions.
1 change: 0 additions & 1 deletion homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
PayloadSentinel,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
convert_outgoing_mqtt_payload,
)
from .subscription import ( # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType, VolSchemaType
from homeassistant.util.unit_conversion import TemperatureConverter
Expand Down Expand Up @@ -84,7 +85,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import valid_publish_topic, valid_subscribe_topic
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/mqtt/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType

from . import subscription
from .config import MQTT_BASE_SCHEMA
from .const import CONF_PAYLOAD_RESET, CONF_STATE_TOPIC
from .mixins import CONF_JSON_ATTRS_TOPIC, MqttEntity, async_setup_entity_entry_helper
from .models import MqttValueTemplate, ReceiveMessage, ReceivePayloadType
from .models import MqttValueTemplate, ReceiveMessage
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import valid_subscribe_topic

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType
from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object

Expand All @@ -32,7 +33,6 @@
MqttValueTemplateException,
PayloadSentinel,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType, VolSchemaType
from homeassistant.util.percentage import (
Expand All @@ -52,7 +53,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import valid_publish_topic, valid_subscribe_topic
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType, VolSchemaType

Expand All @@ -54,7 +55,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import valid_publish_topic, valid_subscribe_topic
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/lawn_mower.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType

from . import subscription
Expand All @@ -31,7 +32,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import valid_publish_topic, valid_subscribe_topic
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/light/schema_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType
import homeassistant.util.color as color_util

Expand All @@ -57,7 +58,6 @@
PayloadSentinel,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
TemplateVarsType,
)
from ..schemas import MQTT_ENTITY_COMMON_SCHEMA
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/light/schema_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, TemplateVarsType, VolSchemaType
import homeassistant.util.color as color_util

Expand All @@ -43,7 +44,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from ..schemas import MQTT_ENTITY_COMMON_SCHEMA
from .schema import MQTT_LIGHT_SCHEMA_SCHEMA
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, TemplateVarsType

from . import subscription
Expand All @@ -39,7 +40,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType

from . import subscription
Expand All @@ -44,7 +45,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType

from . import subscription
Expand All @@ -31,7 +32,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA

Expand Down
8 changes: 2 additions & 6 deletions homeassistant/components/mqtt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType
from homeassistant.util import dt as dt_util

from . import subscription
from .config import MQTT_RO_SCHEMA
from .const import CONF_OPTIONS, CONF_STATE_TOPIC, PAYLOAD_NONE
from .mixins import MqttAvailabilityMixin, MqttEntity, async_setup_entity_entry_helper
from .models import (
MqttValueTemplate,
PayloadSentinel,
ReceiveMessage,
ReceivePayloadType,
)
from .models import MqttValueTemplate, PayloadSentinel, ReceiveMessage
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import check_state_too_long

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/siren.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.json import json_dumps
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType, TemplateVarsType, VolSchemaType
from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object
Expand All @@ -51,7 +52,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from homeassistant.const import CONF_DEVICE, CONF_VALUE_TEMPLATE
from homeassistant.core import HassJobType, HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

from . import subscription
Expand All @@ -31,7 +32,6 @@
MqttValueTemplate,
MqttValueTemplateException,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_DEVICE_INFO_SCHEMA
from .subscription import EntitySubscription
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.typing import ConfigType, VolSchemaType

from . import subscription
Expand All @@ -33,7 +34,6 @@
MqttValueTemplate,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)
from .schemas import MQTT_ENTITY_COMMON_SCHEMA
from .util import check_state_too_long
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
callback,
)
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.helpers.template import Template
from homeassistant.helpers.trigger import TriggerActionType, TriggerData, TriggerInfo
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
Expand All @@ -31,7 +32,6 @@
PayloadSentinel,
PublishPayloadType,
ReceiveMessage,
ReceivePayloadType,
)

TRIGGER_SCHEMA = cv.TRIGGER_BASE_SCHEMA.extend(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mysensors/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
from homeassistant.components.mqtt import (
DOMAIN as MQTT_DOMAIN,
ReceiveMessage as MQTTReceiveMessage,
ReceivePayloadType,
async_publish,
async_subscribe,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import Event, HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
from homeassistant.setup import SetupPhases, async_pause_setup
from homeassistant.util.unit_system import METRIC_SYSTEM

Expand Down
1 change: 0 additions & 1 deletion tests/components/mqtt/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,6 @@ async def test_multi_platform_discovery(
"PayloadSentinel",
"PublishPayloadType",
"ReceiveMessage",
"ReceivePayloadType",
"async_prepare_subscribe_topics",
"async_publish",
"async_subscribe",
Expand Down

0 comments on commit e13f899

Please sign in to comment.