From 1624f340da5db644acf3f6bc6c99cc555d0a87f9 Mon Sep 17 00:00:00 2001 From: sworld Date: Sat, 21 Dec 2024 18:54:12 +0800 Subject: [PATCH 01/10] feat: add devices filter page --- custom_components/xiaomi_home/config_flow.py | 97 +++++++++++++------ .../xiaomi_home/miot/i18n/de.json | 4 + .../xiaomi_home/miot/i18n/en.json | 4 + .../xiaomi_home/miot/i18n/es.json | 4 + .../xiaomi_home/miot/i18n/fr.json | 4 + .../xiaomi_home/miot/i18n/ja.json | 4 + .../xiaomi_home/miot/i18n/nl.json | 6 +- .../xiaomi_home/miot/i18n/pt-BR.json | 4 + .../xiaomi_home/miot/i18n/pt.json | 4 + .../xiaomi_home/miot/i18n/ru.json | 4 + .../xiaomi_home/miot/i18n/zh-Hans.json | 4 + .../xiaomi_home/miot/i18n/zh-Hant.json | 4 + .../xiaomi_home/translations/de.json | 21 +++- .../xiaomi_home/translations/en.json | 29 ++++-- .../xiaomi_home/translations/es.json | 27 ++++-- .../xiaomi_home/translations/fr.json | 29 ++++-- .../xiaomi_home/translations/ja.json | 29 ++++-- .../xiaomi_home/translations/nl.json | 31 ++++-- .../xiaomi_home/translations/pt-BR.json | 31 ++++-- .../xiaomi_home/translations/pt.json | 29 ++++-- .../xiaomi_home/translations/ru.json | 27 ++++-- .../xiaomi_home/translations/zh-Hans.json | 21 +++- .../xiaomi_home/translations/zh-Hant.json | 21 +++- 23 files changed, 341 insertions(+), 97 deletions(-) diff --git a/custom_components/xiaomi_home/config_flow.py b/custom_components/xiaomi_home/config_flow.py index b9f3776..4b69418 100644 --- a/custom_components/xiaomi_home/config_flow.py +++ b/custom_components/xiaomi_home/config_flow.py @@ -479,16 +479,11 @@ async def async_step_homes_select(self, user_input=None): if not home_selected: return await self.display_homes_select_form( 'no_family_selected') - self._ctrl_mode = user_input.get('ctrl_mode') for home_id, home_info in self._home_info_buffer[ 'homes']['home_list'].items(): if home_id in home_selected: self._home_selected[home_id] = home_info self._area_name_rule = user_input.get('area_name_rule') - self._action_debug = user_input.get( - 'action_debug', self._action_debug) - self._hide_non_standard_entities = user_input.get( - 'hide_non_standard_entities', self._hide_non_standard_entities) # Storage device list devices_list: dict[str, dict] = { did: dev_info @@ -513,26 +508,9 @@ async def async_step_homes_select(self, user_input=None): 'auth_info': self._auth_info })): raise MIoTError('miot_storage.update_user_config_async error') - return self.async_create_entry( - title=( - f'{self._nick_name}: {self._uid} ' - f'[{CLOUD_SERVERS[self._cloud_server]}]'), - data={ - 'virtual_did': self._virtual_did, - 'uuid': self._uuid, - 'integration_language': self._integration_language, - 'storage_path': self._storage_path, - 'uid': self._uid, - 'nick_name': self._nick_name, - 'cloud_server': self._cloud_server, - 'oauth_redirect_url': self._oauth_redirect_url, - 'ctrl_mode': self._ctrl_mode, - 'home_selected': self._home_selected, - 'area_name_rule': self._area_name_rule, - 'action_debug': self._action_debug, - 'hide_non_standard_entities': - self._hide_non_standard_entities, - }) + if user_input.get('advanced_options', False): + return await self.async_step_advanced_options() + return await self.config_flow_done() except Exception as err: _LOGGER.error( 'async_step_homes_select, %s, %s', @@ -547,15 +525,10 @@ async def display_homes_select_form(self, reason: str): return self.async_show_form( step_id='homes_select', data_schema=vol.Schema({ - vol.Required('ctrl_mode', default=DEFAULT_CTRL_MODE): vol.In( - self._miot_i18n.translate(key='config.control_mode')), vol.Required('home_infos'): cv.multi_select(self._home_list), vol.Required('area_name_rule', default='room'): vol.In( self._miot_i18n.translate(key='config.room_name_rule')), - vol.Required('action_debug', default=self._action_debug): bool, - vol.Required( - 'hide_non_standard_entities', - default=self._hide_non_standard_entities): bool, + vol.Required('advanced_options', default=False): bool, }), errors={'base': reason}, description_placeholders={ @@ -564,6 +537,68 @@ async def display_homes_select_form(self, reason: str): last_step=False, ) + async def async_step_advanced_options(self, user_input: dict = None): + if user_input: + self._ctrl_mode = user_input.get('ctrl_mode', self._ctrl_mode) + self._action_debug = user_input.get( + 'action_debug', self._action_debug) + self._hide_non_standard_entities = user_input.get( + 'hide_non_standard_entities', self._hide_non_standard_entities) + # Device filter + if user_input.get('devices_filter', False): + return await self.async_step_devices_filter() + return await self.config_flow_done() + return self.async_show_form( + step_id='advanced_options', + data_schema=vol.Schema({ + vol.Required('ctrl_mode', default=DEFAULT_CTRL_MODE): vol.In( + self._miot_i18n.translate(key='config.control_mode')), + vol.Required('action_debug', default=self._action_debug): bool, + vol.Required( + 'hide_non_standard_entities', + default=self._hide_non_standard_entities): bool, + vol.Required('devices_filter', default=False): bool, + }), + last_step=False, + ) + + async def async_step_devices_filter(self, user_input: dict = None): + if user_input: + return await self.config_flow_done() + + return self.async_show_form( + step_id='devices_filter', + data_schema=vol.Schema({ + vol.Required('filter_mode', default='include'): vol.In( + self._miot_i18n.translate(key='config.filter_mode')), + vol.Required('filter_mode', default='include'): vol.In( + self._miot_i18n.translate(key='config.filter_mode')) + }), + last_step=False, + ) + + async def config_flow_done(self): + return self.async_create_entry( + title=( + f'{self._nick_name}: {self._uid} ' + f'[{CLOUD_SERVERS[self._cloud_server]}]'), + data={ + 'virtual_did': self._virtual_did, + 'uuid': self._uuid, + 'integration_language': self._integration_language, + 'storage_path': self._storage_path, + 'uid': self._uid, + 'nick_name': self._nick_name, + 'cloud_server': self._cloud_server, + 'oauth_redirect_url': self._oauth_redirect_url, + 'ctrl_mode': self._ctrl_mode, + 'home_selected': self._home_selected, + 'area_name_rule': self._area_name_rule, + 'action_debug': self._action_debug, + 'hide_non_standard_entities': + self._hide_non_standard_entities, + }) + @staticmethod @callback def async_get_options_flow( diff --git a/custom_components/xiaomi_home/miot/i18n/de.json b/custom_components/xiaomi_home/miot/i18n/de.json index afcea1d..04103d6 100644 --- a/custom_components/xiaomi_home/miot/i18n/de.json +++ b/custom_components/xiaomi_home/miot/i18n/de.json @@ -8,6 +8,10 @@ "auto": "automatisch", "cloud": "Cloud" }, + "filter_mode": { + "include": "einschließen", + "exclude": "ausschließen" + }, "room_name_rule": { "none": "nicht synchronisieren", "home_room": "Hausname und Raumname (Xiaomi Home Schlafzimmer)", diff --git a/custom_components/xiaomi_home/miot/i18n/en.json b/custom_components/xiaomi_home/miot/i18n/en.json index 49430b3..d8fb68d 100644 --- a/custom_components/xiaomi_home/miot/i18n/en.json +++ b/custom_components/xiaomi_home/miot/i18n/en.json @@ -8,6 +8,10 @@ "auto": "Auto", "cloud": "Cloud" }, + "filter_mode": { + "include": "Include", + "exclude": "Exclude" + }, "room_name_rule": { "none": "Do not synchronize", "home_room": "Home Name and Room Name (Xiaomi Home Bedroom)", diff --git a/custom_components/xiaomi_home/miot/i18n/es.json b/custom_components/xiaomi_home/miot/i18n/es.json index 5ca9862..8effc97 100644 --- a/custom_components/xiaomi_home/miot/i18n/es.json +++ b/custom_components/xiaomi_home/miot/i18n/es.json @@ -8,6 +8,10 @@ "auto": "automático", "cloud": "nube" }, + "filter_mode": { + "include": "incluir", + "exclude": "excluir" + }, "room_name_rule": { "none": "no sincronizar", "home_room": "nombre de la casa y nombre de la habitación (Xiaomi Home Dormitorio)", diff --git a/custom_components/xiaomi_home/miot/i18n/fr.json b/custom_components/xiaomi_home/miot/i18n/fr.json index 677bf27..f8b6caa 100644 --- a/custom_components/xiaomi_home/miot/i18n/fr.json +++ b/custom_components/xiaomi_home/miot/i18n/fr.json @@ -8,6 +8,10 @@ "auto": "automatique", "cloud": "cloud" }, + "filter_mode": { + "include": "inclure", + "exclude": "exclure" + }, "room_name_rule": { "none": "ne pas synchroniser", "home_room": "nom de la maison et nom de la pièce (Xiaomi Home Chambre)", diff --git a/custom_components/xiaomi_home/miot/i18n/ja.json b/custom_components/xiaomi_home/miot/i18n/ja.json index 3980c1e..c0d51b9 100644 --- a/custom_components/xiaomi_home/miot/i18n/ja.json +++ b/custom_components/xiaomi_home/miot/i18n/ja.json @@ -8,6 +8,10 @@ "auto": "自動", "cloud": "クラウド" }, + "filter_mode": { + "include": "含む", + "exclude": "除外" + }, "room_name_rule": { "none": "同期しない", "home_room": "家の名前と部屋の名前 (Xiaomi Home 寝室)", diff --git a/custom_components/xiaomi_home/miot/i18n/nl.json b/custom_components/xiaomi_home/miot/i18n/nl.json index 03dfc32..bc81b20 100644 --- a/custom_components/xiaomi_home/miot/i18n/nl.json +++ b/custom_components/xiaomi_home/miot/i18n/nl.json @@ -8,6 +8,10 @@ "auto": "Automatisch", "cloud": "Cloud" }, + "filter_mode": { + "include": "Inclusief", + "exclude": "Uitsluiten" + }, "room_name_rule": { "none": "Niet synchroniseren", "home_room": "Huisnaam en Kamernaam (Xiaomi Home Slaapkamer)", @@ -92,4 +96,4 @@ "-706014006": "Apparaatbeschrijving niet gevonden" } } -} +} \ No newline at end of file diff --git a/custom_components/xiaomi_home/miot/i18n/pt-BR.json b/custom_components/xiaomi_home/miot/i18n/pt-BR.json index 8df352b..54ae478 100644 --- a/custom_components/xiaomi_home/miot/i18n/pt-BR.json +++ b/custom_components/xiaomi_home/miot/i18n/pt-BR.json @@ -8,6 +8,10 @@ "auto": "automático", "cloud": "nuvem" }, + "filter_mode": { + "include": "incluir", + "exclude": "excluir" + }, "room_name_rule": { "none": "não sincronizado", "home_room": "Nome da casa e nome do quarto (Xiaomi Home Quarto)", diff --git a/custom_components/xiaomi_home/miot/i18n/pt.json b/custom_components/xiaomi_home/miot/i18n/pt.json index dd30774..0dd732f 100644 --- a/custom_components/xiaomi_home/miot/i18n/pt.json +++ b/custom_components/xiaomi_home/miot/i18n/pt.json @@ -8,6 +8,10 @@ "auto": "Automático", "cloud": "Nuvem" }, + "filter_mode": { + "include": "Incluir", + "exclude": "Excluir" + }, "room_name_rule": { "none": "Não sincronizar", "home_room": "Nome da casa e Nome do quarto (Xiaomi Home Quarto)", diff --git a/custom_components/xiaomi_home/miot/i18n/ru.json b/custom_components/xiaomi_home/miot/i18n/ru.json index 18f8490..c922212 100644 --- a/custom_components/xiaomi_home/miot/i18n/ru.json +++ b/custom_components/xiaomi_home/miot/i18n/ru.json @@ -8,6 +8,10 @@ "auto": "автоматический", "cloud": "облако" }, + "filter_mode": { + "include": "включить", + "exclude": "исключить" + }, "room_name_rule": { "none": "не синхронизировать", "home_room": "название дома и название комнаты (Xiaomi Home Спальня)", diff --git a/custom_components/xiaomi_home/miot/i18n/zh-Hans.json b/custom_components/xiaomi_home/miot/i18n/zh-Hans.json index 1607a5e..b2bca90 100644 --- a/custom_components/xiaomi_home/miot/i18n/zh-Hans.json +++ b/custom_components/xiaomi_home/miot/i18n/zh-Hans.json @@ -8,6 +8,10 @@ "auto": "自动", "cloud": "云端" }, + "filter_mode": { + "include": "包含", + "exclude": "排除" + }, "room_name_rule": { "none": "不同步", "home_room": "家庭名 和 房间名 (米家 卧室)", diff --git a/custom_components/xiaomi_home/miot/i18n/zh-Hant.json b/custom_components/xiaomi_home/miot/i18n/zh-Hant.json index e62b4f9..901e5c0 100644 --- a/custom_components/xiaomi_home/miot/i18n/zh-Hant.json +++ b/custom_components/xiaomi_home/miot/i18n/zh-Hant.json @@ -8,6 +8,10 @@ "auto": "自動", "cloud": "雲端" }, + "filter_mode": { + "include": "包含", + "exclude": "排除" + }, "room_name_rule": { "none": "不同步", "home_room": "家庭名 和 房間名 (米家 臥室)", diff --git a/custom_components/xiaomi_home/translations/de.json b/custom_components/xiaomi_home/translations/de.json index b06c460..47254b6 100644 --- a/custom_components/xiaomi_home/translations/de.json +++ b/custom_components/xiaomi_home/translations/de.json @@ -24,13 +24,28 @@ }, "homes_select": { "title": "Familie und Geräte auswählen", - "description": "## Gebrauchsanweisung\r\n### Steuerungsmodus\r\n- Automatisch: Wenn im lokalen Netzwerk ein verfügbarer Xiaomi-Zentralgateway vorhanden ist, wird Home Assistant bevorzugt Steuerbefehle über den Zentralgateway senden, um eine lokale Steuerung zu ermöglichen. Wenn im lokalen Netzwerk kein Zentralgateway vorhanden ist, wird versucht, Steuerbefehle über das Xiaomi-OT-Protokoll zu senden, um eine lokale Steuerung zu ermöglichen. Nur wenn die oben genannten Bedingungen für die lokale Steuerung nicht erfüllt sind, werden die Steuerbefehle über die Cloud gesendet.\r\n- Cloud: Steuerbefehle werden nur über die Cloud gesendet.\r\n### Familienimport für importierte Geräte\r\nDie Integration fügt Geräte aus den ausgewählten Familien hinzu.\r\n### Raumnamensynchronisationsmodus\r\nWenn Geräte von der Xiaomi Home App zu Home Assistant synchronisiert werden, wird die Bezeichnung des Bereichs, in dem sich die Geräte in Home Assistant befinden, nach folgenden Regeln benannt. Beachten Sie, dass das Synchronisieren von Geräten den von Xiaomi Home App festgelegten Familien- und Raum-Einstellungen nicht ändert.\r\n- Nicht synchronisieren: Das Gerät wird keinem Bereich hinzugefügt.\r\n- Andere Optionen: Der Bereich, in den das Gerät aufgenommen wird, wird nach dem Namen der Familie oder des Raums in der Xiaomi Home App benannt.\r\n### Action-Debug-Modus\r\nFür von MIoT-Spec-V2 definierte Gerätemethoden wird neben der Benachrichtigungs-Entität auch eine Texteingabe-Entität generiert. Damit können Sie bei der Fehlerbehebung Steuerbefehle an das Gerät senden.\r\n### Verstecke Nicht-Standard-Entitäten\r\nVerstecke Entitäten, die von nicht standardmäßigen MIoT-Spec-V2-Instanzen mit einem Namen beginnen, der mit einem \"*\" beginnt.\r\n\r\n \r\n### Hallo {nick_name}! Bitte wählen Sie den Steuerungsmodus der Integration sowie die Familie aus, in der sich die hinzuzufügenden Geräte befinden.", + "description": "## Gebrauchsanweisung\r\n### Familienimport für importierte Geräte\r\nDie Integration fügt Geräte aus den ausgewählten Familien hinzu.\r\n### Raumnamensynchronisationsmodus\r\nWenn Geräte von der Xiaomi Home App zu Home Assistant synchronisiert werden, wird die Bezeichnung des Bereichs, in dem sich die Geräte in Home Assistant befinden, nach folgenden Regeln benannt. Beachten Sie, dass das Synchronisieren von Geräten den von Xiaomi Home App festgelegten Familien- und Raum-Einstellungen nicht ändert.\r\n- Nicht synchronisieren: Das Gerät wird keinem Bereich hinzugefügt.\r\n- Andere Optionen: Der Bereich, in den das Gerät aufgenommen wird, wird nach dem Namen der Familie oder des Raums in der Xiaomi Home App benannt.\r\n### Erweiterte Einstellungen\r\nZeigen Sie erweiterte Einstellungen an, um die professionellen Konfigurationsoptionen der Integration zu ändern.\r\n\r\n \r\n### {nick_name} Hallo! Bitte wählen Sie die Familie aus, zu der Sie das Gerät hinzufügen möchten.", "data": { - "ctrl_mode": "Steuerungsmodus", "home_infos": "Familienimport für importierte Geräte", "area_name_rule": "Raumnamensynchronisationsmodus", + "advanced_options": "Erweiterte Einstellungen" + } + }, + "advanced_options": { + "title": "Erweiterte Einstellungen", + "description": "## Einführung\r\n### Behalten Sie die Standardeinstellungen bei, es sei denn, Sie verstehen die folgenden Optionen vollständig.\r\n### Steuerungsmodus\r\n- Automatisch: Wenn ein verfügbarer Xiaomi-Hub im lokalen Netzwerk vorhanden ist, priorisiert Home Assistant das Senden von Steuerbefehlen über den Hub, um eine lokale Steuerung zu ermöglichen. Wenn kein Hub vorhanden ist, wird versucht, Steuerbefehle über das Xiaomi-OT-Protokoll zu senden. Nur wenn diese Bedingungen für die lokale Steuerung nicht erfüllt sind, werden die Befehle über die Cloud gesendet.\r\n- Cloud: Steuerbefehle werden ausschließlich über die Cloud gesendet.\r\n### Gerätefilterung\r\nFiltern Sie unerwünschte Geräte nach Familien.\r\n### Action-Debug-Modus\r\nFür Methoden, die von MIoT-Spec-V2-Geräten definiert werden, wird neben der Benachrichtigungsentität auch eine Texteingabe-Entität erstellt, mit der Sie während des Debuggens Steuerbefehle an das Gerät senden können.\r\n### Nicht standardmäßige Entitäten ausblenden\r\nBlendet Entitäten aus, die von nicht-standardmäßigen MIoT-Spec-V2-Instanzen generiert werden und deren Name mit „*“ beginnt.", + "data": { + "ctrl_mode": "Steuerungsmodus", "action_debug": "Action-Debug-Modus", - "hide_non_standard_entities": "Verstecke Nicht-Standard-Entitäten" + "hide_non_standard_entities": "Nicht standardmäßige Entitäten ausblenden", + "devices_filter": "Gerätefilterung" + } + }, + "devices_filter": { + "title": "Gerätefilterung", + "description": "## Einführung\r\nFiltern Sie unerwünschte Geräte nach Familien.", + "data": { + "filter_mode": "Filtermodus" } } }, diff --git a/custom_components/xiaomi_home/translations/en.json b/custom_components/xiaomi_home/translations/en.json index ddb424a..d8e11d5 100644 --- a/custom_components/xiaomi_home/translations/en.json +++ b/custom_components/xiaomi_home/translations/en.json @@ -23,14 +23,29 @@ "description": "Click NEXT to try again." }, "homes_select": { - "title": "Select Home and Devices", - "description": "## Usage Instructions\r\n### Control mode\r\n- Auto: When there is an available Xiaomi central hub gateway in the local area network, Home Assistant will prioritize sending device control commands through the central hub gateway to achieve local control. If there is no central hub gateway in the local area network, it will attempt to send control commands through Xiaomi LAN control function. Only when the above local control conditions are not met, the device control commands will be sent through the cloud.\r\n- Cloud: All control commands are sent through the cloud.\r\n### Import devices from home\r\nThe integration will add devices from the selected homes.\n### Room name synchronizing mode\nWhen importing devices from Xiaomi Home APP to Home Assistant, the naming convention of the area where the device is added to is as follows. Note that the device synchronizing process does not change the home or room settings in Xiaomi Home APP.\r\n- Do not synchronize: The device will not be added to any area.\r\n- Other options: The device will be added to an area named as the home and/or room name that already exists in Xiaomi Home APP.\r\n### Debug mode for action\r\nFor the action defined in MIoT-Spec-V2 of the device, a Text entity along with a Notify entity will be created, in which you can send control commands to the device for debugging.\r\n### Hide non-standard created entities\r\nHide the entities generated from non-standard MIoT-Spec-V2 instances, whose names begin with \"*\".\r\n\r\n \r\n### Hello {nick_name}, please select the integration control mode and the home where the device you want to import.", + "title": "Select Family and Device", + "description": "## Introduction\r\n### Import Device's Family\r\nThe integration will add devices from the selected family.\r\n### Room Name Sync Mode\r\nWhen syncing devices from the Mi Home APP to Home Assistant, the naming of the area in Home Assistant will follow the rules below. Note that the sync process will not change the family and room settings in the Mi Home APP.\r\n- Do not sync: The device will not be added to any area.\r\n- Other options: The area to which the device is added will be named after the family or room name in the Mi Home APP.\r\n### Advanced Settings\r\nShow advanced settings to modify the professional configuration options of the integration.\r\n\r\n \r\n### {nick_name} Hello! Please select the family to which you want to add the device.", "data": { - "ctrl_mode": "Control mode", - "home_infos": "Import devices from home", - "area_name_rule": "Room name synchronizing mode", - "action_debug": "Debug mode for action", - "hide_non_standard_entities": "Hide non-standard created entities" + "home_infos": "Import Device's Family", + "area_name_rule": "Room Name Sync Mode", + "advanced_options": "Advanced Settings" + } + }, + "advanced_options": { + "title": "Advanced Settings", + "description": "## Introduction\r\n### Keep the default settings unless you fully understand the following options.\r\n### Control Mode\r\n- Auto: When a Xiaomi hub is available on the local network, Home Assistant will prioritize sending device control commands through the hub for local control. If there is no hub, it will attempt to send commands via the Xiaomi OT protocol. Only if those local control conditions are not met will commands be sent through the cloud.\r\n- Cloud: Control commands are sent exclusively through the cloud.\r\n### Device Filtering\r\nFilter out unwanted devices by family.\r\n### Action Debug Mode\r\nFor methods defined by MIoT-Spec-V2 devices, besides generating a notification entity, a text input entity will also be created so you can send control commands to the device during debugging.\r\n### Hide Non-Standard Generated Entities\r\nHide entities generated by non-standard MIoT-Spec-V2 instances whose names start with \"*\".", + "data": { + "ctrl_mode": "Control Mode", + "action_debug": "Action Debug Mode", + "hide_non_standard_entities": "Hide Non-Standard Generated Entities", + "devices_filter": "Device Filtering" + } + }, + "devices_filter": { + "title": "Device Filtering", + "description": "## Introduction\r\nFilter out unwanted devices by family.", + "data": { + "filter_mode": "Filter Mode" } } }, diff --git a/custom_components/xiaomi_home/translations/es.json b/custom_components/xiaomi_home/translations/es.json index 23ee109..c15adcd 100644 --- a/custom_components/xiaomi_home/translations/es.json +++ b/custom_components/xiaomi_home/translations/es.json @@ -23,14 +23,29 @@ "description": "Haga clic en \"Siguiente\" para volver a intentarlo" }, "homes_select": { - "title": "Seleccionar hogares y dispositivos", - "description": "## Instrucciones de uso\r\n### Modo de control\r\n- Automático: Cuando hay un gateway central de Xiaomi disponible en la red local, Home Assistant priorizará el envío de comandos de control de dispositivos a través del gateway central para lograr un control localizado. Si no hay un gateway central en la red local, intentará enviar comandos de control a través del protocolo Xiaomi OT para lograr un control localizado. Solo cuando no se cumplan las condiciones anteriores de control localizado, los comandos de control del dispositivo se enviarán a través de la nube.\r\n- Nube: Los comandos de control solo se envían a través de la nube.\r\n### Hogares de dispositivos importados\r\nLa integración agregará los dispositivos en los hogares seleccionados.\r\n### Modo de sincronización del nombre de la habitación\r\nCuando se sincronizan los dispositivos desde la aplicación Xiaomi Home a Home Assistant, los nombres de las áreas donde se encuentran los dispositivos en Home Assistant seguirán las reglas de nomenclatura a continuación. Tenga en cuenta que el proceso de sincronización de dispositivos no cambiará la configuración de hogares y habitaciones en la aplicación Xiaomi Home.\r\n- Sin sincronización: el dispositivo no se agregará a ninguna área.\r\n- Otras opciones: la zona donde se agrega el dispositivo tendrá el mismo nombre que el hogar o la habitación en la aplicación Xiaomi Home.\r\n### Modo de depuración de Action\r\nPara los métodos definidos por MIoT-Spec-V2, además de generar una entidad de notificación, también se generará una entidad de cuadro de entrada de texto que se puede utilizar para enviar comandos de control al dispositivo durante la depuración.\r\n### Ocultar entidades generadas no estándar\r\nOcultar las entidades generadas por la instancia no estándar MIoT-Spec-V2 que comienzan con \"*\".\r\n\r\n \r\n### ¡Hola, {nick_name}! Seleccione el modo de control de integración y el hogar donde se encuentran los dispositivos que desea agregar.", + "title": "Seleccionar familia y dispositivo", + "description": "## Introducción\r\n### Importar la familia del dispositivo\r\nLa integración añadirá dispositivos de la familia seleccionada.\r\n### Modo de sincronización del nombre de la habitación\r\nAl sincronizar dispositivos desde la APP Mi Home a Home Assistant, el nombre del área en Home Assistant seguirá las siguientes reglas. Tenga en cuenta que el proceso de sincronización no cambiará la configuración de la familia y la habitación en la APP Mi Home.\r\n- No sincronizar: El dispositivo no se añadirá a ninguna área.\r\n- Otras opciones: El área a la que se añade el dispositivo se nombrará según el nombre de la familia o la habitación en la APP Mi Home.\r\n### Configuración avanzada\r\nMostrar configuración avanzada para modificar las opciones de configuración profesional de la integración.\r\n\r\n \r\n### {nick_name} ¡Hola! Por favor, seleccione la familia a la que desea añadir el dispositivo.", "data": { - "ctrl_mode": "Modo de control", - "home_infos": "Hogares de dispositivos importados", + "home_infos": "Importar la familia del dispositivo", "area_name_rule": "Modo de sincronización del nombre de la habitación", - "action_debug": "Modo de depuración de Action", - "hide_non_standard_entities": "Ocultar entidades generadas no estándar" + "advanced_options": "Configuración avanzada" + } + }, + "advanced_options": { + "title": "Opciones Avanzadas", + "description": "## Introducción\r\n### Mantenga la configuración predeterminada a menos que conozca completamente el significado de las siguientes opciones.\r\n### Modo de Control\r\n- Automático: Cuando haya un hub Xiaomi disponible en la red local, Home Assistant priorizará el envío de comandos de control a través del hub para lograr un control local. Si no hay un hub, intentará enviar los comandos a través del protocolo Xiaomi OT. Solo si no se cumplen esas condiciones de control local, los comandos se enviarán a través de la nube.\r\n- Nube: Los comandos se envían exclusivamente a través de la nube.\r\n### Filtrado de Dispositivos\r\nFiltre dispositivos no deseados por familia.\r\n### Modo de Depuración de Acciones\r\nPara los métodos definidos por dispositivos MIoT-Spec-V2, además de generar una entidad de notificación, se creará una entidad de entrada de texto para que pueda enviar comandos de control durante la depuración.\r\n### Ocultar Entidades Generadas No Estándar\r\nOculte entidades generadas por instancias no estándar de MIoT-Spec-V2 cuyos nombres comiencen con \"*\".", + "data": { + "ctrl_mode": "Modo de Control", + "action_debug": "Modo de Depuración de Acciones", + "hide_non_standard_entities": "Ocultar Entidades Generadas No Estándar", + "devices_filter": "Filtrado de Dispositivos" + } + }, + "devices_filter": { + "title": "Filtrado de Dispositivos", + "description": "## Introducción\r\nFiltre dispositivos no deseados por familia.", + "data": { + "filter_mode": "Modo de Filtrado" } } }, diff --git a/custom_components/xiaomi_home/translations/fr.json b/custom_components/xiaomi_home/translations/fr.json index 82c8908..2e589b6 100644 --- a/custom_components/xiaomi_home/translations/fr.json +++ b/custom_components/xiaomi_home/translations/fr.json @@ -23,14 +23,29 @@ "description": "Cliquez sur \"Suivant\" pour réessayer" }, "homes_select": { - "title": "Sélectionner une maison et des appareils", - "description": "## Instructions d'utilisation\r\n### Mode de contrôle\r\n- Automatique: Lorsqu'il y a une passerelle centrale Xiaomi disponible dans le réseau local, Home Assistant priorisera l'envoi des commandes de contrôle des appareils via la passerelle centrale pour réaliser un contrôle localisé. S'il n'y a pas de passerelle centrale dans le réseau local, il tentera d'envoyer des commandes de contrôle via le protocole Xiaomi OT pour réaliser un contrôle localisé. Ce n'est que lorsque les conditions de contrôle localisé ci-dessus ne sont pas remplies que les commandes de contrôle des appareils seront envoyées via le cloud.\r\n- Cloud: Les commandes de contrôle ne sont envoyées que via le cloud.\r\n### Importer une maison pour les appareils\r\nL'intégration ajoutera les appareils de la maison sélectionnée.\r\n### Mode de synchronisation des noms de pièces\r\nLors de la synchronisation des appareils de Xiaomi Home à Home Assistant, le nom de la pièce où se trouve l'appareil sera nommé selon les règles suivantes. Notez que le processus de synchronisation des appareils n'affecte pas les paramètres de la maison et de la pièce dans Xiaomi Home APP.\r\n- Ne pas synchroniser: L'appareil ne sera ajouté à aucune zone.\r\n- Autre option: La zone dans laquelle l'appareil est ajouté est nommée en fonction du nom de la maison ou de la pièce de Xiaomi Home APP.\r\n### Mode de débogage d'action\r\nPour les méthodes définies par MIoT-Spec-V2, en plus de générer une entité de notification, une entité de zone de texte sera également générée pour que vous puissiez envoyer des commandes de contrôle à l'appareil lors du débogage.\r\n### Masquer les entités générées non standard\r\nMasquer les entités générées non standard de MIoT-Spec-V2 commençant par \"*\".\r\n\r\n \r\n### {nick_name} Bonjour ! Veuillez sélectionner le mode de contrôle de l'intégration et la maison où se trouvent les appareils à ajouter.", + "title": "Sélectionner la famille et l'appareil", + "description": "## Introduction\r\n### Importer la famille de l'appareil\r\nL'intégration ajoutera des appareils de la famille sélectionnée.\r\n### Mode de synchronisation du nom de la pièce\r\nLors de la synchronisation des appareils de l'application Mi Home avec Home Assistant, le nom de la zone dans Home Assistant suivra les règles ci-dessous. Notez que le processus de synchronisation ne modifiera pas les paramètres de la famille et de la pièce dans l'application Mi Home.\r\n- Ne pas synchroniser : L'appareil ne sera ajouté à aucune zone.\r\n- Autres options : La zone à laquelle l'appareil est ajouté sera nommée d'après le nom de la famille ou de la pièce dans l'application Mi Home.\r\n### Paramètres avancés\r\nAfficher les paramètres avancés pour modifier les options de configuration professionnelle de l'intégration.\r\n\r\n \r\n### {nick_name} Bonjour ! Veuillez sélectionner la famille à laquelle vous souhaitez ajouter l'appareil.", "data": { - "ctrl_mode": "Mode de contrôle", - "home_infos": "Importer une maison pour les appareils", - "area_name_rule": "Mode de synchronisation des noms de pièces", - "action_debug": "Mode de débogage d'action", - "hide_non_standard_entities": "Masquer les entités générées non standard" + "home_infos": "Importer la famille de l'appareil", + "area_name_rule": "Mode de synchronisation du nom de la pièce", + "advanced_options": "Paramètres avancés" + } + }, + "advanced_options": { + "title": "Paramètres Avancés", + "description": "## Introduction\r\n### Conservez les paramètres par défaut à moins de comprendre parfaitement la signification des options ci-dessous.\r\n### Mode de Contrôle\r\n- Automatique : Lorsqu’un hub Xiaomi est disponible sur le réseau local, Home Assistant privilégie l’envoi de commandes via ce hub pour un contrôle local. S’il n’y a pas de hub, il tentera d’envoyer des commandes via le protocole Xiaomi OT. Ce n’est que si les conditions de contrôle local ne sont pas remplies que les commandes seront envoyées via le cloud.\r\n- Cloud : Les commandes sont envoyées exclusivement via le cloud.\r\n### Filtrage des Appareils\r\nFiltrez les appareils indésirables en fonction de la famille.\r\n### Mode de Débogage d’Actions\r\nPour les méthodes définies par les appareils MIoT-Spec-V2, en plus de générer une entité de notification, une entité de saisie de texte sera créée pour envoyer des commandes de contrôle pendant le débogage.\r\n### Masquer les Entités Non Standard\r\nMasquez les entités générées par des instances MIoT-Spec-V2 non standard dont le nom commence par « * ».", + "data": { + "ctrl_mode": "Mode de Contrôle", + "action_debug": "Mode de Débogage d’Actions", + "hide_non_standard_entities": "Masquer les Entités Non Standard", + "devices_filter": "Filtrage des Appareils" + } + }, + "devices_filter": { + "title": "Filtrage des Appareils", + "description": "## Introduction\r\nFiltrez les appareils indésirables en fonction de la famille.", + "data": { + "filter_mode": "Mode de Filtrage" } } }, diff --git a/custom_components/xiaomi_home/translations/ja.json b/custom_components/xiaomi_home/translations/ja.json index a8d6b36..bffdaa0 100644 --- a/custom_components/xiaomi_home/translations/ja.json +++ b/custom_components/xiaomi_home/translations/ja.json @@ -23,14 +23,29 @@ "description": "「次へ」をクリックして再試行してください" }, "homes_select": { - "title": "ホームとデバイスを選択", - "description": "## 使用方法\r\n### 制御モード\r\n- 自動: ローカルエリアネットワーク内に利用可能なXiaomi中央ゲートウェイが存在する場合、Home Assistantは中央ゲートウェイを介してデバイス制御コマンドを優先的に送信し、ローカル制御機能を実現します。ローカルエリアネットワーク内に中央ゲートウェイが存在しない場合、Xiaomi OTプロトコルを介して制御コマンドを送信し、ローカル制御機能を実現しようとします。上記のローカル制御条件が満たされない場合にのみ、デバイス制御コマンドはクラウドを介して送信されます。\r\n- クラウド: 制御コマンドはクラウドを介してのみ送信されます。\r\n### 導入されたデバイスのホーム\r\n統合は、選択された家庭にあるデバイスを追加します。\r\n### 部屋名同期モード\r\nXiaomi Home アプリから Home Assistant に同期されるデバイスの場合、デバイスが Home Assistant 内でどのような領域にあるかを示す名前の命名方式は、以下のルールに従います。ただし、デバイスの同期プロセスは、Xiaomi Home アプリで家庭および部屋の設定を変更しないことに注意してください。\r\n- 同期しない:デバイスはどの領域にも追加されません。\r\n- その他のオプション:デバイスが追加される領域は、Xiaomi Home アプリの家庭または部屋の名前に従って命名されます。\r\n### Action デバッグモード\r\nデバイスが MIoT-Spec-V2 で定義された方法を実行する場合、通知エンティティの生成に加えて、テキスト入力ボックスエンティティも生成されます。これを使用して、デバイスに制御命令を送信することができます。\r\n### 非標準生成エンティティを非表示にする\r\n「*」で始まる名前の非標準 MIoT-Spec-V2 インスタンスによって生成されたエンティティを非表示にします。\r\n\r\n \r\n### {nick_name} さん、こんにちは! 統合制御モードと追加するデバイスがあるホームを選択してください。", + "title": "家族とデバイスを選択", + "description": "## 紹介\r\n### デバイスの家族をインポート\r\n統合は選択された家族のデバイスを追加します。\r\n### 部屋の名前の同期モード\r\nMi HomeアプリからHome Assistantにデバイスを同期する際、Home Assistantのエリアの名前は以下のルールに従います。同期プロセスはMi Homeアプリの家族と部屋の設定を変更しないことに注意してください。\r\n- 同期しない:デバイスはどのエリアにも追加されません。\r\n- その他のオプション:デバイスが追加されるエリアはMi Homeアプリの家族または部屋の名前にちなんで命名されます。\r\n### 高度な設定\r\n統合のプロフェッショナルな設定オプションを変更するために高度な設定を表示します。\r\n\r\n \r\n### {nick_name} こんにちは!デバイスを追加したい家族を選択してください。", "data": { - "ctrl_mode": "制御モード", - "home_infos": "導入されたデバイスのホーム", - "area_name_rule": "部屋名同期モード", - "action_debug": "Action デバッグモード", - "hide_non_standard_entities": "非標準生成エンティティを非表示にする" + "home_infos": "デバイスの家族をインポート", + "area_name_rule": "部屋の名前の同期モード", + "advanced_options": "高度な設定" + } + }, + "advanced_options": { + "title": "高度な設定オプション", + "description": "## 紹介\r\n### 以下のオプションの意味を十分に理解していない限り、デフォルト設定のままにしてください。\r\n### コントロールモード\r\n- 自動: ローカルネットワークに利用可能なXiaomiハブがある場合、Home Assistantはローカル制御を実現するためにハブを介してデバイス制御コマンドを優先的に送信します。ハブが存在しない場合は、Xiaomi OTプロトコルを介して制御コマンドを送信しようとします。これらのローカル制御条件が満たされない場合のみ、クラウド経由でコマンドが送信されます。\r\n- クラウド: コマンドはクラウド経由でのみ送信されます。\r\n### デバイスフィルタ\r\n不要なデバイスをファミリー単位でフィルタリングします。\r\n### Actionデバッグモード\r\nMIoT-Spec-V2デバイスで定義されたメソッドについては、通知エンティティに加えてテキスト入力エンティティも生成され、デバッグ時にデバイスへ制御コマンドを送信できます。\r\n### 非標準生成エンティティを隠す\r\n名前が「*」で始まる、非標準のMIoT-Spec-V2インスタンスによって生成されたエンティティを隠します。", + "data": { + "ctrl_mode": "コントロールモード", + "action_debug": "Actionデバッグモード", + "hide_non_standard_entities": "非標準生成エンティティを隠す", + "devices_filter": "デバイスフィルタ" + } + }, + "devices_filter": { + "title": "デバイスフィルタ", + "description": "## 使い方\r\n不要なデバイスをファミリー単位でフィルタリングします。", + "data": { + "filter_mode": "フィルターモード" } } }, diff --git a/custom_components/xiaomi_home/translations/nl.json b/custom_components/xiaomi_home/translations/nl.json index a01f845..ad257c3 100644 --- a/custom_components/xiaomi_home/translations/nl.json +++ b/custom_components/xiaomi_home/translations/nl.json @@ -23,14 +23,29 @@ "description": "Klik OP VOLGENDE om het opnieuw te proberen." }, "homes_select": { - "title": "Selecteer Huis en Apparaten", - "description": "## Gebruiksinstructies\r\n### Controlemodus\r\n- Auto: Wanneer er een beschikbare Xiaomi centrale hubgateway in het lokale netwerk is, geeft Home Assistant de voorkeur aan het verzenden van apparaatbedieningscommando's via de centrale hubgateway om lokale controle te bereiken. Als er geen centrale hubgateway in het lokale netwerk is, zal het proberen bedieningscommando's te verzenden via de Xiaomi LAN-controlefunctie. Alleen wanneer de bovenstaande lokale controlevoorwaarden niet zijn vervuld, worden de apparaatbedieningscommando's via de cloud verzonden.\r\n- Cloud: Alle bedieningscommando's worden via de cloud verzonden.\r\n### Apparaten importeren vanuit huis\r\nDe integratie voegt apparaten toe van de geselecteerde huizen.\n### Ruimtenaamsynchronisatiemodus\nBij het importeren van apparaten vanuit de Xiaomi Home APP naar Home Assistant is de naamgevingsconventie van het gebied waarin het apparaat wordt toegevoegd als volgt. Opmerking: het synchronisatieproces van het apparaat verandert de huis- of ruimte-instellingen in de Xiaomi Home APP niet.\r\n- Niet synchroniseren: Het apparaat wordt aan geen enkel gebied toegevoegd.\r\n- Andere opties: Het apparaat wordt toegevoegd aan een gebied dat is genoemd naar de huis- en/of ruimtenamen die al bestaan in de Xiaomi Home APP.\r\n### Debugmodus voor actie\r\nVoor de actie gedefinieerd in MIoT-Spec-V2 van het apparaat, wordt er een Tekstentiteit samen met een Notificatie-entiteit aangemaakt, waarin u bedieningscommando's naar het apparaat kunt sturen voor debugging.\r\n### Verberg niet-standaard gemaakte entiteiten\r\nVerberg de entiteiten die zijn gegenereerd vanuit niet-standaard MIoT-Spec-V2-instanties, waarvan de namen beginnen met \"*\".\r\n\r\n \r\n### Hallo {nick_name}, selecteer alstublieft de integratie controlemethodiek en het huis waar het apparaat dat u wilt importeren zich bevindt.", + "title": "Selecteer Familie en Apparaat", + "description": "## Inleiding\r\n### Importeer de familie van het apparaat\r\nDe integratie voegt apparaten toe uit de geselecteerde familie.\r\n### Kamernaam Synchronisatiemodus\r\nBij het synchroniseren van apparaten van de Mi Home-app naar Home Assistant, wordt de naam van het gebied in Home Assistant volgens de volgende regels genoemd. Houd er rekening mee dat het synchronisatieproces de instellingen van familie en kamer in de Mi Home-app niet zal wijzigen.\r\n- Niet synchroniseren: Het apparaat wordt niet aan een gebied toegevoegd.\r\n- Andere opties: Het gebied waaraan het apparaat wordt toegevoegd, wordt genoemd naar de familie- of kamernaam in de Mi Home-app.\r\n### Geavanceerde instellingen\r\nToon geavanceerde instellingen om de professionele configuratie-opties van de integratie te wijzigen.\r\n\r\n \r\n### {nick_name} Hallo! Selecteer de familie waaraan u het apparaat wilt toevoegen.", "data": { - "ctrl_mode": "Controlemodus", - "home_infos": "Importeer apparaten uit huis", - "area_name_rule": "Ruimtenaamsynchronisatiemodus", - "action_debug": "Debugmodus voor actie", - "hide_non_standard_entities": "Verberg niet-standaard gemaakte entiteiten" + "home_infos": "Importeer de familie van het apparaat", + "area_name_rule": "Kamernaam Synchronisatiemodus", + "advanced_options": "Geavanceerde instellingen" + } + }, + "advanced_options": { + "title": "Geavanceerde Instellingen", + "description": "## Inleiding\r\n### Houd de standaardinstellingen aan, tenzij u de betekenis van de volgende opties volledig begrijpt.\r\n### Besturingsmodus\r\n- Automatisch: Wanneer er een beschikbare Xiaomi-hub in het lokale netwerk is, zal Home Assistant voorrang geven aan het verzenden van besturingsopdrachten via de hub voor lokale besturing. Als er geen hub beschikbaar is, zal het proberen besturingsopdrachten te verzenden via het Xiaomi OT-protocol. Alleen als aan deze lokale besturingsvoorwaarden niet wordt voldaan, worden de opdrachten via de cloud verzonden.\r\n- Cloud: Besturingsopdrachten worden uitsluitend via de cloud verzonden.\r\n### Apparaatfiltering\r\nFilter ongewenste apparaten per familie.\r\n### Actie-debugmodus\r\nVoor methoden gedefinieerd door MIoT-Spec-V2-apparaten wordt, naast een meldingsentiteit, ook een tekstinvoerentiteit gemaakt waarmee u tijdens het debuggen besturingsopdrachten naar het apparaat kunt sturen.\r\n### Niet-standaard entiteiten verbergen\r\nVerberg entiteiten die door niet-standaard MIoT-Spec-V2-instanties worden gegenereerd en waarvan de naam begint met \"*\".", + "data": { + "ctrl_mode": "Besturingsmodus", + "action_debug": "Actie-debugmodus", + "hide_non_standard_entities": "Niet-standaard entiteiten verbergen", + "devices_filter": "Apparaatfiltering" + } + }, + "devices_filter": { + "title": "Apparaatfiltering", + "description": "## Inleiding\r\nFilter ongewenste apparaten per familie.", + "data": { + "filter_mode": "Filtermodus" } } }, @@ -141,4 +156,4 @@ "inconsistent_account": "Accountinformatie is inconsistent. Log in met het juiste account." } } -} +} \ No newline at end of file diff --git a/custom_components/xiaomi_home/translations/pt-BR.json b/custom_components/xiaomi_home/translations/pt-BR.json index fca54a5..4fcf47c 100644 --- a/custom_components/xiaomi_home/translations/pt-BR.json +++ b/custom_components/xiaomi_home/translations/pt-BR.json @@ -23,14 +23,29 @@ "description": "Clique em AVANÇAR para tentar novamente." }, "homes_select": { - "title": "Selecione a Casa e os Dispositivos", - "description": "## Instruções de Uso\r\n### Modo de controle\r\n- Auto: Quando houver um gateway central Xiaomi disponível na rede local, o Home Assistant priorizará o envio de comandos de controle do dispositivo através do gateway central, obtendo assim controle local. Se não houver gateway central na rede local, ele tentará enviar comandos através da função de controle LAN da Xiaomi. Somente quando as condições de controle local acima não forem atendidas, os comandos serão enviados pela nuvem.\r\n- Nuvem: Todos os comandos de controle são enviados através da nuvem.\r\n### Importar dispositivos da casa\r\nA integração adicionará dispositivos das casas selecionadas.\n### Modo de sincronização do nome do cômodo\r\nAo importar dispositivos do aplicativo Xiaomi Home para o Home Assistant, a convenção de nomeação da área onde o dispositivo é adicionado é a seguinte. Observe que o processo de sincronização do dispositivo não altera as configurações de casa ou cômodo no aplicativo Xiaomi Home.\r\n- Não sincronizar: O dispositivo não será adicionado a nenhuma área.\r\n- Outras opções: O dispositivo será adicionado a uma área nomeada de acordo com o nome da casa e/ou do cômodo que já existem no aplicativo Xiaomi Home.\r\n### Modo de depuração para ação\r\nPara as ações definidas no MIoT-Spec-V2 do dispositivo, será criada uma entidade de texto juntamente com uma entidade de notificação, nas quais você poderá enviar comandos de controle ao dispositivo para fins de depuração.\r\n### Ocultar entidades criadas não padrão\r\nOculta as entidades geradas a partir de instâncias não padrão do MIoT-Spec-V2, cujos nomes começam com \"*\".\r\n\r\n \r\n### Olá {nick_name}, selecione o modo de controle da integração e a casa onde estão os dispositivos que você deseja importar.", + "title": "Selecionar Família e Dispositivo", + "description": "## Introdução\r\n### Importar a Família do Dispositivo\r\nA integração adicionará dispositivos da família selecionada.\r\n### Modo de Sincronização do Nome da Sala\r\nAo sincronizar dispositivos do APP Mi Home para o Home Assistant, a nomeação da área no Home Assistant seguirá as regras abaixo. Observe que o processo de sincronização não alterará as configurações de família e sala no APP Mi Home.\r\n- Não sincronizar: O dispositivo não será adicionado a nenhuma área.\r\n- Outras opções: A área à qual o dispositivo é adicionado será nomeada de acordo com o nome da família ou da sala no APP Mi Home.\r\n### Configurações Avançadas\r\nMostrar configurações avançadas para modificar as opções de configuração profissional da integração.\r\n\r\n \r\n### {nick_name} Olá! Por favor, selecione a família à qual você deseja adicionar o dispositivo.", "data": { - "ctrl_mode": "Modo de controle", - "home_infos": "Importar dispositivos da casa", - "area_name_rule": "Modo de sincronização do nome do cômodo", - "action_debug": "Modo de depuração para ação", - "hide_non_standard_entities": "Ocultar entidades não padrão criadas" + "home_infos": "Importar a Família do Dispositivo", + "area_name_rule": "Modo de Sincronização do Nome da Sala", + "advanced_options": "Configurações Avançadas" + } + }, + "advanced_options": { + "title": "Configurações Avançadas", + "description": "## Introdução\r\n### Mantenha as configurações padrão, a menos que você entenda completamente o significado das seguintes opções.\r\n### Modo de Controle\r\n- Automático: Quando houver um hub Xiaomi disponível na rede local, o Home Assistant priorizará o envio de comandos de controle através do hub para obter controle local. Se não houver hub, tentará enviar comandos de controle pelo protocolo Xiaomi OT. Somente se essas condições de controle local não forem atendidas, os comandos serão enviados através da nuvem.\r\n- Nuvem: Os comandos de controle são enviados exclusivamente pela nuvem.\r\n### Filtragem de Dispositivos\r\nFiltre dispositivos indesejados por família.\r\n### Modo de Depuração de Ações\r\nPara métodos definidos por dispositivos MIoT-Spec-V2, além de gerar uma entidade de notificação, será criada uma entidade de entrada de texto para que você possa enviar comandos de controle ao dispositivo durante a depuração.\r\n### Ocultar Entidades Geradas Não Padrão\r\nOculte entidades geradas por instâncias não padrão do MIoT-Spec-V2 cujos nomes começam com \"*\".", + "data": { + "ctrl_mode": "Modo de Controle", + "action_debug": "Modo de Depuração de Ações", + "hide_non_standard_entities": "Ocultar Entidades Geradas Não Padrão", + "devices_filter": "Filtragem de Dispositivos" + } + }, + "devices_filter": { + "title": "Filtragem de Dispositivos", + "description": "## Introdução\r\nFiltre dispositivos indesejados por família.", + "data": { + "filter_mode": "Modo de Filtro" } } }, @@ -141,4 +156,4 @@ "inconsistent_account": "As informações da conta são inconsistentes. Por favor, faça login com a conta correta." } } -} +} \ No newline at end of file diff --git a/custom_components/xiaomi_home/translations/pt.json b/custom_components/xiaomi_home/translations/pt.json index 480f59e..02f883d 100644 --- a/custom_components/xiaomi_home/translations/pt.json +++ b/custom_components/xiaomi_home/translations/pt.json @@ -23,14 +23,29 @@ "description": "Clique em SEGUINTE para tentar novamente." }, "homes_select": { - "title": "Selecione a Casa e os Dispositivos", - "description": "## Instruções de Utilização\r\n### Modo de Controlo\r\n- Automático: Quando existir um gateway central Xiaomi disponível na rede local, o Home Assistant dará prioridade ao envio de comandos de controlo através do gateway central, permitindo um controlo local. Caso não exista um gateway central na rede local, tentará enviar comandos através da funcionalidade de controlo LAN. Apenas se estas condições não forem cumpridas, os comandos serão enviados pela nuvem.\r\n- Nuvem: Todos os comandos de controlo são enviados através da nuvem.\r\n### Importar dispositivos da casa\r\nA integração adicionará dispositivos das casas selecionadas.\n### Modo de sincronização do nome da divisão\r\nAo importar dispositivos da aplicação Xiaomi Home para o Home Assistant, a nomeação da área onde o dispositivo é adicionado segue as regras abaixo. Note que o processo de sincronização dos dispositivos não altera as definições de casa ou divisão na aplicação Xiaomi Home.\r\n- Não sincronizar: O dispositivo não será atribuído a qualquer área.\r\n- Outras opções: O dispositivo será adicionado a uma área cujo nome corresponde ao da casa e/ou divisão definida na aplicação Xiaomi Home.\r\n### Modo de depuração de ação\r\nPara as ações definidas no MIoT-Spec-V2 do dispositivo, será criada uma entidade do tipo texto juntamente com uma entidade de notificação, nas quais poderá enviar comandos de controlo ao dispositivo para fins de depuração.\r\n### Ocultar entidades não padrão\r\nOculta as entidades geradas a partir de instâncias não padrão do MIoT-Spec-V2, cujos nomes começam por \"*\".\r\n\r\n \r\n### Olá {nick_name}, selecione o modo de controlo da integração e a casa na qual deseja importar os dispositivos.", + "title": "Selecionar Família e Dispositivo", + "description": "## Introdução\r\n### Importar a Família do Dispositivo\r\nA integração adicionará dispositivos da família selecionada.\r\n### Modo de Sincronização do Nome da Sala\r\nAo sincronizar dispositivos do APP Mi Home para o Home Assistant, a nomeação da área no Home Assistant seguirá as regras abaixo. Observe que o processo de sincronização não alterará as configurações de família e sala no APP Mi Home.\r\n- Não sincronizar: O dispositivo não será adicionado a nenhuma área.\r\n- Outras opções: A área à qual o dispositivo é adicionado será nomeada de acordo com o nome da família ou da sala no APP Mi Home.\r\n### Configurações Avançadas\r\nMostrar configurações avançadas para modificar as opções de configuração profissional da integração.\r\n\r\n \r\n### {nick_name} Olá! Por favor, selecione a família à qual você deseja adicionar o dispositivo.", + "data": { + "home_infos": "Importar a Família do Dispositivo", + "area_name_rule": "Modo de Sincronização do Nome da Sala", + "advanced_options": "Configurações Avançadas" + } + }, + "advanced_options": { + "title": "Opções Avançadas", + "description": "## Introdução\r\n### Mantenha as configurações padrão, a menos que compreenda totalmente o significado das seguintes opções.\r\n### Modo de Controlo\r\n- Automático: Quando existir um hub Xiaomi disponível na rede local, o Home Assistant irá priorizar o envio de comandos de controlo através do hub para permitir controlo local. Se não houver hub na rede local, irá tentar enviar comandos de controlo através do protocolo Xiaomi OT. Apenas quando estas condições de controlo local não forem satisfeitas, os comandos serão enviados através da nuvem.\r\n- Nuvem: Os comandos de controlo são enviados exclusivamente através da nuvem.\r\n### Filtragem de Dispositivos\r\nFiltre dispositivos indesejados por família.\r\n### Modo de Depuração de Ações\r\nPara métodos definidos por dispositivos MIoT-Spec-V2, além de gerar uma entidade de notificação, também será criada uma entidade de entrada de texto para enviar comandos ao dispositivo durante a depuração.\r\n### Ocultar Entidades Geradas Não Padrão\r\nOculte entidades geradas por instâncias não padrão do MIoT-Spec-V2 cujos nomes começam com \"*\".", "data": { "ctrl_mode": "Modo de Controlo", - "home_infos": "Importar dispositivos da casa", - "area_name_rule": "Modo de sincronização do nome da divisão", - "action_debug": "Modo de depuração de ação", - "hide_non_standard_entities": "Ocultar entidades não padrão" + "action_debug": "Modo de Depuração de Ações", + "hide_non_standard_entities": "Ocultar Entidades Geradas Não Padrão", + "devices_filter": "Filtragem de Dispositivos" + } + }, + "devices_filter": { + "title": "Filtragem de Dispositivos", + "description": "## Introdução\r\nFiltre dispositivos indesejados por família.", + "data": { + "filter_mode": "Modo de Filtro" } } }, @@ -141,4 +156,4 @@ "inconsistent_account": "A informação da conta é inconsistente. Por favor, inicie sessão com a conta correta." } } -} +} \ No newline at end of file diff --git a/custom_components/xiaomi_home/translations/ru.json b/custom_components/xiaomi_home/translations/ru.json index 8418f93..4c4fdf9 100644 --- a/custom_components/xiaomi_home/translations/ru.json +++ b/custom_components/xiaomi_home/translations/ru.json @@ -23,14 +23,29 @@ "description": "Нажмите кнопку «Далее», чтобы повторить попытку" }, "homes_select": { - "title": "Выберите дом и устройства", - "description": "## Инструкция по использованию\r\n### Режим управления\r\n- Авто: Когда в локальной сети доступен центральный шлюз Xiaomi, Home Assistant будет в первую очередь отправлять команды управления устройствами через центральный шлюз для достижения локализованного управления. Если в локальной сети нет центрального шлюза, он попытается отправить команды управления через протокол Xiaomi OT для достижения локализованного управления. Только если вышеуказанные условия локализованного управления не выполняются, команды управления устройствами будут отправляться через облако.\r\n- Облако: Команды управления отправляются только через облако.\r\n### Импорт домашнего устройства\r\nИнтеграция добавит устройства из выбранных домов.\r\n### Режим синхронизации имен комнат\r\nПри синхронизации устройств из приложения Xiaomi Home в Home Assistant имена комнат устройств в Home Assistant будут именоваться в соответствии с именами дома или комнаты в приложении Xiaomi Home.\r\n- Не синхронизировать: устройство не будет добавлено в любую область.\r\n- Другие параметры: область, в которую добавляется устройство, называется именем дома или комнаты в приложении Xiaomi Home.\r\n### Режим отладки Action\r\nДля методов, определенных в MIoT-Spec-V2, помимо создания уведомительной сущности будет создана сущность текстового поля ввода, которую можно использовать для отправки команд управления устройством во время отладки.\r\n### Скрыть нестандартные сущности\r\nСкрыть сущности, созданные нестандартными примерами MIoT-Spec-V2, имена которых начинаются с « * ».\r\n\r\n \r\n### {nick_name} Здравствуйте! Выберите режим управления интеграцией и дом, в котором находятся устройства, которые вы хотите добавить.", + "title": "Выберите семью и устройство", + "description": "## Введение\r\n### Импорт семьи устройства\r\nИнтеграция добавит устройства из выбранной семьи.\r\n### Режим синхронизации имени комнаты\r\nПри синхронизации устройств из приложения Mi Home с Home Assistant, название области в Home Assistant будет следовать следующим правилам. Обратите внимание, что процесс синхронизации не изменит настройки семьи и комнаты в приложении Mi Home.\r\n- Не синхронизировать: Устройство не будет добавлено ни в одну область.\r\n- Другие варианты: Область, в которую добавляется устройство, будет названа в честь имени семьи или комнаты в приложении Mi Home.\r\n### Расширенные настройки\r\nПоказать расширенные настройки для изменения профессиональных параметров конфигурации интеграции.\r\n\r\n \r\n### {nick_name} Здравствуйте! Пожалуйста, выберите семью, в которую вы хотите добавить устройство.", + "data": { + "home_infos": "Импорт семьи устройства", + "area_name_rule": "Режим синхронизации имени комнаты", + "advanced_options": "Расширенные настройки" + } + }, + "advanced_options": { + "title": "Расширенные настройки", + "description": "## Введение\r\n### Сохраняйте настройки по умолчанию, если вы не полностью понимаете смысл следующих опций.\r\n### Режим управления\r\n- Авто: Если в локальной сети доступен шлюз Xiaomi, Home Assistant будет в приоритете отправлять команды управления устройствами через этот шлюз, чтобы обеспечить локальное управление. При отсутствии шлюза осуществляется попытка отправить команды управления через протокол Xiaomi OT. Только при несоблюдении указанных условий локального управления команды отправляются через облако.\r\n- Облако: Команды управления отправляются исключительно через облако.\r\n### Фильтрация устройств\r\nФильтруйте ненужные устройства по семьям.\r\n### Режим отладки действий\r\nДля методов, определённых устройствами MIoT-Spec-V2, помимо сущности уведомления, будет создана сущность текстового ввода, которая позволяет отправлять команды управления устройству во время отладки.\r\n### Скрыть нестандартные сущности\r\nСкрывает сущности, созданные нестандартными экземплярами MIoT-Spec-V2, чьи имена начинаются со «*».", "data": { "ctrl_mode": "Режим управления", - "home_infos": "Импорт домашнего устройства", - "area_name_rule": "Режим синхронизации имен комнат", - "action_debug": "Режим отладки Action", - "hide_non_standard_entities": "Скрыть нестандартные сущности" + "action_debug": "Режим отладки действий", + "hide_non_standard_entities": "Скрыть нестандартные сущности", + "devices_filter": "Фильтрация устройств" + } + }, + "devices_filter": { + "title": "Фильтрация устройств", + "description": "## Введение\r\nФильтруйте ненужные устройства по семьям.", + "data": { + "filter_mode": "Режим фильтрации" } } }, diff --git a/custom_components/xiaomi_home/translations/zh-Hans.json b/custom_components/xiaomi_home/translations/zh-Hans.json index 37b905d..1cdd7a2 100644 --- a/custom_components/xiaomi_home/translations/zh-Hans.json +++ b/custom_components/xiaomi_home/translations/zh-Hans.json @@ -24,13 +24,28 @@ }, "homes_select": { "title": "选择家庭与设备", - "description": "## 使用介绍\r\n### 控制模式\r\n- 自动:本地局域网内存在可用的小米中枢网关时, Home Assistant 会优先通过中枢网关发送设备控制指令,以实现本地化控制功能。本地局域网不存在中枢时,会尝试通过小米OT协议发送控制指令,以实现本地化控制功能。只有当上述本地化控制条件不满足时,设备控制指令才会通过云端发送。\r\n- 云端:控制指令仅通过云端发送。\r\n### 导入设备的家庭\r\n集成将添加已选中家庭中的设备。\r\n### 房间名同步模式\r\n将设备从米家APP同步到 Home Assistant 时,设备在 Home Assistant 中所处区域的名称的命名方式将遵循以下规则。注意,设备同步过程不会改变米家APP中家庭和房间的设置。\r\n- 不同步:设备不会被添加至任何区域。\r\n- 其它选项:设备所添加到的区域以米家APP中的家庭或房间名称命名。\r\n### Action 调试模式\r\n对于设备 MIoT-Spec-V2 定义的方法,在生成通知实体之外,还会生成一个文本输入框实体,您可以在调试时用它向设备发送控制指令。\r\n### 隐藏非标准生成实体\r\n隐藏名称以“*”开头的非标准 MIoT-Spec-V2 实例生成的实体。\r\n\r\n \r\n### {nick_name} 您好!请选择集成控制模式以及您想要添加的设备所处的家庭。", + "description": "## 使用介绍\r\n### 导入设备的家庭\r\n集成将添加已选中家庭中的设备。\r\n### 房间名同步模式\r\n将设备从米家APP同步到 Home Assistant 时,设备在 Home Assistant 中所处区域的名称的命名方式将遵循以下规则。注意,设备同步过程不会改变米家APP中家庭和房间的设置。\r\n- 不同步:设备不会被添加至任何区域。\r\n- 其它选项:设备所添加到的区域以米家APP中的家庭或房间名称命名。\r\n### 高级设置选项\r\n展示高级设置选项,对集成的专业配置选项进行修改。\r\n\r\n \r\n### {nick_name} 您好!请选择您想要添加的设备所处家庭。", "data": { - "ctrl_mode": "控制模式", "home_infos": "导入设备的家庭", "area_name_rule": "房间名同步模式", + "advanced_options": "高级设置选项" + } + }, + "advanced_options": { + "title": "高级设置选项", + "description": "## 使用介绍\r\n### 除非您非常清楚下列选项的含义,否则请保持默认。\r\n### 控制模式\r\n- 自动:本地局域网内存在可用的小米中枢网关时, Home Assistant 会优先通过中枢网关发送设备控制指令,以实现本地化控制功能。本地局域网不存在中枢时,会尝试通过小米OT协议发送控制指令,以实现本地化控制功能。只有当上述本地化控制条件不满足时,设备控制指令才会通过云端发送。\r\n- 云端:控制指令仅通过云端发送。\r\n### 设备过滤\r\n按照家庭维度,过滤不需要的设备。\r\n### Action 调试模式\r\n对于设备 MIoT-Spec-V2 定义的方法,在生成通知实体之外,还会生成一个文本输入框实体,您可以在调试时用它向设备发送控制指令。\r\n### 隐藏非标准生成实体\r\n隐藏名称以“*”开头的非标准 MIoT-Spec-V2 实例生成的实体。", + "data": { + "ctrl_mode": "控制模式", "action_debug": "Action 调试模式", - "hide_non_standard_entities": "隐藏非标准生成实体" + "hide_non_standard_entities": "隐藏非标准生成实体", + "devices_filter": "设备过滤" + } + }, + "devices_filter": { + "title": "设备过滤", + "description": "## 使用介绍\r\n按照家庭维度,过滤不需要的设备。", + "data": { + "filter_mode": "过滤模式" } } }, diff --git a/custom_components/xiaomi_home/translations/zh-Hant.json b/custom_components/xiaomi_home/translations/zh-Hant.json index c8551a0..c711ab2 100644 --- a/custom_components/xiaomi_home/translations/zh-Hant.json +++ b/custom_components/xiaomi_home/translations/zh-Hant.json @@ -24,13 +24,28 @@ }, "homes_select": { "title": "選擇家庭與設備", - "description": "## 使用介紹\r\n### 控制模式\r\n- 自動:本地區域網內存在可用的小米中樞網關時, Home Assistant 會優先通過中樞網關發送設備控制指令,以實現本地化控制功能。本地區域網不存在中樞時,會嘗試通過小米OT協議發送控制指令,以實現本地化控制功能。只有當上述本地化控制條件不滿足時,設備控制指令才會通過雲端發送。\r\n- 雲端:控制指令僅通過雲端發送。\r\n### 導入設備的家庭\r\n集成將添加已選中家庭中的設備。\r\n### 房間名同步模式\r\n將設備從米家APP同步到 Home Assistant 時,設備在 Home Assistant 中所處區域的名稱的命名方式將遵循以下規則。注意,設備同步過程不會改變米家APP中家庭和房間的設置。\r\n- 不同步:設備不會被添加至任何區域。\r\n- 其它選項:設備所添加到的區域以米家APP中的家庭或房間名稱命名。\r\n### Action 調試模式\r\n對於設備 MIoT-Spec-V2 定義的方法,在生成通知實體之外,還會生成一個文本輸入框實體,您可以在調試時用它向設備發送控制指令。\r\n### 隱藏非標準生成實體\r\n隱藏名稱以“*”開頭的非標準 MIoT-Spec-V2 實例生成的實體。\r\n\r\n \r\n### {nick_name} 您好!請選擇集成控制模式以及您想要添加的設備所處的家庭。", + "description": "## 使用介紹\r\n### 導入設備的家庭\r\n集成將添加已選中家庭中的設備。\r\n### 房間名同步模式\r\n將設備從米家APP同步到 Home Assistant 時,設備在 Home Assistant 中所處區域的名稱的命名方式將遵循以下規則。注意,設備同步過程不會改變米家APP中家庭和房間的設置。\r\n- 不同步:設備不會被添加至任何區域。\r\n- 其它選項:設備所添加到的區域以米家APP中的家庭或房間名稱命名。\r\n### 高級設置選項\r\n展示高級設置選項,對集成的專業配置選項進行修改。\r\n\r\n \r\n### {nick_name} 您好!請選擇您想要添加的設備所處家庭。", "data": { - "ctrl_mode": "控制模式", "home_infos": "導入設備的家庭", "area_name_rule": "房間名同步模式", + "advanced_options": "高級設置選項" + } + }, + "advanced_options": { + "title": "高級設置選項", + "description": "## 使用介紹\r\n### 除非您非常清楚下列選項的含義,否則請保持默認。\r\n### 控制模式\r\n- 自動:本地區域網內存在可用的小米中樞網關時,Home Assistant 會優先通過中樞網關發送設備控制指令,以實現本地化控制功能。本地區域網不存在中樞時,會嘗試通過小米OT協議發送控制指令,以實現本地化控制功能。只有當上述本地化控制條件不滿足時,設備控制指令才會通過雲端發送。\r\n- 雲端:控制指令僅通過雲端發送。\r\n### 設備過濾\r\n按照家庭維度,過濾不需要的設備。\r\n### Action 調試模式\r\n對於設備 MIoT-Spec-V2 定義的方法,在生成通知實體之外,還會生成一個文本輸入框實體,您可以在調試時用它向設備發送控制指令。\r\n### 隱藏非標準生成實體\r\n隱藏名稱以“*”開頭的非標準 MIoT-Spec-V2 實例生成的實體。", + "data": { + "ctrl_mode": "控制模式", "action_debug": "Action 調試模式", - "hide_non_standard_entities": "隱藏非標準生成實體" + "hide_non_standard_entities": "隱藏非標準生成實體", + "devices_filter": "設備過濾" + } + }, + "devices_filter": { + "title": "設備過濾", + "description": "## 使用介紹\r\n按照家庭維度,過濾不需要的設備。", + "data": { + "filter_mode": "過濾模式" } } }, From 8429899669e0f24d224ff94455c422951203da30 Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 20:10:13 +0800 Subject: [PATCH 02/10] doc: update translations and i18n --- .../xiaomi_home/miot/i18n/de.json | 7 ++++--- .../xiaomi_home/miot/i18n/en.json | 7 ++++--- .../xiaomi_home/miot/i18n/es.json | 7 ++++--- .../xiaomi_home/miot/i18n/fr.json | 7 ++++--- .../xiaomi_home/miot/i18n/ja.json | 7 ++++--- .../xiaomi_home/miot/i18n/nl.json | 7 ++++--- .../xiaomi_home/miot/i18n/pt-BR.json | 7 ++++--- .../xiaomi_home/miot/i18n/pt.json | 7 ++++--- .../xiaomi_home/miot/i18n/ru.json | 7 ++++--- .../xiaomi_home/miot/i18n/zh-Hans.json | 16 +++++++++++----- .../xiaomi_home/miot/i18n/zh-Hant.json | 7 ++++--- .../xiaomi_home/translations/de.json | 4 ++-- .../xiaomi_home/translations/en.json | 6 +++--- .../xiaomi_home/translations/es.json | 6 +++--- .../xiaomi_home/translations/fr.json | 6 +++--- .../xiaomi_home/translations/ja.json | 6 +++--- .../xiaomi_home/translations/nl.json | 6 +++--- .../xiaomi_home/translations/pt-BR.json | 6 +++--- .../xiaomi_home/translations/pt.json | 6 +++--- .../xiaomi_home/translations/ru.json | 4 ++-- .../xiaomi_home/translations/zh-Hans.json | 19 +++++++++++++------ .../xiaomi_home/translations/zh-Hant.json | 6 +++--- 22 files changed, 92 insertions(+), 69 deletions(-) diff --git a/custom_components/xiaomi_home/miot/i18n/de.json b/custom_components/xiaomi_home/miot/i18n/de.json index 04103d6..66ba583 100644 --- a/custom_components/xiaomi_home/miot/i18n/de.json +++ b/custom_components/xiaomi_home/miot/i18n/de.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "Geräte", - "found_central_gateway": ", lokales zentrales Gateway gefunden" + "found_central_gateway": ", lokales zentrales Gateway gefunden", + "without_room": "Kein Raum zugewiesen" }, "control_mode": { "auto": "automatisch", "cloud": "Cloud" }, "filter_mode": { - "include": "einschließen", - "exclude": "ausschließen" + "exclude": "ausschließen", + "include": "einschließen" }, "room_name_rule": { "none": "nicht synchronisieren", diff --git a/custom_components/xiaomi_home/miot/i18n/en.json b/custom_components/xiaomi_home/miot/i18n/en.json index d8fb68d..b10a1f3 100644 --- a/custom_components/xiaomi_home/miot/i18n/en.json +++ b/custom_components/xiaomi_home/miot/i18n/en.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "Devices", - "found_central_gateway": ", Found Local Central Hub Gateway" + "found_central_gateway": ", Found Local Central Hub Gateway", + "without_room": "No room assigned" }, "control_mode": { "auto": "Auto", "cloud": "Cloud" }, "filter_mode": { - "include": "Include", - "exclude": "Exclude" + "exclude": "Exclude", + "include": "Include" }, "room_name_rule": { "none": "Do not synchronize", diff --git a/custom_components/xiaomi_home/miot/i18n/es.json b/custom_components/xiaomi_home/miot/i18n/es.json index 8effc97..e87e86f 100644 --- a/custom_components/xiaomi_home/miot/i18n/es.json +++ b/custom_components/xiaomi_home/miot/i18n/es.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "dispositivos", - "found_central_gateway": ", se encontró la puerta de enlace central local" + "found_central_gateway": ", se encontró la puerta de enlace central local", + "without_room": "Sin habitación asignada" }, "control_mode": { "auto": "automático", "cloud": "nube" }, "filter_mode": { - "include": "incluir", - "exclude": "excluir" + "exclude": "excluir", + "include": "incluir" }, "room_name_rule": { "none": "no sincronizar", diff --git a/custom_components/xiaomi_home/miot/i18n/fr.json b/custom_components/xiaomi_home/miot/i18n/fr.json index f8b6caa..0e6945d 100644 --- a/custom_components/xiaomi_home/miot/i18n/fr.json +++ b/custom_components/xiaomi_home/miot/i18n/fr.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "appareils", - "found_central_gateway": ", passerelle centrale locale trouvée" + "found_central_gateway": ", passerelle centrale locale trouvée", + "without_room": "Aucune pièce attribuée" }, "control_mode": { "auto": "automatique", "cloud": "cloud" }, "filter_mode": { - "include": "inclure", - "exclude": "exclure" + "exclude": "exclure", + "include": "inclure" }, "room_name_rule": { "none": "ne pas synchroniser", diff --git a/custom_components/xiaomi_home/miot/i18n/ja.json b/custom_components/xiaomi_home/miot/i18n/ja.json index c0d51b9..70b1477 100644 --- a/custom_components/xiaomi_home/miot/i18n/ja.json +++ b/custom_components/xiaomi_home/miot/i18n/ja.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "デバイス", - "found_central_gateway": "、ローカル中央ゲートウェイが見つかりました" + "found_central_gateway": "、ローカル中央ゲートウェイが見つかりました", + "without_room": "部屋が割り当てられていません" }, "control_mode": { "auto": "自動", "cloud": "クラウド" }, "filter_mode": { - "include": "含む", - "exclude": "除外" + "exclude": "除外", + "include": "含む" }, "room_name_rule": { "none": "同期しない", diff --git a/custom_components/xiaomi_home/miot/i18n/nl.json b/custom_components/xiaomi_home/miot/i18n/nl.json index bc81b20..7aeb26e 100644 --- a/custom_components/xiaomi_home/miot/i18n/nl.json +++ b/custom_components/xiaomi_home/miot/i18n/nl.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "Apparaten", - "found_central_gateway": ", Lokale centrale hub-gateway gevonden" + "found_central_gateway": ", Lokale centrale hub-gateway gevonden", + "without_room": "Niet toegewezen kamer" }, "control_mode": { "auto": "Automatisch", "cloud": "Cloud" }, "filter_mode": { - "include": "Inclusief", - "exclude": "Uitsluiten" + "exclude": "Uitsluiten", + "include": "Inclusief" }, "room_name_rule": { "none": "Niet synchroniseren", diff --git a/custom_components/xiaomi_home/miot/i18n/pt-BR.json b/custom_components/xiaomi_home/miot/i18n/pt-BR.json index 54ae478..957b229 100644 --- a/custom_components/xiaomi_home/miot/i18n/pt-BR.json +++ b/custom_components/xiaomi_home/miot/i18n/pt-BR.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "dispositivos", - "found_central_gateway": "encontrado o gateway central local" + "found_central_gateway": "encontrado o gateway central local", + "without_room": "sem quarto atribuído" }, "control_mode": { "auto": "automático", "cloud": "nuvem" }, "filter_mode": { - "include": "incluir", - "exclude": "excluir" + "exclude": "excluir", + "include": "incluir" }, "room_name_rule": { "none": "não sincronizado", diff --git a/custom_components/xiaomi_home/miot/i18n/pt.json b/custom_components/xiaomi_home/miot/i18n/pt.json index 0dd732f..1620b98 100644 --- a/custom_components/xiaomi_home/miot/i18n/pt.json +++ b/custom_components/xiaomi_home/miot/i18n/pt.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "dispositivos", - "found_central_gateway": ", encontrou a central de gateway local" + "found_central_gateway": ", encontrou a central de gateway local", + "without_room": "Sem quarto atribuído" }, "control_mode": { "auto": "Automático", "cloud": "Nuvem" }, "filter_mode": { - "include": "Incluir", - "exclude": "Excluir" + "exclude": "Excluir", + "include": "Incluir" }, "room_name_rule": { "none": "Não sincronizar", diff --git a/custom_components/xiaomi_home/miot/i18n/ru.json b/custom_components/xiaomi_home/miot/i18n/ru.json index c922212..703c048 100644 --- a/custom_components/xiaomi_home/miot/i18n/ru.json +++ b/custom_components/xiaomi_home/miot/i18n/ru.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "устройства", - "found_central_gateway": ", найден локальный центральный шлюз" + "found_central_gateway": ", найден локальный центральный шлюз", + "without_room": "без комнаты" }, "control_mode": { "auto": "автоматический", "cloud": "облако" }, "filter_mode": { - "include": "включить", - "exclude": "исключить" + "exclude": "исключить", + "include": "включить" }, "room_name_rule": { "none": "не синхронизировать", diff --git a/custom_components/xiaomi_home/miot/i18n/zh-Hans.json b/custom_components/xiaomi_home/miot/i18n/zh-Hans.json index b2bca90..f8f3c40 100644 --- a/custom_components/xiaomi_home/miot/i18n/zh-Hans.json +++ b/custom_components/xiaomi_home/miot/i18n/zh-Hans.json @@ -2,22 +2,28 @@ "config": { "other": { "devices": "个设备", - "found_central_gateway": ",发现本地中枢网关" + "found_central_gateway": ",发现本地中枢网关", + "without_room": "未分配房间" }, "control_mode": { "auto": "自动", "cloud": "云端" }, - "filter_mode": { - "include": "包含", - "exclude": "排除" - }, "room_name_rule": { "none": "不同步", "home_room": "家庭名 和 房间名 (米家 卧室)", "room": "房间名 (卧室)", "home": "家庭名 (米家)" }, + "filter_mode": { + "exclude": "排除", + "include": "包含" + }, + "connect_type": { + "0": "WiFi设备", + "1": "蓝牙设备", + "2": "其它类型" + }, "option_status": { "enable": "启用", "disable": "禁用" diff --git a/custom_components/xiaomi_home/miot/i18n/zh-Hant.json b/custom_components/xiaomi_home/miot/i18n/zh-Hant.json index 901e5c0..5c7ef79 100644 --- a/custom_components/xiaomi_home/miot/i18n/zh-Hant.json +++ b/custom_components/xiaomi_home/miot/i18n/zh-Hant.json @@ -2,15 +2,16 @@ "config": { "other": { "devices": "個設備", - "found_central_gateway": ",發現本地中樞網關" + "found_central_gateway": ",發現本地中樞網關", + "without_room": "未分配房間" }, "control_mode": { "auto": "自動", "cloud": "雲端" }, "filter_mode": { - "include": "包含", - "exclude": "排除" + "exclude": "排除", + "include": "包含" }, "room_name_rule": { "none": "不同步", diff --git a/custom_components/xiaomi_home/translations/de.json b/custom_components/xiaomi_home/translations/de.json index 47254b6..05d8293 100644 --- a/custom_components/xiaomi_home/translations/de.json +++ b/custom_components/xiaomi_home/translations/de.json @@ -35,10 +35,10 @@ "title": "Erweiterte Einstellungen", "description": "## Einführung\r\n### Behalten Sie die Standardeinstellungen bei, es sei denn, Sie verstehen die folgenden Optionen vollständig.\r\n### Steuerungsmodus\r\n- Automatisch: Wenn ein verfügbarer Xiaomi-Hub im lokalen Netzwerk vorhanden ist, priorisiert Home Assistant das Senden von Steuerbefehlen über den Hub, um eine lokale Steuerung zu ermöglichen. Wenn kein Hub vorhanden ist, wird versucht, Steuerbefehle über das Xiaomi-OT-Protokoll zu senden. Nur wenn diese Bedingungen für die lokale Steuerung nicht erfüllt sind, werden die Befehle über die Cloud gesendet.\r\n- Cloud: Steuerbefehle werden ausschließlich über die Cloud gesendet.\r\n### Gerätefilterung\r\nFiltern Sie unerwünschte Geräte nach Familien.\r\n### Action-Debug-Modus\r\nFür Methoden, die von MIoT-Spec-V2-Geräten definiert werden, wird neben der Benachrichtigungsentität auch eine Texteingabe-Entität erstellt, mit der Sie während des Debuggens Steuerbefehle an das Gerät senden können.\r\n### Nicht standardmäßige Entitäten ausblenden\r\nBlendet Entitäten aus, die von nicht-standardmäßigen MIoT-Spec-V2-Instanzen generiert werden und deren Name mit „*“ beginnt.", "data": { + "devices_filter": "Gerätefilterung", "ctrl_mode": "Steuerungsmodus", "action_debug": "Action-Debug-Modus", - "hide_non_standard_entities": "Nicht standardmäßige Entitäten ausblenden", - "devices_filter": "Gerätefilterung" + "hide_non_standard_entities": "Nicht standardmäßige Entitäten ausblenden" } }, "devices_filter": { diff --git a/custom_components/xiaomi_home/translations/en.json b/custom_components/xiaomi_home/translations/en.json index d8e11d5..7e1dcd8 100644 --- a/custom_components/xiaomi_home/translations/en.json +++ b/custom_components/xiaomi_home/translations/en.json @@ -35,14 +35,14 @@ "title": "Advanced Settings", "description": "## Introduction\r\n### Keep the default settings unless you fully understand the following options.\r\n### Control Mode\r\n- Auto: When a Xiaomi hub is available on the local network, Home Assistant will prioritize sending device control commands through the hub for local control. If there is no hub, it will attempt to send commands via the Xiaomi OT protocol. Only if those local control conditions are not met will commands be sent through the cloud.\r\n- Cloud: Control commands are sent exclusively through the cloud.\r\n### Device Filtering\r\nFilter out unwanted devices by family.\r\n### Action Debug Mode\r\nFor methods defined by MIoT-Spec-V2 devices, besides generating a notification entity, a text input entity will also be created so you can send control commands to the device during debugging.\r\n### Hide Non-Standard Generated Entities\r\nHide entities generated by non-standard MIoT-Spec-V2 instances whose names start with \"*\".", "data": { + "devices_filter": "Filter Devices", "ctrl_mode": "Control Mode", "action_debug": "Action Debug Mode", - "hide_non_standard_entities": "Hide Non-Standard Generated Entities", - "devices_filter": "Device Filtering" + "hide_non_standard_entities": "Hide Non-Standard Generated Entities" } }, "devices_filter": { - "title": "Device Filtering", + "title": "Filter Devices", "description": "## Introduction\r\nFilter out unwanted devices by family.", "data": { "filter_mode": "Filter Mode" diff --git a/custom_components/xiaomi_home/translations/es.json b/custom_components/xiaomi_home/translations/es.json index c15adcd..4adc364 100644 --- a/custom_components/xiaomi_home/translations/es.json +++ b/custom_components/xiaomi_home/translations/es.json @@ -35,14 +35,14 @@ "title": "Opciones Avanzadas", "description": "## Introducción\r\n### Mantenga la configuración predeterminada a menos que conozca completamente el significado de las siguientes opciones.\r\n### Modo de Control\r\n- Automático: Cuando haya un hub Xiaomi disponible en la red local, Home Assistant priorizará el envío de comandos de control a través del hub para lograr un control local. Si no hay un hub, intentará enviar los comandos a través del protocolo Xiaomi OT. Solo si no se cumplen esas condiciones de control local, los comandos se enviarán a través de la nube.\r\n- Nube: Los comandos se envían exclusivamente a través de la nube.\r\n### Filtrado de Dispositivos\r\nFiltre dispositivos no deseados por familia.\r\n### Modo de Depuración de Acciones\r\nPara los métodos definidos por dispositivos MIoT-Spec-V2, además de generar una entidad de notificación, se creará una entidad de entrada de texto para que pueda enviar comandos de control durante la depuración.\r\n### Ocultar Entidades Generadas No Estándar\r\nOculte entidades generadas por instancias no estándar de MIoT-Spec-V2 cuyos nombres comiencen con \"*\".", "data": { + "devices_filter": "Filtrar Dispositivos", "ctrl_mode": "Modo de Control", "action_debug": "Modo de Depuración de Acciones", - "hide_non_standard_entities": "Ocultar Entidades Generadas No Estándar", - "devices_filter": "Filtrado de Dispositivos" + "hide_non_standard_entities": "Ocultar Entidades Generadas No Estándar" } }, "devices_filter": { - "title": "Filtrado de Dispositivos", + "title": "Filtrar Dispositivos", "description": "## Introducción\r\nFiltre dispositivos no deseados por familia.", "data": { "filter_mode": "Modo de Filtrado" diff --git a/custom_components/xiaomi_home/translations/fr.json b/custom_components/xiaomi_home/translations/fr.json index 2e589b6..362968c 100644 --- a/custom_components/xiaomi_home/translations/fr.json +++ b/custom_components/xiaomi_home/translations/fr.json @@ -35,14 +35,14 @@ "title": "Paramètres Avancés", "description": "## Introduction\r\n### Conservez les paramètres par défaut à moins de comprendre parfaitement la signification des options ci-dessous.\r\n### Mode de Contrôle\r\n- Automatique : Lorsqu’un hub Xiaomi est disponible sur le réseau local, Home Assistant privilégie l’envoi de commandes via ce hub pour un contrôle local. S’il n’y a pas de hub, il tentera d’envoyer des commandes via le protocole Xiaomi OT. Ce n’est que si les conditions de contrôle local ne sont pas remplies que les commandes seront envoyées via le cloud.\r\n- Cloud : Les commandes sont envoyées exclusivement via le cloud.\r\n### Filtrage des Appareils\r\nFiltrez les appareils indésirables en fonction de la famille.\r\n### Mode de Débogage d’Actions\r\nPour les méthodes définies par les appareils MIoT-Spec-V2, en plus de générer une entité de notification, une entité de saisie de texte sera créée pour envoyer des commandes de contrôle pendant le débogage.\r\n### Masquer les Entités Non Standard\r\nMasquez les entités générées par des instances MIoT-Spec-V2 non standard dont le nom commence par « * ».", "data": { + "devices_filter": "Filtrer les Appareils", "ctrl_mode": "Mode de Contrôle", "action_debug": "Mode de Débogage d’Actions", - "hide_non_standard_entities": "Masquer les Entités Non Standard", - "devices_filter": "Filtrage des Appareils" + "hide_non_standard_entities": "Masquer les Entités Non Standard" } }, "devices_filter": { - "title": "Filtrage des Appareils", + "title": "Filtrer les Appareils", "description": "## Introduction\r\nFiltrez les appareils indésirables en fonction de la famille.", "data": { "filter_mode": "Mode de Filtrage" diff --git a/custom_components/xiaomi_home/translations/ja.json b/custom_components/xiaomi_home/translations/ja.json index bffdaa0..8c343c8 100644 --- a/custom_components/xiaomi_home/translations/ja.json +++ b/custom_components/xiaomi_home/translations/ja.json @@ -35,14 +35,14 @@ "title": "高度な設定オプション", "description": "## 紹介\r\n### 以下のオプションの意味を十分に理解していない限り、デフォルト設定のままにしてください。\r\n### コントロールモード\r\n- 自動: ローカルネットワークに利用可能なXiaomiハブがある場合、Home Assistantはローカル制御を実現するためにハブを介してデバイス制御コマンドを優先的に送信します。ハブが存在しない場合は、Xiaomi OTプロトコルを介して制御コマンドを送信しようとします。これらのローカル制御条件が満たされない場合のみ、クラウド経由でコマンドが送信されます。\r\n- クラウド: コマンドはクラウド経由でのみ送信されます。\r\n### デバイスフィルタ\r\n不要なデバイスをファミリー単位でフィルタリングします。\r\n### Actionデバッグモード\r\nMIoT-Spec-V2デバイスで定義されたメソッドについては、通知エンティティに加えてテキスト入力エンティティも生成され、デバッグ時にデバイスへ制御コマンドを送信できます。\r\n### 非標準生成エンティティを隠す\r\n名前が「*」で始まる、非標準のMIoT-Spec-V2インスタンスによって生成されたエンティティを隠します。", "data": { + "devices_filter": "デバイスをフィルタリング", "ctrl_mode": "コントロールモード", "action_debug": "Actionデバッグモード", - "hide_non_standard_entities": "非標準生成エンティティを隠す", - "devices_filter": "デバイスフィルタ" + "hide_non_standard_entities": "非標準生成エンティティを隠す" } }, "devices_filter": { - "title": "デバイスフィルタ", + "title": "デバイスをフィルタリング", "description": "## 使い方\r\n不要なデバイスをファミリー単位でフィルタリングします。", "data": { "filter_mode": "フィルターモード" diff --git a/custom_components/xiaomi_home/translations/nl.json b/custom_components/xiaomi_home/translations/nl.json index ad257c3..b67f408 100644 --- a/custom_components/xiaomi_home/translations/nl.json +++ b/custom_components/xiaomi_home/translations/nl.json @@ -35,14 +35,14 @@ "title": "Geavanceerde Instellingen", "description": "## Inleiding\r\n### Houd de standaardinstellingen aan, tenzij u de betekenis van de volgende opties volledig begrijpt.\r\n### Besturingsmodus\r\n- Automatisch: Wanneer er een beschikbare Xiaomi-hub in het lokale netwerk is, zal Home Assistant voorrang geven aan het verzenden van besturingsopdrachten via de hub voor lokale besturing. Als er geen hub beschikbaar is, zal het proberen besturingsopdrachten te verzenden via het Xiaomi OT-protocol. Alleen als aan deze lokale besturingsvoorwaarden niet wordt voldaan, worden de opdrachten via de cloud verzonden.\r\n- Cloud: Besturingsopdrachten worden uitsluitend via de cloud verzonden.\r\n### Apparaatfiltering\r\nFilter ongewenste apparaten per familie.\r\n### Actie-debugmodus\r\nVoor methoden gedefinieerd door MIoT-Spec-V2-apparaten wordt, naast een meldingsentiteit, ook een tekstinvoerentiteit gemaakt waarmee u tijdens het debuggen besturingsopdrachten naar het apparaat kunt sturen.\r\n### Niet-standaard entiteiten verbergen\r\nVerberg entiteiten die door niet-standaard MIoT-Spec-V2-instanties worden gegenereerd en waarvan de naam begint met \"*\".", "data": { + "devices_filter": "Apparaten filteren", "ctrl_mode": "Besturingsmodus", "action_debug": "Actie-debugmodus", - "hide_non_standard_entities": "Niet-standaard entiteiten verbergen", - "devices_filter": "Apparaatfiltering" + "hide_non_standard_entities": "Niet-standaard entiteiten verbergen" } }, "devices_filter": { - "title": "Apparaatfiltering", + "title": "Apparaten filteren", "description": "## Inleiding\r\nFilter ongewenste apparaten per familie.", "data": { "filter_mode": "Filtermodus" diff --git a/custom_components/xiaomi_home/translations/pt-BR.json b/custom_components/xiaomi_home/translations/pt-BR.json index 4fcf47c..ceef23f 100644 --- a/custom_components/xiaomi_home/translations/pt-BR.json +++ b/custom_components/xiaomi_home/translations/pt-BR.json @@ -35,14 +35,14 @@ "title": "Configurações Avançadas", "description": "## Introdução\r\n### Mantenha as configurações padrão, a menos que você entenda completamente o significado das seguintes opções.\r\n### Modo de Controle\r\n- Automático: Quando houver um hub Xiaomi disponível na rede local, o Home Assistant priorizará o envio de comandos de controle através do hub para obter controle local. Se não houver hub, tentará enviar comandos de controle pelo protocolo Xiaomi OT. Somente se essas condições de controle local não forem atendidas, os comandos serão enviados através da nuvem.\r\n- Nuvem: Os comandos de controle são enviados exclusivamente pela nuvem.\r\n### Filtragem de Dispositivos\r\nFiltre dispositivos indesejados por família.\r\n### Modo de Depuração de Ações\r\nPara métodos definidos por dispositivos MIoT-Spec-V2, além de gerar uma entidade de notificação, será criada uma entidade de entrada de texto para que você possa enviar comandos de controle ao dispositivo durante a depuração.\r\n### Ocultar Entidades Geradas Não Padrão\r\nOculte entidades geradas por instâncias não padrão do MIoT-Spec-V2 cujos nomes começam com \"*\".", "data": { + "devices_filter": "Filtrar Dispositivos", "ctrl_mode": "Modo de Controle", "action_debug": "Modo de Depuração de Ações", - "hide_non_standard_entities": "Ocultar Entidades Geradas Não Padrão", - "devices_filter": "Filtragem de Dispositivos" + "hide_non_standard_entities": "Ocultar Entidades Geradas Não Padrão" } }, "devices_filter": { - "title": "Filtragem de Dispositivos", + "title": "Filtrar Dispositivos", "description": "## Introdução\r\nFiltre dispositivos indesejados por família.", "data": { "filter_mode": "Modo de Filtro" diff --git a/custom_components/xiaomi_home/translations/pt.json b/custom_components/xiaomi_home/translations/pt.json index 02f883d..5784a6f 100644 --- a/custom_components/xiaomi_home/translations/pt.json +++ b/custom_components/xiaomi_home/translations/pt.json @@ -35,14 +35,14 @@ "title": "Opções Avançadas", "description": "## Introdução\r\n### Mantenha as configurações padrão, a menos que compreenda totalmente o significado das seguintes opções.\r\n### Modo de Controlo\r\n- Automático: Quando existir um hub Xiaomi disponível na rede local, o Home Assistant irá priorizar o envio de comandos de controlo através do hub para permitir controlo local. Se não houver hub na rede local, irá tentar enviar comandos de controlo através do protocolo Xiaomi OT. Apenas quando estas condições de controlo local não forem satisfeitas, os comandos serão enviados através da nuvem.\r\n- Nuvem: Os comandos de controlo são enviados exclusivamente através da nuvem.\r\n### Filtragem de Dispositivos\r\nFiltre dispositivos indesejados por família.\r\n### Modo de Depuração de Ações\r\nPara métodos definidos por dispositivos MIoT-Spec-V2, além de gerar uma entidade de notificação, também será criada uma entidade de entrada de texto para enviar comandos ao dispositivo durante a depuração.\r\n### Ocultar Entidades Geradas Não Padrão\r\nOculte entidades geradas por instâncias não padrão do MIoT-Spec-V2 cujos nomes começam com \"*\".", "data": { + "devices_filter": "Filtrar Dispositivos", "ctrl_mode": "Modo de Controlo", "action_debug": "Modo de Depuração de Ações", - "hide_non_standard_entities": "Ocultar Entidades Geradas Não Padrão", - "devices_filter": "Filtragem de Dispositivos" + "hide_non_standard_entities": "Ocultar Entidades Geradas Não Padrão" } }, "devices_filter": { - "title": "Filtragem de Dispositivos", + "title": "Filtrar Dispositivos", "description": "## Introdução\r\nFiltre dispositivos indesejados por família.", "data": { "filter_mode": "Modo de Filtro" diff --git a/custom_components/xiaomi_home/translations/ru.json b/custom_components/xiaomi_home/translations/ru.json index 4c4fdf9..32b8def 100644 --- a/custom_components/xiaomi_home/translations/ru.json +++ b/custom_components/xiaomi_home/translations/ru.json @@ -35,10 +35,10 @@ "title": "Расширенные настройки", "description": "## Введение\r\n### Сохраняйте настройки по умолчанию, если вы не полностью понимаете смысл следующих опций.\r\n### Режим управления\r\n- Авто: Если в локальной сети доступен шлюз Xiaomi, Home Assistant будет в приоритете отправлять команды управления устройствами через этот шлюз, чтобы обеспечить локальное управление. При отсутствии шлюза осуществляется попытка отправить команды управления через протокол Xiaomi OT. Только при несоблюдении указанных условий локального управления команды отправляются через облако.\r\n- Облако: Команды управления отправляются исключительно через облако.\r\n### Фильтрация устройств\r\nФильтруйте ненужные устройства по семьям.\r\n### Режим отладки действий\r\nДля методов, определённых устройствами MIoT-Spec-V2, помимо сущности уведомления, будет создана сущность текстового ввода, которая позволяет отправлять команды управления устройству во время отладки.\r\n### Скрыть нестандартные сущности\r\nСкрывает сущности, созданные нестандартными экземплярами MIoT-Spec-V2, чьи имена начинаются со «*».", "data": { + "devices_filter": "Фильтрация устройств", "ctrl_mode": "Режим управления", "action_debug": "Режим отладки действий", - "hide_non_standard_entities": "Скрыть нестандартные сущности", - "devices_filter": "Фильтрация устройств" + "hide_non_standard_entities": "Скрыть нестандартные сущности" } }, "devices_filter": { diff --git a/custom_components/xiaomi_home/translations/zh-Hans.json b/custom_components/xiaomi_home/translations/zh-Hans.json index 1cdd7a2..732bd10 100644 --- a/custom_components/xiaomi_home/translations/zh-Hans.json +++ b/custom_components/xiaomi_home/translations/zh-Hans.json @@ -33,19 +33,26 @@ }, "advanced_options": { "title": "高级设置选项", - "description": "## 使用介绍\r\n### 除非您非常清楚下列选项的含义,否则请保持默认。\r\n### 控制模式\r\n- 自动:本地局域网内存在可用的小米中枢网关时, Home Assistant 会优先通过中枢网关发送设备控制指令,以实现本地化控制功能。本地局域网不存在中枢时,会尝试通过小米OT协议发送控制指令,以实现本地化控制功能。只有当上述本地化控制条件不满足时,设备控制指令才会通过云端发送。\r\n- 云端:控制指令仅通过云端发送。\r\n### 设备过滤\r\n按照家庭维度,过滤不需要的设备。\r\n### Action 调试模式\r\n对于设备 MIoT-Spec-V2 定义的方法,在生成通知实体之外,还会生成一个文本输入框实体,您可以在调试时用它向设备发送控制指令。\r\n### 隐藏非标准生成实体\r\n隐藏名称以“*”开头的非标准 MIoT-Spec-V2 实例生成的实体。", + "description": "## 使用介绍\r\n### 除非您非常清楚下列选项的含义,否则请保持默认。\r\n###筛选设备\r\n支持按照房间名称和设备类型筛选设备,同时也支持设备维度筛选。\r\n### 控制模式\r\n- 自动:本地局域网内存在可用的小米中枢网关时, Home Assistant 会优先通过中枢网关发送设备控制指令,以实现本地化控制功能。本地局域网不存在中枢时,会尝试通过小米OT协议发送控制指令,以实现本地化控制功能。只有当上述本地化控制条件不满足时,设备控制指令才会通过云端发送。\r\n- 云端:控制指令仅通过云端发送。\r\n### 设备过滤\r\n按照家庭维度,过滤不需要的设备。\r\n### Action 调试模式\r\n对于设备 MIoT-Spec-V2 定义的方法,在生成通知实体之外,还会生成一个文本输入框实体,您可以在调试时用它向设备发送控制指令。\r\n### 隐藏非标准生成实体\r\n隐藏名称以“*”开头的非标准 MIoT-Spec-V2 实例生成的实体。", "data": { + "devices_filter": "筛选设备", "ctrl_mode": "控制模式", "action_debug": "Action 调试模式", - "hide_non_standard_entities": "隐藏非标准生成实体", - "devices_filter": "设备过滤" + "hide_non_standard_entities": "隐藏非标准生成实体" } }, "devices_filter": { - "title": "设备过滤", - "description": "## 使用介绍\r\n按照家庭维度,过滤不需要的设备。", + "title": "筛选设备", + "description": "## 使用介绍\r\n#### 支持按照房间名称和设备类型筛选设备,同时也支持设备维度筛选。您也可以进入对应集成项【配置】页面重新筛选。", "data": { - "filter_mode": "过滤模式" + "room_filter_mode": "筛选家庭房间", + "room_list": "家庭房间", + "type_filter_mode": "筛选设备类型", + "type_list": "设备类型", + "model_filter_mode": "筛选设备型号", + "model_list": "设备型号", + "devices_filter_mode": "筛选设备", + "device_list": "设备列表" } } }, diff --git a/custom_components/xiaomi_home/translations/zh-Hant.json b/custom_components/xiaomi_home/translations/zh-Hant.json index c711ab2..f05dc1f 100644 --- a/custom_components/xiaomi_home/translations/zh-Hant.json +++ b/custom_components/xiaomi_home/translations/zh-Hant.json @@ -35,14 +35,14 @@ "title": "高級設置選項", "description": "## 使用介紹\r\n### 除非您非常清楚下列選項的含義,否則請保持默認。\r\n### 控制模式\r\n- 自動:本地區域網內存在可用的小米中樞網關時,Home Assistant 會優先通過中樞網關發送設備控制指令,以實現本地化控制功能。本地區域網不存在中樞時,會嘗試通過小米OT協議發送控制指令,以實現本地化控制功能。只有當上述本地化控制條件不滿足時,設備控制指令才會通過雲端發送。\r\n- 雲端:控制指令僅通過雲端發送。\r\n### 設備過濾\r\n按照家庭維度,過濾不需要的設備。\r\n### Action 調試模式\r\n對於設備 MIoT-Spec-V2 定義的方法,在生成通知實體之外,還會生成一個文本輸入框實體,您可以在調試時用它向設備發送控制指令。\r\n### 隱藏非標準生成實體\r\n隱藏名稱以“*”開頭的非標準 MIoT-Spec-V2 實例生成的實體。", "data": { + "devices_filter": "篩選設備", "ctrl_mode": "控制模式", "action_debug": "Action 調試模式", - "hide_non_standard_entities": "隱藏非標準生成實體", - "devices_filter": "設備過濾" + "hide_non_standard_entities": "隱藏非標準生成實體" } }, "devices_filter": { - "title": "設備過濾", + "title": "篩選設備", "description": "## 使用介紹\r\n按照家庭維度,過濾不需要的設備。", "data": { "filter_mode": "過濾模式" From 4e8361d18acb494b92c0d76471b6876b3ce9bb6c Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 20:11:05 +0800 Subject: [PATCH 03/10] fix: cancel miot http timer --- custom_components/xiaomi_home/miot/miot_cloud.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/custom_components/xiaomi_home/miot/miot_cloud.py b/custom_components/xiaomi_home/miot/miot_cloud.py index 036ea57..4632a6c 100644 --- a/custom_components/xiaomi_home/miot/miot_cloud.py +++ b/custom_components/xiaomi_home/miot/miot_cloud.py @@ -254,6 +254,13 @@ def __init__( self._session = aiohttp.ClientSession(loop=self._main_loop) async def deinit_async(self) -> None: + if self._get_prop_timer: + self._get_prop_timer.cancel() + self._get_prop_timer = None + for item in self._get_prop_list.values(): + fut: asyncio.Future = item.get('fut') + fut.cancel() + self._get_prop_list.clear() if self._session and not self._session.closed: await self._session.close() From b54ec9bff45db21d510611b16d774b45e1dc255a Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 20:11:38 +0800 Subject: [PATCH 04/10] feat: improve devices filter --- custom_components/xiaomi_home/config_flow.py | 95 +++++++++++++++++--- 1 file changed, 82 insertions(+), 13 deletions(-) diff --git a/custom_components/xiaomi_home/config_flow.py b/custom_components/xiaomi_home/config_flow.py index 358432a..a940b1f 100644 --- a/custom_components/xiaomi_home/config_flow.py +++ b/custom_components/xiaomi_home/config_flow.py @@ -121,6 +121,7 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): _home_selected: Optional[dict] _home_info_buffer: Optional[dict[str, str | dict[str, dict]]] _home_list: Optional[dict] + _device_list_sorted: Optional[dict] _cloud_server: Optional[str] _oauth_redirect_url: Optional[str] @@ -155,6 +156,7 @@ def __init__(self) -> None: self._home_selected = {} self._home_info_buffer = None self._home_list = None + self._device_list_sorted = None self._cloud_server = None self._oauth_redirect_url = None @@ -503,23 +505,19 @@ async def async_step_homes_select(self, user_input=None): if dev_info['home_id'] in home_selected} if not devices_list: return await self.display_homes_select_form('no_devices') - devices_list_sort = dict(sorted( + self._device_list_sorted = dict(sorted( devices_list.items(), key=lambda item: item[1].get('home_id', '')+item[1].get('room_id', ''))) + if not await self._miot_storage.save_async( domain='miot_devices', name=f'{self._uid}_{self._cloud_server}', - data=devices_list_sort): + data=self._device_list_sorted): _LOGGER.error( 'save devices async failed, %s, %s', self._uid, self._cloud_server) return await self.display_homes_select_form( 'devices_storage_failed') - if not (await self._miot_storage.update_user_config_async( - uid=self._uid, cloud_server=self._cloud_server, config={ - 'auth_info': self._auth_info - })): - raise MIoTError('miot_storage.update_user_config_async error') if user_input.get('advanced_options', False): return await self.async_step_advanced_options() return await self.config_flow_done() @@ -563,33 +561,104 @@ async def async_step_advanced_options(self, user_input: dict = None): return self.async_show_form( step_id='advanced_options', data_schema=vol.Schema({ + vol.Required('devices_filter', default=False): bool, vol.Required('ctrl_mode', default=DEFAULT_CTRL_MODE): vol.In( self._miot_i18n.translate(key='config.control_mode')), vol.Required('action_debug', default=self._action_debug): bool, vol.Required( 'hide_non_standard_entities', default=self._hide_non_standard_entities): bool, - vol.Required('devices_filter', default=False): bool, + }), last_step=False, ) async def async_step_devices_filter(self, user_input: dict = None): if user_input: + room_list_in: list = user_input.get('room_list', []) + if room_list_in: + room_filter_mode: str = user_input.get('room_filter_mode') + + type_list_in: list = user_input.get('type_list', []) + if type_list_in: + type_filter_mode: str = user_input.get('type_filter_mode') + + model_list_in: list = user_input.get('model_list', []) + if model_list_in: + model_filter_mode: str = user_input.get('model_filter_mode') + + device_list_in: list = user_input.get('device_list', []) + if device_list_in: + devices_filter_mode: str = user_input.get( + 'devices_filter_mode') + return await self.config_flow_done() + tip_devices: str = self._miot_i18n.translate( + key='config.other.devices') + tip_filter_mode: str = self._miot_i18n.translate( + key='config.filter_mode') + tip_connect_type: dict = self._miot_i18n.translate( + key='config.connect_type') + tip_without_room: str = self._miot_i18n.translate( + key='config.other.without_room') + + room_device_count: dict = {} + model_device_count: dict = {} + device_list: dict = {} + for did, info in self._device_list_sorted.items(): + device_list[did] = ( + f'{info["home_name"]} {info["room_name"]} - ' + + f'{info["name"]} - {did}') + room_device_count.setdefault(info['room_id'], 0) + room_device_count[info['room_id']] += 1 + model_device_count.setdefault(info['model'], 0) + model_device_count[info['model']] += 1 + + model_list: dict = {} + for model, count in model_device_count.items(): + model_list[model] = f'{model} [ {count}{tip_devices} ]' + + room_list: dict = {} + for home_id, home_info in self._home_selected.items(): + for room_id, room_name in home_info['room_info'].items(): + if room_id not in room_device_count: + continue + room_list[room_id] = ( + f'{home_info["home_name"]} {room_name}' + f' [ {room_device_count[room_id]}{tip_devices} ]') + if home_id in room_device_count: + room_list[home_id] = ( + f'{home_info["home_name"]} {tip_without_room}' + f' [ {room_device_count[home_id]}{tip_devices} ]') + return self.async_show_form( step_id='devices_filter', data_schema=vol.Schema({ - vol.Required('filter_mode', default='include'): vol.In( - self._miot_i18n.translate(key='config.filter_mode')), - vol.Required('filter_mode', default='include'): vol.In( - self._miot_i18n.translate(key='config.filter_mode')) + vol.Required('room_filter_mode', default='exclude'): + vol.In(tip_filter_mode), + vol.Optional('room_list'): cv.multi_select(room_list), + vol.Required('type_filter_mode', default='exclude'): + vol.In(tip_filter_mode), + vol.Optional('type_list'): cv.multi_select(tip_connect_type), + vol.Required('model_filter_mode', default='exclude'): + vol.In(tip_filter_mode), + vol.Optional('model_list'): cv.multi_select(dict(sorted( + model_list.items(), key=lambda item: item[0]))), + vol.Required('devices_filter_mode', default='exclude'): + vol.In(tip_filter_mode), + vol.Optional('device_list'): cv.multi_select(dict(sorted( + device_list.items(), key=lambda device: device[1]))) }), - last_step=False, + last_step=False ) async def config_flow_done(self): + if not (await self._miot_storage.update_user_config_async( + uid=self._uid, cloud_server=self._cloud_server, config={ + 'auth_info': self._auth_info + })): + raise MIoTError('miot_storage.update_user_config_async error') return self.async_create_entry( title=( f'{self._nick_name}: {self._uid} ' From e0a0b6d22e585ccef1bcb36d64f21a88b4f21b24 Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 20:12:38 +0800 Subject: [PATCH 05/10] doc: update translations/de --- custom_components/xiaomi_home/translations/de.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_home/translations/de.json b/custom_components/xiaomi_home/translations/de.json index 05d8293..ad1f045 100644 --- a/custom_components/xiaomi_home/translations/de.json +++ b/custom_components/xiaomi_home/translations/de.json @@ -35,14 +35,14 @@ "title": "Erweiterte Einstellungen", "description": "## Einführung\r\n### Behalten Sie die Standardeinstellungen bei, es sei denn, Sie verstehen die folgenden Optionen vollständig.\r\n### Steuerungsmodus\r\n- Automatisch: Wenn ein verfügbarer Xiaomi-Hub im lokalen Netzwerk vorhanden ist, priorisiert Home Assistant das Senden von Steuerbefehlen über den Hub, um eine lokale Steuerung zu ermöglichen. Wenn kein Hub vorhanden ist, wird versucht, Steuerbefehle über das Xiaomi-OT-Protokoll zu senden. Nur wenn diese Bedingungen für die lokale Steuerung nicht erfüllt sind, werden die Befehle über die Cloud gesendet.\r\n- Cloud: Steuerbefehle werden ausschließlich über die Cloud gesendet.\r\n### Gerätefilterung\r\nFiltern Sie unerwünschte Geräte nach Familien.\r\n### Action-Debug-Modus\r\nFür Methoden, die von MIoT-Spec-V2-Geräten definiert werden, wird neben der Benachrichtigungsentität auch eine Texteingabe-Entität erstellt, mit der Sie während des Debuggens Steuerbefehle an das Gerät senden können.\r\n### Nicht standardmäßige Entitäten ausblenden\r\nBlendet Entitäten aus, die von nicht-standardmäßigen MIoT-Spec-V2-Instanzen generiert werden und deren Name mit „*“ beginnt.", "data": { - "devices_filter": "Gerätefilterung", + "devices_filter": "Geräte filtern", "ctrl_mode": "Steuerungsmodus", "action_debug": "Action-Debug-Modus", "hide_non_standard_entities": "Nicht standardmäßige Entitäten ausblenden" } }, "devices_filter": { - "title": "Gerätefilterung", + "title": "Geräte filtern", "description": "## Einführung\r\nFiltern Sie unerwünschte Geräte nach Familien.", "data": { "filter_mode": "Filtermodus" From 96b508409236f49ef5336f48e0e9be5e5f7b8261 Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 22:23:50 +0800 Subject: [PATCH 06/10] fix: i18n type error --- custom_components/xiaomi_home/miot/miot_i18n.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_i18n.py b/custom_components/xiaomi_home/miot/miot_i18n.py index 5f11694..152bc08 100644 --- a/custom_components/xiaomi_home/miot/miot_i18n.py +++ b/custom_components/xiaomi_home/miot/miot_i18n.py @@ -71,7 +71,7 @@ def __init__( ) -> None: self._main_loop = loop or asyncio.get_event_loop() self._lang = lang - self._data = None + self._data = {} async def init_async(self) -> None: if self._data: @@ -94,7 +94,7 @@ async def init_async(self) -> None: self._data = data async def deinit_async(self) -> None: - self._data = None + self._data = {} def translate( self, key: str, replace: Optional[dict[str, str]] = None From 4e3fcc9705b8d46a067793089d9b2734e93b5612 Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 22:33:07 +0800 Subject: [PATCH 07/10] feat: config flow support device filter --- custom_components/xiaomi_home/config_flow.py | 82 ++++++++++++++++--- .../xiaomi_home/translations/de.json | 13 ++- .../xiaomi_home/translations/en.json | 11 ++- .../xiaomi_home/translations/es.json | 11 ++- .../xiaomi_home/translations/fr.json | 11 ++- .../xiaomi_home/translations/ja.json | 11 ++- .../xiaomi_home/translations/nl.json | 11 ++- .../xiaomi_home/translations/pt-BR.json | 11 ++- .../xiaomi_home/translations/pt.json | 11 ++- .../xiaomi_home/translations/ru.json | 11 ++- .../xiaomi_home/translations/zh-Hans.json | 2 +- .../xiaomi_home/translations/zh-Hant.json | 11 ++- 12 files changed, 164 insertions(+), 32 deletions(-) diff --git a/custom_components/xiaomi_home/config_flow.py b/custom_components/xiaomi_home/config_flow.py index a940b1f..9f54207 100644 --- a/custom_components/xiaomi_home/config_flow.py +++ b/custom_components/xiaomi_home/config_flow.py @@ -121,7 +121,8 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): _home_selected: Optional[dict] _home_info_buffer: Optional[dict[str, str | dict[str, dict]]] _home_list: Optional[dict] - _device_list_sorted: Optional[dict] + _device_list_sorted: dict + _device_list_filter: dict _cloud_server: Optional[str] _oauth_redirect_url: Optional[str] @@ -573,25 +574,86 @@ async def async_step_advanced_options(self, user_input: dict = None): last_step=False, ) - async def async_step_devices_filter(self, user_input: dict = None): + async def async_step_devices_filter( + self, user_input: Optional[dict] = None + ): if user_input: + # Room filter room_list_in: list = user_input.get('room_list', []) if room_list_in: - room_filter_mode: str = user_input.get('room_filter_mode') - + room_filter_mode: str = user_input.get( + 'room_filter_mode', None) + if room_filter_mode == 'exclude': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if dev_info['room_id'] not in room_list_in} + elif room_filter_mode == 'include': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if dev_info['room_id'] in room_list_in} + # Type filter type_list_in: list = user_input.get('type_list', []) if type_list_in: - type_filter_mode: str = user_input.get('type_filter_mode') - + type_filter_mode: str = user_input.get( + 'type_filter_mode', None) + if type_filter_mode == 'exclude': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if dev_info['connect_type'] not in type_list_in} + elif type_filter_mode == 'include': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if dev_info['connect_type'] in type_list_in} + # Model filter model_list_in: list = user_input.get('model_list', []) if model_list_in: - model_filter_mode: str = user_input.get('model_filter_mode') - + model_filter_mode: str = user_input.get( + 'model_filter_mode', None) + if model_filter_mode == 'exclude': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if dev_info['model'] not in model_list_in} + elif model_filter_mode == 'include': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if dev_info['model'] in model_list_in} + # Device filter device_list_in: list = user_input.get('device_list', []) if device_list_in: devices_filter_mode: str = user_input.get( - 'devices_filter_mode') - + 'devices_filter_mode', None) + if devices_filter_mode == 'exclude': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if did not in device_list_in} + elif devices_filter_mode == 'include': + self._device_list_filter = { + did: dev_info + for did, dev_info in self._device_list_sorted.items() + if did in device_list_in} + else: + raise MIoTError('invalid devices_filter_mode') + self._device_list_sorted = dict(sorted( + self._device_list_filter.items(), key=lambda item: + item[1].get('home_id', '')+item[1].get('room_id', ''))) + if not await self._miot_storage.save_async( + domain='miot_devices', + name=f'{self._uid}_{self._cloud_server}', + data=self._device_list_sorted): + _LOGGER.error( + 'save devices async failed, %s, %s', + self._uid, self._cloud_server) + raise AbortFlow( + reason='config_flow_error', + description_placeholders={ + 'error': 'save devices failed'}) return await self.config_flow_done() tip_devices: str = self._miot_i18n.translate( diff --git a/custom_components/xiaomi_home/translations/de.json b/custom_components/xiaomi_home/translations/de.json index ad1f045..2342d24 100644 --- a/custom_components/xiaomi_home/translations/de.json +++ b/custom_components/xiaomi_home/translations/de.json @@ -33,7 +33,7 @@ }, "advanced_options": { "title": "Erweiterte Einstellungen", - "description": "## Einführung\r\n### Behalten Sie die Standardeinstellungen bei, es sei denn, Sie verstehen die folgenden Optionen vollständig.\r\n### Steuerungsmodus\r\n- Automatisch: Wenn ein verfügbarer Xiaomi-Hub im lokalen Netzwerk vorhanden ist, priorisiert Home Assistant das Senden von Steuerbefehlen über den Hub, um eine lokale Steuerung zu ermöglichen. Wenn kein Hub vorhanden ist, wird versucht, Steuerbefehle über das Xiaomi-OT-Protokoll zu senden. Nur wenn diese Bedingungen für die lokale Steuerung nicht erfüllt sind, werden die Befehle über die Cloud gesendet.\r\n- Cloud: Steuerbefehle werden ausschließlich über die Cloud gesendet.\r\n### Gerätefilterung\r\nFiltern Sie unerwünschte Geräte nach Familien.\r\n### Action-Debug-Modus\r\nFür Methoden, die von MIoT-Spec-V2-Geräten definiert werden, wird neben der Benachrichtigungsentität auch eine Texteingabe-Entität erstellt, mit der Sie während des Debuggens Steuerbefehle an das Gerät senden können.\r\n### Nicht standardmäßige Entitäten ausblenden\r\nBlendet Entitäten aus, die von nicht-standardmäßigen MIoT-Spec-V2-Instanzen generiert werden und deren Name mit „*“ beginnt.", + "description": "## Gebrauchsanweisung\r\n### Behalten Sie die Standardeinstellungen bei, es sei denn, Sie verstehen die folgenden Optionen vollständig.\r\n### Steuerungsmodus\r\n- Automatisch: Wenn ein verfügbarer Xiaomi-Hub im lokalen Netzwerk vorhanden ist, priorisiert Home Assistant das Senden von Steuerbefehlen über den Hub, um eine lokale Steuerung zu ermöglichen. Wenn kein Hub vorhanden ist, wird versucht, Steuerbefehle über das Xiaomi-OT-Protokoll zu senden. Nur wenn diese Bedingungen für die lokale Steuerung nicht erfüllt sind, werden die Befehle über die Cloud gesendet.\r\n- Cloud: Steuerbefehle werden ausschließlich über die Cloud gesendet.\r\n### Gerätefilterung\r\nFiltern Sie unerwünschte Geräte nach Familien.\r\n### Action-Debug-Modus\r\nFür Methoden, die von MIoT-Spec-V2-Geräten definiert werden, wird neben der Benachrichtigungsentität auch eine Texteingabe-Entität erstellt, mit der Sie während des Debuggens Steuerbefehle an das Gerät senden können.\r\n### Nicht standardmäßige Entitäten ausblenden\r\nBlendet Entitäten aus, die von nicht-standardmäßigen MIoT-Spec-V2-Instanzen generiert werden und deren Name mit „*“ beginnt.", "data": { "devices_filter": "Geräte filtern", "ctrl_mode": "Steuerungsmodus", @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Geräte filtern", - "description": "## Einführung\r\nFiltern Sie unerwünschte Geräte nach Familien.", + "description": "## Gebrauchsanweisung\r\n- Unterstützt das Filtern von Geräten nach Raumnamen und Gerätetypen sowie das Filtern nach Gerätedimensionen.\r\n- Sie können auch die entsprechende Integrationsoption \"Konfiguration> Geräteliste aktualisieren\" aufrufen, um die Filterung erneut durchzuführen.", "data": { - "filter_mode": "Filtermodus" + "room_filter_mode": "Familienraum filtern", + "room_list": "Familienraum", + "type_filter_mode": "Gerätetyp filtern", + "type_list": "Gerätetyp", + "model_filter_mode": "Gerätemodell filtern", + "model_list": "Gerätemodell", + "devices_filter_mode": "Geräte filtern", + "device_list": "Geräteliste" } } }, diff --git a/custom_components/xiaomi_home/translations/en.json b/custom_components/xiaomi_home/translations/en.json index 7e1dcd8..391bd47 100644 --- a/custom_components/xiaomi_home/translations/en.json +++ b/custom_components/xiaomi_home/translations/en.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Filter Devices", - "description": "## Introduction\r\nFilter out unwanted devices by family.", + "description": "## Introduction\r\n- Supports filtering devices by room name and device type, and also supports device dimension filtering.\r\n- You can also re-filter on the corresponding integration page [Configuration>Update Device List].", "data": { - "filter_mode": "Filter Mode" + "room_filter_mode": "Filter Family Rooms", + "room_list": "Family Rooms", + "type_filter_mode": "Filter Device Type", + "type_list": "Device Type", + "model_filter_mode": "Filter Device Model", + "model_list": "Device Model", + "devices_filter_mode": "Filter Devices", + "device_list": "Device List" } } }, diff --git a/custom_components/xiaomi_home/translations/es.json b/custom_components/xiaomi_home/translations/es.json index 4adc364..27b9fdc 100644 --- a/custom_components/xiaomi_home/translations/es.json +++ b/custom_components/xiaomi_home/translations/es.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Filtrar Dispositivos", - "description": "## Introducción\r\nFiltre dispositivos no deseados por familia.", + "description": "## Introducción\r\n- Admite la filtración de dispositivos por nombre de habitación y tipo de dispositivo, y también admite la filtración por familia.\r\n- También puede volver a filtrar en la página correspondiente de la integración [Configuración>Actualizar lista de dispositivos].", "data": { - "filter_mode": "Modo de Filtrado" + "room_filter_mode": "Filtrar Habitaciones de la Familia", + "room_list": "Habitaciones de la Familia", + "type_filter_mode": "Filtrar Tipo de Dispositivo", + "type_list": "Tipo de Dispositivo", + "model_filter_mode": "Filtrar Modelo de Dispositivo", + "model_list": "Modelo de Dispositivo", + "devices_filter_mode": "Filtrar Dispositivos", + "device_list": "Lista de Dispositivos" } } }, diff --git a/custom_components/xiaomi_home/translations/fr.json b/custom_components/xiaomi_home/translations/fr.json index 362968c..ef33855 100644 --- a/custom_components/xiaomi_home/translations/fr.json +++ b/custom_components/xiaomi_home/translations/fr.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Filtrer les Appareils", - "description": "## Introduction\r\nFiltrez les appareils indésirables en fonction de la famille.", + "description": "## Introduction\r\n- Prend en charge le filtrage des appareils en fonction du nom de la pièce et du type d'appareil, ainsi que le filtrage basé sur les appareils.\r\n- Vous pouvez également accéder à la page de filtrage correspondante de l'intégration [Configuration> Mettre à jour la liste des appareils] pour refiltrer.", "data": { - "filter_mode": "Mode de Filtrage" + "room_filter_mode": "Filtrer les Pièces", + "room_list": "Pièces", + "type_filter_mode": "Filtrer les Types d'Appareils", + "type_list": "Types d'Appareils", + "model_filter_mode": "Filtrer les Modèles d'Appareils", + "model_list": "Modèles d'Appareils", + "devices_filter_mode": "Filtrer les Appareils", + "device_list": "Liste des Appareils" } } }, diff --git a/custom_components/xiaomi_home/translations/ja.json b/custom_components/xiaomi_home/translations/ja.json index 8c343c8..88a75c5 100644 --- a/custom_components/xiaomi_home/translations/ja.json +++ b/custom_components/xiaomi_home/translations/ja.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "デバイスをフィルタリング", - "description": "## 使い方\r\n不要なデバイスをファミリー単位でフィルタリングします。", + "description": "## 紹介\r\n- 部屋名とデバイスタイプでデバイスをフィルタリングすることができます。デバイスの次元でフィルタリングすることもできます。\r\n- 対応する統合項目【設定>デバイスリストの更新】ページに移動して再度フィルタリングすることもできます。", "data": { - "filter_mode": "フィルターモード" + "room_filter_mode": "家族の部屋をフィルタリング", + "room_list": "家族の部屋", + "type_filter_mode": "デバイスタイプをフィルタリング", + "type_list": "デバイスタイプ", + "model_filter_mode": "デバイスモデルをフィルタリング", + "model_list": "デバイスモデル", + "devices_filter_mode": "デバイスをフィルタリング", + "device_list": "デバイスリスト" } } }, diff --git a/custom_components/xiaomi_home/translations/nl.json b/custom_components/xiaomi_home/translations/nl.json index b67f408..d476be2 100644 --- a/custom_components/xiaomi_home/translations/nl.json +++ b/custom_components/xiaomi_home/translations/nl.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Apparaten filteren", - "description": "## Inleiding\r\nFilter ongewenste apparaten per familie.", + "description": "## Inleiding\r\n- Ondersteunt het filteren van apparaten op basis van kamer- en apparaattypen, en ondersteunt ook apparaatdimensiefiltering.\r\n- U kunt ook naar de overeenkomstige integratie-item [Configuratie>Apparaatlijst bijwerken] pagina gaan om opnieuw te filteren.", "data": { - "filter_mode": "Filtermodus" + "room_filter_mode": "Kamerfiltermodus", + "room_list": "Kamers", + "type_filter_mode": "Apparaattypen filteren", + "type_list": "Apparaattypen", + "model_filter_mode": "Apparaatmodel filteren", + "model_list": "Apparaatmodellen", + "devices_filter_mode": "Apparaten filteren", + "device_list": "Apparaatlijst" } } }, diff --git a/custom_components/xiaomi_home/translations/pt-BR.json b/custom_components/xiaomi_home/translations/pt-BR.json index ceef23f..7d0e237 100644 --- a/custom_components/xiaomi_home/translations/pt-BR.json +++ b/custom_components/xiaomi_home/translations/pt-BR.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Filtrar Dispositivos", - "description": "## Introdução\r\nFiltre dispositivos indesejados por família.", + "description": "## Introdução\r\n- Suporte para filtrar dispositivos por nome da sala e tipo de dispositivo, bem como filtragem por família.\r\n- Você também pode acessar a página correspondente da integração [Configuração>Atualizar Lista de Dispositivos] para refiltrar.", "data": { - "filter_mode": "Modo de Filtro" + "room_filter_mode": "Filtrar por Sala", + "room_list": "Salas", + "type_filter_mode": "Filtrar por Tipo de Dispositivo", + "type_list": "Tipos de Dispositivo", + "model_filter_mode": "Filtrar por Modelo de Dispositivo", + "model_list": "Modelos de Dispositivo", + "devices_filter_mode": "Filtrar Dispositivos", + "device_list": "Lista de Dispositivos" } } }, diff --git a/custom_components/xiaomi_home/translations/pt.json b/custom_components/xiaomi_home/translations/pt.json index 5784a6f..aef3aa5 100644 --- a/custom_components/xiaomi_home/translations/pt.json +++ b/custom_components/xiaomi_home/translations/pt.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Filtrar Dispositivos", - "description": "## Introdução\r\nFiltre dispositivos indesejados por família.", + "description": "## Introdução\r\n- Suporta a filtragem de dispositivos por nome de sala e tipo de dispositivo, bem como a filtragem por família.\r\n- Pode também aceder à página de configuração correspondente da integração [Configuração > Atualizar Lista de Dispositivos] para refazer a filtragem.", "data": { - "filter_mode": "Modo de Filtro" + "room_filter_mode": "Filtrar por Sala", + "room_list": "Salas", + "type_filter_mode": "Filtrar por Tipo de Dispositivo", + "type_list": "Tipos de Dispositivo", + "model_filter_mode": "Filtrar por Modelo de Dispositivo", + "model_list": "Modelos de Dispositivo", + "devices_filter_mode": "Filtrar Dispositivos", + "device_list": "Lista de Dispositivos" } } }, diff --git a/custom_components/xiaomi_home/translations/ru.json b/custom_components/xiaomi_home/translations/ru.json index 32b8def..e26f80e 100644 --- a/custom_components/xiaomi_home/translations/ru.json +++ b/custom_components/xiaomi_home/translations/ru.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "Фильтрация устройств", - "description": "## Введение\r\nФильтруйте ненужные устройства по семьям.", + "description": "## Введение\r\n- Поддерживает фильтрацию устройств по названию комнаты и типу устройства, а также фильтрацию по уровню устройства.\r\n- Вы также можете перейти на соответствующую страницу интеграции [Настройки> Обновить список устройств], чтобы перефильтровать.", "data": { - "filter_mode": "Режим фильтрации" + "room_filter_mode": "Фильтрация по комнатам семьи", + "room_list": "Комнаты семьи", + "type_filter_mode": "Фильтрация по типу устройства", + "type_list": "Типы устройств", + "model_filter_mode": "Фильтрация по модели устройства", + "model_list": "Модели устройств", + "devices_filter_mode": "Фильтрация устройств", + "device_list": "Список устройств" } } }, diff --git a/custom_components/xiaomi_home/translations/zh-Hans.json b/custom_components/xiaomi_home/translations/zh-Hans.json index 732bd10..2d85447 100644 --- a/custom_components/xiaomi_home/translations/zh-Hans.json +++ b/custom_components/xiaomi_home/translations/zh-Hans.json @@ -43,7 +43,7 @@ }, "devices_filter": { "title": "筛选设备", - "description": "## 使用介绍\r\n#### 支持按照房间名称和设备类型筛选设备,同时也支持设备维度筛选。您也可以进入对应集成项【配置】页面重新筛选。", + "description": "## 使用介绍\r\n- 支持按照房间名称和设备类型筛选设备,同时也支持设备维度筛选。\r\n- 您也可以进入对应集成项【配置>更新设备列表】页面重新筛选。", "data": { "room_filter_mode": "筛选家庭房间", "room_list": "家庭房间", diff --git a/custom_components/xiaomi_home/translations/zh-Hant.json b/custom_components/xiaomi_home/translations/zh-Hant.json index f05dc1f..3dbc33f 100644 --- a/custom_components/xiaomi_home/translations/zh-Hant.json +++ b/custom_components/xiaomi_home/translations/zh-Hant.json @@ -43,9 +43,16 @@ }, "devices_filter": { "title": "篩選設備", - "description": "## 使用介紹\r\n按照家庭維度,過濾不需要的設備。", + "description": "## 使用介紹\r\n- 支持按照房間名稱和設備類型篩選設備,同時也支持設備維度篩選。\r\n- 您也可以進入對應集成項【配置>更新設備列表】頁面重新篩選。", "data": { - "filter_mode": "過濾模式" + "room_filter_mode": "篩選家庭房間", + "room_list": "家庭房間", + "type_filter_mode": "篩選設備類型", + "type_list": "設備類型", + "model_filter_mode": "篩選設備型號", + "model_list": "設備型號", + "devices_filter_mode": "篩選設備", + "device_list": "設備列表" } } }, From 8c0461e88c7737e072985aa7e7fb3f5622f3091c Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 22:56:25 +0800 Subject: [PATCH 08/10] fix: fix mdns type error --- .../xiaomi_home/miot/miot_mdns.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_mdns.py b/custom_components/xiaomi_home/miot/miot_mdns.py index 4f13649..a6b3002 100644 --- a/custom_components/xiaomi_home/miot/miot_mdns.py +++ b/custom_components/xiaomi_home/miot/miot_mdns.py @@ -50,7 +50,7 @@ import binascii import copy from enum import Enum -from typing import Callable, Optional +from typing import Callable, Coroutine, Optional import logging from zeroconf import ( @@ -98,8 +98,8 @@ class MipsServiceData: def __init__(self, service_info: AsyncServiceInfo) -> None: if service_info is None: raise MipsServiceError('invalid params') - properties = service_info.decoded_properties - if properties is None: + properties: dict = service_info.decoded_properties + if not properties: raise MipsServiceError('invalid service properties') self.profile = properties.get('profile', None) if self.profile is None: @@ -111,9 +111,11 @@ def __init__(self, service_info: AsyncServiceInfo) -> None: if not self.addresses: raise MipsServiceError('invalid addresses') self.addresses.sort() + if not service_info.port: + raise MipsServiceError('invalid port') self.port = service_info.port self.type = service_info.type - self.server = service_info.server + self.server = service_info.server or '' # Parse profile self.did = str(int.from_bytes(self.profile_bin[1:9])) self.group_id = binascii.hexlify( @@ -150,8 +152,8 @@ class MipsService: _aio_browser: AsyncServiceBrowser _services: dict[str, dict] # key = (key, group_id) - _sub_list: dict[(str, str), Callable[[ - str, MipsServiceState, dict], asyncio.Future]] + _sub_list: dict[tuple[str, str], Callable[[ + str, MipsServiceState, dict], Coroutine]] def __init__( self, aiozc: AsyncZeroconf, @@ -159,7 +161,6 @@ def __init__( ) -> None: self._aiozc = aiozc self._main_loop = loop or asyncio.get_running_loop() - self._aio_browser = None self._services = {} self._sub_list = {} @@ -207,7 +208,7 @@ def get_services(self, group_id: Optional[str] = None) -> dict[str, dict]: def sub_service_change( self, key: str, group_id: str, - handler: Callable[[str, MipsServiceState, dict], asyncio.Future] + handler: Callable[[str, MipsServiceState, dict], Coroutine] ) -> None: if key is None or group_id is None or handler is None: raise MipsServiceError('invalid params') @@ -232,7 +233,7 @@ def __on_service_state_change( for item in list(self._services.values()): if item['name'] != name: continue - service_data = self._services.pop(item['group_id'], None) + service_data = self._services.pop(item['group_id'], {}) self.__call_service_change( state=MipsServiceState.REMOVED, data=service_data) return @@ -275,10 +276,10 @@ async def __request_service_info_async( _LOGGER.error('invalid mips service, %s, %s', error, info) def __call_service_change( - self, state: MipsServiceState, data: dict = None + self, state: MipsServiceState, data: dict ) -> None: _LOGGER.info('call service change, %s, %s', state, data) for keys in list(self._sub_list.keys()): - if keys[1] in [data['group_id'], '*']: + if keys[1] in [data.get('group_id', None), '*']: self._main_loop.create_task( self._sub_list[keys](data['group_id'], state, data)) From ff5e4c7ab1449be014bc7d67c9a29e47d16c984c Mon Sep 17 00:00:00 2001 From: sworld Date: Sun, 22 Dec 2024 23:40:45 +0800 Subject: [PATCH 09/10] fix: fix miot client i18n logic --- custom_components/xiaomi_home/miot/miot_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_client.py b/custom_components/xiaomi_home/miot/miot_client.py index da8e2b6..1346b63 100644 --- a/custom_components/xiaomi_home/miot/miot_client.py +++ b/custom_components/xiaomi_home/miot/miot_client.py @@ -239,14 +239,14 @@ async def init_async(self) -> None: # Integration need to be add again raise MIoTClientError('load_user_config_async error') _LOGGER.debug('user config, %s', json.dumps(self._user_config)) - # Load cache device list - await self.__load_cache_device_async() # MIoT i18n client self._i18n = MIoTI18n( lang=self._entry_data.get( 'integration_language', DEFAULT_INTEGRATION_LANGUAGE), loop=self._main_loop) await self._i18n.init_async() + # Load cache device list + await self.__load_cache_device_async() # MIoT oauth client instance self._oauth = MIoTOauthClient( client_id=OAUTH2_CLIENT_ID, From 23cb4bf7433bac3a2e9cda6b8cb705c6fe1fe1df Mon Sep 17 00:00:00 2001 From: sworld Date: Mon, 23 Dec 2024 00:03:55 +0800 Subject: [PATCH 10/10] feat: add connect type --- custom_components/xiaomi_home/config_flow.py | 32 ++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/custom_components/xiaomi_home/config_flow.py b/custom_components/xiaomi_home/config_flow.py index 9f54207..46b6a64 100644 --- a/custom_components/xiaomi_home/config_flow.py +++ b/custom_components/xiaomi_home/config_flow.py @@ -423,7 +423,7 @@ async def __check_oauth_async(self) -> None: home_info['central_did'] = mips_list[group_id].get('did', None) home_list[home_id] = ( f'{home_info["home_name"]} ' - f'[ {len(dev_list)} {tip_devices}{tip_central} ]') + f'[ {len(dev_list)} {tip_devices} {tip_central} ]') self._home_list = dict(sorted(home_list.items())) @@ -658,15 +658,16 @@ async def async_step_devices_filter( tip_devices: str = self._miot_i18n.translate( key='config.other.devices') - tip_filter_mode: str = self._miot_i18n.translate( - key='config.filter_mode') - tip_connect_type: dict = self._miot_i18n.translate( - key='config.connect_type') tip_without_room: str = self._miot_i18n.translate( key='config.other.without_room') + trans_filter_mode: dict = self._miot_i18n.translate( + key='config.filter_mode') + trans_connect_type: dict = self._miot_i18n.translate( + key='config.connect_type') room_device_count: dict = {} model_device_count: dict = {} + connect_type_count: dict = {} device_list: dict = {} for did, info in self._device_list_sorted.items(): device_list[did] = ( @@ -676,10 +677,17 @@ async def async_step_devices_filter( room_device_count[info['room_id']] += 1 model_device_count.setdefault(info['model'], 0) model_device_count[info['model']] += 1 + connect_type_count.setdefault(str(info['connect_type']), 0) + connect_type_count[str(info['connect_type'])] += 1 model_list: dict = {} for model, count in model_device_count.items(): - model_list[model] = f'{model} [ {count}{tip_devices} ]' + model_list[model] = f'{model} [ {count} {tip_devices} ]' + + type_list: dict = { + k: f'{trans_connect_type.get(k, f"Connect Type ({k})")} ' + f'[ {v} {tip_devices} ]' + for k, v in connect_type_count.items()} room_list: dict = {} for home_id, home_info in self._home_selected.items(): @@ -698,17 +706,17 @@ async def async_step_devices_filter( step_id='devices_filter', data_schema=vol.Schema({ vol.Required('room_filter_mode', default='exclude'): - vol.In(tip_filter_mode), + vol.In(trans_filter_mode), vol.Optional('room_list'): cv.multi_select(room_list), vol.Required('type_filter_mode', default='exclude'): - vol.In(tip_filter_mode), - vol.Optional('type_list'): cv.multi_select(tip_connect_type), + vol.In(trans_filter_mode), + vol.Optional('type_list'): cv.multi_select(type_list), vol.Required('model_filter_mode', default='exclude'): - vol.In(tip_filter_mode), + vol.In(trans_filter_mode), vol.Optional('model_list'): cv.multi_select(dict(sorted( model_list.items(), key=lambda item: item[0]))), vol.Required('devices_filter_mode', default='exclude'): - vol.In(tip_filter_mode), + vol.In(trans_filter_mode), vol.Optional('device_list'): cv.multi_select(dict(sorted( device_list.items(), key=lambda device: device[1]))) }), @@ -1183,7 +1191,7 @@ async def async_step_homes_select(self, user_input=None): 'did', None) home_list[home_id] = ( f'{home_info["home_name"]} ' - f'[ {len(did_list)} {tip_devices}{tip_central} ]') + f'[ {len(did_list)} {tip_devices} {tip_central} ]') # Remove deleted item self._home_selected_list = [ home_id for home_id in self._home_selected_list