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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user