diff --git a/custom_components/xiaomi_home/miot/i18n/de.json b/custom_components/xiaomi_home/miot/i18n/de.json index 05ae2bf..f8682c9 100644 --- a/custom_components/xiaomi_home/miot/i18n/de.json +++ b/custom_components/xiaomi_home/miot/i18n/de.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} Geräte offline:** \n{message}", "network_status_online": "Online", "network_status_offline": "Offline", + "central_state_changed_title": "Verbindungsstatus des Zentral-Gateways", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** Lokale Verbindungsstrecke des Zentral-Gateways: {conn_status}", + "central_state_connected": "verbunden", + "central_state_disconnected": "getrennt", "device_exec_error": "Fehler bei der Ausführung" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/en.json b/custom_components/xiaomi_home/miot/i18n/en.json index 47187ad..64f2a2f 100644 --- a/custom_components/xiaomi_home/miot/i18n/en.json +++ b/custom_components/xiaomi_home/miot/i18n/en.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} devices offline:** \n{message}", "network_status_online": "Online", "network_status_offline": "Offline", + "central_state_changed_title": "Central Hub Gateway Connection Status", + "central_state_changed":"**{nick_name}({uid}, {cloud_server})** local connection to Xiaomi central hub gateway: {conn_status}", + "central_state_connected": "Connected", + "central_state_disconnected": "Disconnected", "device_exec_error": "Execution error" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/es.json b/custom_components/xiaomi_home/miot/i18n/es.json index c6f78df..cc8489c 100644 --- a/custom_components/xiaomi_home/miot/i18n/es.json +++ b/custom_components/xiaomi_home/miot/i18n/es.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} dispositivos sin conexión:** \n{message}", "network_status_online": "En línea", "network_status_offline": "Desconectado", + "central_state_changed_title": "Estado de conexión de la puerta de enlace central", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** enlace de conexión local de la puerta de enlace central: {conn_status}", + "central_state_connected": "conectado", + "central_state_disconnected": "desconectado", "device_exec_error": "Error de ejecución" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/fr.json b/custom_components/xiaomi_home/miot/i18n/fr.json index 2789cc6..f84cc61 100644 --- a/custom_components/xiaomi_home/miot/i18n/fr.json +++ b/custom_components/xiaomi_home/miot/i18n/fr.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} appareils hors ligne :** \n{message}", "network_status_online": "En ligne", "network_status_offline": "Hors ligne", + "central_state_changed_title": "État de connexion de la passerelle centrale", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** liaison de connexion locale de la passerelle centrale : {conn_status}", + "central_state_connected": "connecté", + "central_state_disconnected": "déconnecté", "device_exec_error": "Erreur d'exécution" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/it.json b/custom_components/xiaomi_home/miot/i18n/it.json index 8ec19d3..73bc6b5 100644 --- a/custom_components/xiaomi_home/miot/i18n/it.json +++ b/custom_components/xiaomi_home/miot/i18n/it.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} dispositivi offline:** \n{message}", "network_status_online": "Online", "network_status_offline": "Offline", + "central_state_changed_title": "Stato di connessione del gateway centrale", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** collegamento locale del gateway centrale: {conn_status}", + "central_state_connected": "connesso", + "central_state_disconnected": "disconnesso", "device_exec_error": "Errore di esecuzione" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/ja.json b/custom_components/xiaomi_home/miot/i18n/ja.json index a32d997..01280f9 100644 --- a/custom_components/xiaomi_home/miot/i18n/ja.json +++ b/custom_components/xiaomi_home/miot/i18n/ja.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} デバイスがオフライン:** \n{message}", "network_status_online": "オンライン", "network_status_offline": "オフライン", + "central_state_changed_title": "中枢ゲートウェイ接続ステータス", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** 中枢ゲートウェイのローカル接続リンク: {conn_status}", + "central_state_connected": "接続済み", + "central_state_disconnected": "切断されました", "device_exec_error": "実行エラー" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/nl.json b/custom_components/xiaomi_home/miot/i18n/nl.json index 5417348..6ec7425 100644 --- a/custom_components/xiaomi_home/miot/i18n/nl.json +++ b/custom_components/xiaomi_home/miot/i18n/nl.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} apparaten offline:** \n{message}", "network_status_online": "Online", "network_status_offline": "Offline", + "central_state_changed_title": "Verbindingsstatus van centrale gateway", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** Lokale verbinding van centrale gateway: {conn_status}", + "central_state_connected": "verbonden", + "central_state_disconnected": "verbinding verbroken", "device_exec_error": "Uitvoeringsfout" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/pt-BR.json b/custom_components/xiaomi_home/miot/i18n/pt-BR.json index 553a90c..70f9616 100644 --- a/custom_components/xiaomi_home/miot/i18n/pt-BR.json +++ b/custom_components/xiaomi_home/miot/i18n/pt-BR.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} dispositivos offline**: \n{message}", "network_status_online": "online", "network_status_offline": "offline", + "central_state_changed_title": "Status de conexão do gateway central", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** conexão local do gateway central: {conn_status}", + "central_state_connected": "conectado", + "central_state_disconnected": "desconectado", "device_exec_error": "Erro na execução" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/pt.json b/custom_components/xiaomi_home/miot/i18n/pt.json index 6466994..ad7b03a 100644 --- a/custom_components/xiaomi_home/miot/i18n/pt.json +++ b/custom_components/xiaomi_home/miot/i18n/pt.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} dispositivos offline**: \n{message}", "network_status_online": "Online", "network_status_offline": "Offline", + "central_state_changed_title": "Estado da ligação do gateway central", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** ligação local do gateway central: {conn_status}", + "central_state_connected": "ligado", + "central_state_disconnected": "desligado", "device_exec_error": "Erro de execução" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/ru.json b/custom_components/xiaomi_home/miot/i18n/ru.json index b342ca1..c46467c 100644 --- a/custom_components/xiaomi_home/miot/i18n/ru.json +++ b/custom_components/xiaomi_home/miot/i18n/ru.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} устройств недоступно:** \n{message}", "network_status_online": "В сети", "network_status_offline": "Не в сети", + "central_state_changed_title": "Статус подключения центрального шлюза", + "central_state_changed": "**{nick_name}({uid}, {cloud_server})** локальное подключение центрального шлюза: {conn_status}", + "central_state_connected": "подключено", + "central_state_disconnected": "разъединено", "device_exec_error": "Ошибка выполнения" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/zh-Hans.json b/custom_components/xiaomi_home/miot/i18n/zh-Hans.json index ed69254..f763ffb 100644 --- a/custom_components/xiaomi_home/miot/i18n/zh-Hans.json +++ b/custom_components/xiaomi_home/miot/i18n/zh-Hans.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} 个设备离线**: \n{message}", "network_status_online": "在线", "network_status_offline": "离线", + "central_state_changed_title": "中枢网关连接状态", + "central_state_changed":"**{nick_name}({uid}, {cloud_server})** 中枢网关本地连接链路: {conn_status}", + "central_state_connected": "已连接", + "central_state_disconnected": "断连", "device_exec_error": "执行错误" } }, diff --git a/custom_components/xiaomi_home/miot/i18n/zh-Hant.json b/custom_components/xiaomi_home/miot/i18n/zh-Hant.json index c354733..d3f1ee6 100644 --- a/custom_components/xiaomi_home/miot/i18n/zh-Hant.json +++ b/custom_components/xiaomi_home/miot/i18n/zh-Hant.json @@ -99,6 +99,10 @@ "device_list_offline": "\n**{count} 個設備離線:** \n{message}", "network_status_online": "在線", "network_status_offline": "離線", + "central_state_changed_title": "中枢網關連接狀態", + "central_state_changed":"**{nick_name}({uid}, {cloud_server})** 中枢網關本地連接鏈路: {conn_status}", + "central_state_connected": "已連接", + "central_state_disconnected": "断連", "device_exec_error": "執行錯誤" } }, diff --git a/custom_components/xiaomi_home/miot/miot_client.py b/custom_components/xiaomi_home/miot/miot_client.py index ecb446e..d5c588b 100644 --- a/custom_components/xiaomi_home/miot/miot_client.py +++ b/custom_components/xiaomi_home/miot/miot_client.py @@ -1115,8 +1115,10 @@ class MIoTClient: _LOGGER.info('local mips state changed, %s, %s', group_id, state) mips = self._mips_local.get(group_id, None) if not mips: - _LOGGER.error( + _LOGGER.info( 'local mips state changed, mips not exist, %s', group_id) + # The connection to the central hub gateway is definitely broken. + self.__show_central_state_changed_notify(False) return if state: # Connected @@ -1150,6 +1152,7 @@ class MIoTClient: if sub and sub.handler: sub.handler(did, MIoTDeviceState.OFFLINE, sub.handler_ctx) self.__request_show_devices_changed_notify() + self.__show_central_state_changed_notify(state) @final async def __on_miot_lan_state_change(self, state: bool) -> None: @@ -1915,6 +1918,23 @@ class MIoTClient: self._show_devices_changed_notify_timer = self._main_loop.call_later( delay_sec, self.__show_devices_changed_notify) + @final + def __show_central_state_changed_notify(self, connected: bool) -> None: + conn_status: str = ( + self._i18n.translate('miot.client.central_state_connected') + if connected else + self._i18n.translate('miot.client.central_state_disconnected')) + self._persistence_notify( + self.__gen_notify_key('central_state_changed'), + self._i18n.translate('miot.client.central_state_changed_title'), + self._i18n.translate(key='miot.client.central_state_changed', + replace={ + 'nick_name': self._entry_data.get( + 'nick_name', DEFAULT_NICK_NAME), + 'uid': self._uid, + 'cloud_server': self._cloud_server, + 'conn_status': conn_status + })) @staticmethod async def get_miot_instance_async(