1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Upgrade paho-mqtt API to v2 (#137613)

* Upgrade paho-mqtt API to v2

* Refactor on_connect callback

* Add tests

* Fix Tasmota tests
This commit is contained in:
Jan Bouwhuis
2025-02-13 22:13:19 +01:00
committed by GitHub
parent bbbad90ca2
commit d6b7762dd6
9 changed files with 171 additions and 93 deletions

View File

@@ -410,6 +410,25 @@ def async_mock_intent(hass: HomeAssistant, intent_typ: str) -> list[intent.Inten
return intents
class MockMqttReasonCode:
"""Class to fake a MQTT ReasonCode."""
value: int
is_failure: bool
def __init__(
self, value: int = 0, is_failure: bool = False, name: str = "Success"
) -> None:
"""Initialize the mock reason code."""
self.value = value
self.is_failure = is_failure
self._name = name
def getName(self) -> str:
"""Return the name of the reason code."""
return self._name
@callback
def async_fire_mqtt_message(
hass: HomeAssistant,