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

* Bump paho-mqtt client to version 2.1.0

* Remove commented code

* Bump pyeconet==0.1.26

* Ensure types-paho-mqtt==1.6.0.20240321 is uninstalled if test requirements are updated

* Update roombapy dependency

* Remove pyeconet from exceptions list

* Revert changes to install test requirements task
This commit is contained in:
Jan Bouwhuis
2025-02-04 20:59:28 +01:00
committed by GitHub
parent 56e07efe31
commit 7fa6f7e875
10 changed files with 27 additions and 25 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.23"]
"requirements": ["pyeconet==0.1.26"]
}

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()
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()
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]

View File

@ -15,7 +15,6 @@ import socket
import ssl
import time
from typing import TYPE_CHECKING, Any
import uuid
import certifi
@ -117,7 +116,7 @@ MAX_UNSUBSCRIBES_PER_CALL = 500
MAX_PACKETS_TO_READ = 500
type SocketType = socket.socket | ssl.SSLSocket | mqtt.WebsocketWrapper | Any
type SocketType = socket.socket | ssl.SSLSocket | mqtt._WebsocketWrapper | Any # noqa: SLF001
type SubscribePayloadType = str | bytes | bytearray # Only bytes if encoding is None
@ -309,12 +308,13 @@ 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 = mqtt.base62(uuid.uuid4().int, padding=22)
client_id = None
transport: str = config.get(CONF_TRANSPORT, DEFAULT_TRANSPORT)
self._client = AsyncMQTTClient(
mqtt.CallbackAPIVersion.VERSION1,
client_id,
protocol=proto,
transport=transport,
transport=transport, # type: ignore[arg-type]
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)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, new_buffer_size) # type: ignore[union-attr]
except OSError as err:
if new_buffer_size <= MIN_BUFFER_SIZE:
_LOGGER.warning(
@ -1216,7 +1216,9 @@ class MQTT:
if not future.done():
future.set_exception(asyncio.TimeoutError)
async def _async_wait_for_mid_or_raise(self, mid: int, result_code: int) -> None:
async def _async_wait_for_mid_or_raise(
self, mid: int | None, result_code: int
) -> None:
"""Wait for ACK from broker or raise on error."""
if result_code != 0:
# pylint: disable-next=import-outside-toplevel
@ -1232,6 +1234,8 @@ 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)
@ -1269,7 +1273,7 @@ def _matcher_for_topic(subscription: str) -> Callable[[str], bool]:
# pylint: disable-next=import-outside-toplevel
from paho.mqtt.matcher import MQTTMatcher
matcher = MQTTMatcher()
matcher = MQTTMatcher() # type: ignore[no-untyped-call]
matcher[subscription] = True
return lambda topic: next(matcher.iter_match(topic), False)
return lambda topic: next(matcher.iter_match(topic), False) # type: ignore[no-untyped-call]

View File

@ -8,6 +8,6 @@
"documentation": "https://www.home-assistant.io/integrations/mqtt",
"iot_class": "local_push",
"quality_scale": "platinum",
"requirements": ["paho-mqtt==1.6.1"],
"requirements": ["paho-mqtt==2.1.0"],
"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==1.6.1
paho-mqtt==2.1.0
Pillow==11.1.0
propcache==0.2.1
psutil-home-assistant==0.0.1

4
requirements_all.txt generated
View File

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

View File

@ -41,7 +41,6 @@ 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

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

View File

@ -199,7 +199,6 @@ 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