Skip to content

Commit 30b9596

Browse files
author
Tom Lasswell
committed
fix(sensor): stamp Last MQTT Received on multiSync events too
multiSync messages (H5043 leak-hub events) are genuine inbound MQTT traffic but were dispatched before the freshness stamp, so a leak-only install showed 'Last MQTT Received' as permanently unavailable. Move the stamp above the message-type branch so any accepted device message counts as transport activity.
1 parent 6490569 commit 30b9596

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

custom_components/govee/api/mqtt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ async def _handle_message(self, message: Any) -> None:
397397
_LOGGER.debug("AWS IoT message missing device ID, ignoring")
398398
return
399399

400+
# Any accepted inbound device message proves the MQTT transport is
401+
# live — stamp freshness before branching on message type so leak
402+
# events (multiSync) count as activity, not just state updates.
403+
self._last_message_ts = datetime.now(timezone.utc)
404+
400405
# Handle multiSync messages (leak sensor events)
401406
cmd = data.get("cmd")
402407
if cmd == "multiSync":
@@ -419,7 +424,6 @@ async def _handle_message(self, message: Any) -> None:
419424
)
420425

421426
self._last_messages[device_id] = state
422-
self._last_message_ts = datetime.now(timezone.utc)
423427

424428
# Invoke callback with device ID and state dict
425429
try:

0 commit comments

Comments
 (0)