diff --git a/linux_voice_assistant/satellite.py b/linux_voice_assistant/satellite.py index 7f15bc8..ea65a3d 100644 --- a/linux_voice_assistant/satellite.py +++ b/linux_voice_assistant/satellite.py @@ -35,7 +35,6 @@ from aioesphomeapi.api_pb2 import ( # type: ignore[attr-defined] AuthenticationRequest, ) from aioesphomeapi.core import MESSAGE_TYPE_TO_PROTO - from aioesphomeapi.model import ( VoiceAssistantEventType, VoiceAssistantFeature, @@ -577,3 +576,15 @@ class VoiceSatelliteProtocol(APIServer): trained_languages=external_wake_word.trained_languages, wake_word_path=config_path, ) + + def process_packet(self, msg_type: int, packet_data: bytes) -> None: + super().process_packet(msg_type, packet_data) + + if msg_type == PROTO_TO_MESSAGE_TYPE[AuthenticationRequest]: + self.state.connected = True + # Send states after connect + states = [] + for entity in self.state.entities: + states.extend(entity.handle_message(SubscribeHomeAssistantStatesRequest())) + self.send_messages(states) + _LOGGER.debug("Sent entity states after connect")