Revert "Bump paho-mqtt client to version 2.1.0 (#136130)"

This reverts commit 7fa6f7e8755ee68ba43907944b0ad1a4b976fad6.
This commit is contained in:
jbouwh 2025-02-28 08:56:10 +00:00
parent c476e92bdc
commit 1edea46a4d
10 changed files with 25 additions and 27 deletions

View File

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/econet",
"iot_class": "cloud_push",
"loggers": ["paho_mqtt", "pyeconet"],
"requirements": ["pyeconet==0.1.28"]
"requirements": ["pyeconet==0.1.23"]
}

View File

@ -51,10 +51,10 @@ class AsyncMQTTClient(MQTTClient):
since the client is running in an async event loop
and will never run in multiple threads.
"""
self._in_callback_mutex = NullLock() # type: ignore[assignment]
self._callback_mutex = NullLock() # type: ignore[assignment]
self._msgtime_mutex = NullLock() # type: ignore[assignment]
self._out_message_mutex = NullLock() # type: ignore[assignment]
self._in_message_mutex = NullLock() # type: ignore[assignment]
self._reconnect_delay_mutex = NullLock() # type: ignore[assignment]
self._mid_generate_mutex = NullLock() # type: ignore[assignment]
self._in_callback_mutex = NullLock()
self._callback_mutex = NullLock()
self._msgtime_mutex = NullLock()
self._out_message_mutex = NullLock()
self._in_message_mutex = NullLock()
self._reconnect_delay_mutex = NullLock()
self._mid_generate_mutex = NullLock()

View File

@ -15,6 +15,7 @@ import socket
import ssl
import time
from typing import TYPE_CHECKING, Any
import uuid
import certifi
@ -116,7 +117,7 @@ MAX_UNSUBSCRIBES_PER_CALL = 500
MAX_PACKETS_TO_READ = 500
type SocketType = socket.socket | ssl.SSLSocket | mqtt._WebsocketWrapper | Any # noqa: SLF001
type SocketType = socket.socket | ssl.SSLSocket | mqtt.WebsocketWrapper | Any
type SubscribePayloadType = str | bytes | bytearray # Only bytes if encoding is None
@ -308,13 +309,12 @@ class MqttClientSetup:
if (client_id := config.get(CONF_CLIENT_ID)) is None:
# PAHO MQTT relies on the MQTT server to generate random client IDs.
# However, that feature is not mandatory so we generate our own.
client_id = None
client_id = mqtt.base62(uuid.uuid4().int, padding=22)
transport: str = config.get(CONF_TRANSPORT, DEFAULT_TRANSPORT)
self._client = AsyncMQTTClient(
mqtt.CallbackAPIVersion.VERSION1,
client_id,
protocol=proto,
transport=transport, # type: ignore[arg-type]
transport=transport,
reconnect_on_failure=False,
)
self._client.setup()
@ -533,7 +533,7 @@ class MQTT:
try:
# Some operating systems do not allow us to set the preferred
# buffer size. In that case we try some other size options.
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, new_buffer_size) # type: ignore[union-attr]
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, new_buffer_size)
except OSError as err:
if new_buffer_size <= MIN_BUFFER_SIZE:
_LOGGER.warning(
@ -1216,9 +1216,7 @@ class MQTT:
if not future.done():
future.set_exception(asyncio.TimeoutError)
async def _async_wait_for_mid_or_raise(
self, mid: int | None, result_code: int
) -> None:
async def _async_wait_for_mid_or_raise(self, mid: int, result_code: int) -> None:
"""Wait for ACK from broker or raise on error."""
if result_code != 0:
# pylint: disable-next=import-outside-toplevel
@ -1234,8 +1232,6 @@ class MQTT:
# Create the mid event if not created, either _mqtt_handle_mid or
# _async_wait_for_mid_or_raise may be executed first.
if TYPE_CHECKING:
assert mid is not None
future = self._async_get_mid_future(mid)
loop = self.hass.loop
timer_handle = loop.call_later(TIMEOUT_ACK, self._async_timeout_mid, future)
@ -1273,7 +1269,7 @@ def _matcher_for_topic(subscription: str) -> Callable[[str], bool]:
# pylint: disable-next=import-outside-toplevel
from paho.mqtt.matcher import MQTTMatcher
matcher = MQTTMatcher() # type: ignore[no-untyped-call]
matcher = MQTTMatcher()
matcher[subscription] = True
return lambda topic: next(matcher.iter_match(topic), False) # type: ignore[no-untyped-call]
return lambda topic: next(matcher.iter_match(topic), False)

View File

@ -8,6 +8,6 @@
"documentation": "https://www.home-assistant.io/integrations/mqtt",
"iot_class": "local_push",
"quality_scale": "platinum",
"requirements": ["paho-mqtt==2.1.0"],
"requirements": ["paho-mqtt==1.6.1"],
"single_config_entry": true
}

View File

@ -46,7 +46,7 @@ lru-dict==1.3.0
mutagen==1.47.0
orjson==3.10.12
packaging>=23.1
paho-mqtt==2.1.0
paho-mqtt==1.6.1
Pillow==11.1.0
propcache==0.3.0
psutil-home-assistant==0.0.1

4
requirements_all.txt generated
View File

@ -1622,7 +1622,7 @@ ovoenergy==2.0.0
p1monitor==3.1.0
# homeassistant.components.mqtt
paho-mqtt==2.1.0
paho-mqtt==1.6.1
# homeassistant.components.panasonic_bluray
panacotta==0.2
@ -1918,7 +1918,7 @@ pyebox==1.1.4
pyecoforest==0.4.0
# homeassistant.components.econet
pyeconet==0.1.28
pyeconet==0.1.23
# homeassistant.components.ista_ecotrend
pyecotrend-ista==3.3.1

View File

@ -41,6 +41,7 @@ types-beautifulsoup4==4.12.0.20250204
types-caldav==1.3.0.20241107
types-chardet==0.1.5
types-decorator==5.1.8.20250121
types-paho-mqtt==1.6.0.20240321
types-pexpect==4.9.0.20241208
types-pillow==10.2.0.20240822
types-protobuf==5.29.1.20241207

View File

@ -1352,7 +1352,7 @@ ovoenergy==2.0.0
p1monitor==3.1.0
# homeassistant.components.mqtt
paho-mqtt==2.1.0
paho-mqtt==1.6.1
# homeassistant.components.panasonic_viera
panasonic-viera==0.4.2
@ -1565,7 +1565,7 @@ pydroid-ipcam==2.0.0
pyecoforest==0.4.0
# homeassistant.components.econet
pyeconet==0.1.28
pyeconet==0.1.23
# homeassistant.components.ista_ecotrend
pyecotrend-ista==3.3.1

View File

@ -199,6 +199,7 @@ EXCEPTIONS = {
"pigpio", # https://github.com/joan2937/pigpio/pull/608
"pymitv", # MIT
"pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5
"pyeconet", # https://github.com/w1ll1am23/pyeconet/pull/41
"pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6
"pyvera", # https://github.com/maximvelichko/pyvera/pull/164
"repoze.lru",

View File

@ -2082,7 +2082,7 @@ async def test_server_sock_buffer_size_with_websocket(
client.setblocking(False)
server.setblocking(False)
class FakeWebsocket(paho_mqtt._WebsocketWrapper):
class FakeWebsocket(paho_mqtt.WebsocketWrapper):
def _do_handshake(self, *args, **kwargs):
pass