Skip to content

Commit

Permalink
Merge branch 'dev' into ecobee-deprecate-aux-heat
Browse files Browse the repository at this point in the history
  • Loading branch information
bjpetit committed Apr 28, 2024
2 parents e99f04a + 5d59b4c commit 3815772
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion homeassistant/components/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ def no_more_acks() -> bool:
async with self._connection_lock:
self._should_reconnect = False
self._async_cancel_reconnect()
self._mqttc.disconnect()
# We do not gracefully disconnect to ensure
# the broker publishes the will message

@callback
def async_restore_tracked_subscriptions(
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ def __repr__(self) -> str:
EMPTY_LIST: list[Any] = []


@functools.lru_cache
def _verify_event_type_length_or_raise(event_type: EventType[_DataT] | str) -> None:
"""Verify the length of the event type and raise if too long."""
if len(event_type) > MAX_LENGTH_EVENT_EVENT_TYPE:
Expand Down Expand Up @@ -2266,8 +2267,6 @@ def async_set(
return

if context is None:
if TYPE_CHECKING:
assert timestamp is not None
context = Context(id=ulid_at_time(timestamp))

if same_attr:
Expand Down
6 changes: 3 additions & 3 deletions tests/components/mqtt/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,17 @@ async def test_mqtt_connects_on_home_assistant_mqtt_setup(
assert mqtt_client_mock.connect.call_count == 1


async def test_mqtt_disconnects_on_home_assistant_stop(
async def test_mqtt_does_not_disconnect_on_home_assistant_stop(
hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator,
mqtt_client_mock: MqttMockPahoClient,
) -> None:
"""Test if client stops on HA stop."""
"""Test if client is not disconnected on HA stop."""
await mqtt_mock_entry()
hass.bus.fire(EVENT_HOMEASSISTANT_STOP)
await hass.async_block_till_done()
await hass.async_block_till_done()
assert mqtt_client_mock.disconnect.call_count == 1
assert mqtt_client_mock.disconnect.call_count == 0


async def test_mqtt_await_ack_at_disconnect(
Expand Down

0 comments on commit 3815772

Please sign in to comment.