mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Revert "Bump paho-mqtt client to version 2.1.0 (#136130)"
This reverts commit 7fa6f7e8755ee68ba43907944b0ad1a4b976fad6.
This commit is contained in:
parent
c476e92bdc
commit
1edea46a4d
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/econet",
|
"documentation": "https://www.home-assistant.io/integrations/econet",
|
||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["paho_mqtt", "pyeconet"],
|
"loggers": ["paho_mqtt", "pyeconet"],
|
||||||
"requirements": ["pyeconet==0.1.28"]
|
"requirements": ["pyeconet==0.1.23"]
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,10 @@ class AsyncMQTTClient(MQTTClient):
|
|||||||
since the client is running in an async event loop
|
since the client is running in an async event loop
|
||||||
and will never run in multiple threads.
|
and will never run in multiple threads.
|
||||||
"""
|
"""
|
||||||
self._in_callback_mutex = NullLock() # type: ignore[assignment]
|
self._in_callback_mutex = NullLock()
|
||||||
self._callback_mutex = NullLock() # type: ignore[assignment]
|
self._callback_mutex = NullLock()
|
||||||
self._msgtime_mutex = NullLock() # type: ignore[assignment]
|
self._msgtime_mutex = NullLock()
|
||||||
self._out_message_mutex = NullLock() # type: ignore[assignment]
|
self._out_message_mutex = NullLock()
|
||||||
self._in_message_mutex = NullLock() # type: ignore[assignment]
|
self._in_message_mutex = NullLock()
|
||||||
self._reconnect_delay_mutex = NullLock() # type: ignore[assignment]
|
self._reconnect_delay_mutex = NullLock()
|
||||||
self._mid_generate_mutex = NullLock() # type: ignore[assignment]
|
self._mid_generate_mutex = NullLock()
|
||||||
|
@ -15,6 +15,7 @@ import socket
|
|||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
import uuid
|
||||||
|
|
||||||
import certifi
|
import certifi
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ MAX_UNSUBSCRIBES_PER_CALL = 500
|
|||||||
|
|
||||||
MAX_PACKETS_TO_READ = 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
|
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:
|
if (client_id := config.get(CONF_CLIENT_ID)) is None:
|
||||||
# PAHO MQTT relies on the MQTT server to generate random client IDs.
|
# PAHO MQTT relies on the MQTT server to generate random client IDs.
|
||||||
# However, that feature is not mandatory so we generate our own.
|
# 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)
|
transport: str = config.get(CONF_TRANSPORT, DEFAULT_TRANSPORT)
|
||||||
self._client = AsyncMQTTClient(
|
self._client = AsyncMQTTClient(
|
||||||
mqtt.CallbackAPIVersion.VERSION1,
|
|
||||||
client_id,
|
client_id,
|
||||||
protocol=proto,
|
protocol=proto,
|
||||||
transport=transport, # type: ignore[arg-type]
|
transport=transport,
|
||||||
reconnect_on_failure=False,
|
reconnect_on_failure=False,
|
||||||
)
|
)
|
||||||
self._client.setup()
|
self._client.setup()
|
||||||
@ -533,7 +533,7 @@ class MQTT:
|
|||||||
try:
|
try:
|
||||||
# Some operating systems do not allow us to set the preferred
|
# Some operating systems do not allow us to set the preferred
|
||||||
# buffer size. In that case we try some other size options.
|
# 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:
|
except OSError as err:
|
||||||
if new_buffer_size <= MIN_BUFFER_SIZE:
|
if new_buffer_size <= MIN_BUFFER_SIZE:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
@ -1216,9 +1216,7 @@ class MQTT:
|
|||||||
if not future.done():
|
if not future.done():
|
||||||
future.set_exception(asyncio.TimeoutError)
|
future.set_exception(asyncio.TimeoutError)
|
||||||
|
|
||||||
async def _async_wait_for_mid_or_raise(
|
async def _async_wait_for_mid_or_raise(self, mid: int, result_code: int) -> None:
|
||||||
self, mid: int | None, result_code: int
|
|
||||||
) -> None:
|
|
||||||
"""Wait for ACK from broker or raise on error."""
|
"""Wait for ACK from broker or raise on error."""
|
||||||
if result_code != 0:
|
if result_code != 0:
|
||||||
# pylint: disable-next=import-outside-toplevel
|
# pylint: disable-next=import-outside-toplevel
|
||||||
@ -1234,8 +1232,6 @@ class MQTT:
|
|||||||
|
|
||||||
# Create the mid event if not created, either _mqtt_handle_mid or
|
# Create the mid event if not created, either _mqtt_handle_mid or
|
||||||
# _async_wait_for_mid_or_raise may be executed first.
|
# _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)
|
future = self._async_get_mid_future(mid)
|
||||||
loop = self.hass.loop
|
loop = self.hass.loop
|
||||||
timer_handle = loop.call_later(TIMEOUT_ACK, self._async_timeout_mid, future)
|
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
|
# pylint: disable-next=import-outside-toplevel
|
||||||
from paho.mqtt.matcher import MQTTMatcher
|
from paho.mqtt.matcher import MQTTMatcher
|
||||||
|
|
||||||
matcher = MQTTMatcher() # type: ignore[no-untyped-call]
|
matcher = MQTTMatcher()
|
||||||
matcher[subscription] = True
|
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)
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/mqtt",
|
"documentation": "https://www.home-assistant.io/integrations/mqtt",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["paho-mqtt==2.1.0"],
|
"requirements": ["paho-mqtt==1.6.1"],
|
||||||
"single_config_entry": true
|
"single_config_entry": true
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ lru-dict==1.3.0
|
|||||||
mutagen==1.47.0
|
mutagen==1.47.0
|
||||||
orjson==3.10.12
|
orjson==3.10.12
|
||||||
packaging>=23.1
|
packaging>=23.1
|
||||||
paho-mqtt==2.1.0
|
paho-mqtt==1.6.1
|
||||||
Pillow==11.1.0
|
Pillow==11.1.0
|
||||||
propcache==0.3.0
|
propcache==0.3.0
|
||||||
psutil-home-assistant==0.0.1
|
psutil-home-assistant==0.0.1
|
||||||
|
4
requirements_all.txt
generated
4
requirements_all.txt
generated
@ -1622,7 +1622,7 @@ ovoenergy==2.0.0
|
|||||||
p1monitor==3.1.0
|
p1monitor==3.1.0
|
||||||
|
|
||||||
# homeassistant.components.mqtt
|
# homeassistant.components.mqtt
|
||||||
paho-mqtt==2.1.0
|
paho-mqtt==1.6.1
|
||||||
|
|
||||||
# homeassistant.components.panasonic_bluray
|
# homeassistant.components.panasonic_bluray
|
||||||
panacotta==0.2
|
panacotta==0.2
|
||||||
@ -1918,7 +1918,7 @@ pyebox==1.1.4
|
|||||||
pyecoforest==0.4.0
|
pyecoforest==0.4.0
|
||||||
|
|
||||||
# homeassistant.components.econet
|
# homeassistant.components.econet
|
||||||
pyeconet==0.1.28
|
pyeconet==0.1.23
|
||||||
|
|
||||||
# homeassistant.components.ista_ecotrend
|
# homeassistant.components.ista_ecotrend
|
||||||
pyecotrend-ista==3.3.1
|
pyecotrend-ista==3.3.1
|
||||||
|
@ -41,6 +41,7 @@ types-beautifulsoup4==4.12.0.20250204
|
|||||||
types-caldav==1.3.0.20241107
|
types-caldav==1.3.0.20241107
|
||||||
types-chardet==0.1.5
|
types-chardet==0.1.5
|
||||||
types-decorator==5.1.8.20250121
|
types-decorator==5.1.8.20250121
|
||||||
|
types-paho-mqtt==1.6.0.20240321
|
||||||
types-pexpect==4.9.0.20241208
|
types-pexpect==4.9.0.20241208
|
||||||
types-pillow==10.2.0.20240822
|
types-pillow==10.2.0.20240822
|
||||||
types-protobuf==5.29.1.20241207
|
types-protobuf==5.29.1.20241207
|
||||||
|
4
requirements_test_all.txt
generated
4
requirements_test_all.txt
generated
@ -1352,7 +1352,7 @@ ovoenergy==2.0.0
|
|||||||
p1monitor==3.1.0
|
p1monitor==3.1.0
|
||||||
|
|
||||||
# homeassistant.components.mqtt
|
# homeassistant.components.mqtt
|
||||||
paho-mqtt==2.1.0
|
paho-mqtt==1.6.1
|
||||||
|
|
||||||
# homeassistant.components.panasonic_viera
|
# homeassistant.components.panasonic_viera
|
||||||
panasonic-viera==0.4.2
|
panasonic-viera==0.4.2
|
||||||
@ -1565,7 +1565,7 @@ pydroid-ipcam==2.0.0
|
|||||||
pyecoforest==0.4.0
|
pyecoforest==0.4.0
|
||||||
|
|
||||||
# homeassistant.components.econet
|
# homeassistant.components.econet
|
||||||
pyeconet==0.1.28
|
pyeconet==0.1.23
|
||||||
|
|
||||||
# homeassistant.components.ista_ecotrend
|
# homeassistant.components.ista_ecotrend
|
||||||
pyecotrend-ista==3.3.1
|
pyecotrend-ista==3.3.1
|
||||||
|
@ -199,6 +199,7 @@ EXCEPTIONS = {
|
|||||||
"pigpio", # https://github.com/joan2937/pigpio/pull/608
|
"pigpio", # https://github.com/joan2937/pigpio/pull/608
|
||||||
"pymitv", # MIT
|
"pymitv", # MIT
|
||||||
"pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5
|
"pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5
|
||||||
|
"pyeconet", # https://github.com/w1ll1am23/pyeconet/pull/41
|
||||||
"pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6
|
"pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6
|
||||||
"pyvera", # https://github.com/maximvelichko/pyvera/pull/164
|
"pyvera", # https://github.com/maximvelichko/pyvera/pull/164
|
||||||
"repoze.lru",
|
"repoze.lru",
|
||||||
|
@ -2082,7 +2082,7 @@ async def test_server_sock_buffer_size_with_websocket(
|
|||||||
client.setblocking(False)
|
client.setblocking(False)
|
||||||
server.setblocking(False)
|
server.setblocking(False)
|
||||||
|
|
||||||
class FakeWebsocket(paho_mqtt._WebsocketWrapper):
|
class FakeWebsocket(paho_mqtt.WebsocketWrapper):
|
||||||
def _do_handshake(self, *args, **kwargs):
|
def _do_handshake(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user