Просмотр исходного кода

Improve protocol handling in config flow (#4607)

* Improve error message to point at potential protocol mismatch

* Treat protocol test failures as debug log and not error log

* Change default protocol to auto and fix audo mode

In auto mode a fresh device object is now used for each attempt in order to avoid handshake problems

* fix linting error

* revert default protocol to 3.3

* add user information for auto-detected protocol version

* narrow down error suppression

Only suppresses 914 in auto mode

* fix linting error

* fix test warnings

* fix debug output of protocol version

* change default protocol to auto

* fix test after changing default protocol to auto

* add translations for PR #4607

(machine translations generated by GitHub CoPilot)

---------

Co-authored-by: Jason Rumney <jasonrumney@gmail.com>
kongo09 4 дней назад
Родитель
Сommit
10bb095f30
26 измененных файлов с 284 добавлено и 70 удалено
  1. 67 20
      custom_components/tuya_local/config_flow.py
  2. 7 3
      custom_components/tuya_local/device.py
  3. 9 2
      custom_components/tuya_local/translations/bg.json
  4. 9 2
      custom_components/tuya_local/translations/ca.json
  5. 9 2
      custom_components/tuya_local/translations/cz.json
  6. 9 2
      custom_components/tuya_local/translations/de.json
  7. 9 2
      custom_components/tuya_local/translations/el.json
  8. 10 3
      custom_components/tuya_local/translations/en.json
  9. 9 2
      custom_components/tuya_local/translations/es.json
  10. 9 2
      custom_components/tuya_local/translations/fr.json
  11. 9 2
      custom_components/tuya_local/translations/hu.json
  12. 9 2
      custom_components/tuya_local/translations/id.json
  13. 9 2
      custom_components/tuya_local/translations/it.json
  14. 9 2
      custom_components/tuya_local/translations/ja.json
  15. 9 2
      custom_components/tuya_local/translations/no-NB.json
  16. 9 2
      custom_components/tuya_local/translations/pl.json
  17. 9 2
      custom_components/tuya_local/translations/pt-BR.json
  18. 9 2
      custom_components/tuya_local/translations/pt-PT.json
  19. 9 2
      custom_components/tuya_local/translations/ro.json
  20. 9 2
      custom_components/tuya_local/translations/ru.json
  21. 9 2
      custom_components/tuya_local/translations/sv.json
  22. 9 2
      custom_components/tuya_local/translations/uk.json
  23. 9 2
      custom_components/tuya_local/translations/ur.json
  24. 9 2
      custom_components/tuya_local/translations/zh-Hans.json
  25. 9 2
      custom_components/tuya_local/translations/zh-Hant.json
  26. 2 0
      tests/test_config_flow.py

+ 67 - 20
custom_components/tuya_local/config_flow.py

@@ -331,7 +331,7 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
         devid_opts = {}
         host_opts = {"default": ""}
         key_opts = {}
-        proto_opts = {"default": 3.3}
+        proto_opts = {"default": "auto"}
         polling_opts = {"default": False}
         devcid_opts = {}
 
@@ -349,6 +349,18 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
             self.device = await async_test_connection(user_input, self.hass)
             if self.device:
                 self.data = user_input
+                # If auto mode found a working protocol, save it so future
+                # HA restarts connect directly without re-cycling all versions.
+                self._auto_detected_protocol = None
+                if (
+                    user_input.get(CONF_PROTOCOL_VERSION) == "auto"
+                    and self.device._protocol_configured != "auto"
+                ):
+                    self._auto_detected_protocol = self.device._protocol_configured
+                    self.data = {
+                        **self.data,
+                        CONF_PROTOCOL_VERSION: self._auto_detected_protocol,
+                    }
                 if self.__cloud_device:
                     if self.__cloud_device.get("product_id"):
                         self.device.set_detected_product_id(
@@ -452,20 +464,31 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
             "Include the previous log messages with any new device request to https://github.com/make-all/tuya-local/issues/",
         )
         if types:
+            detected = getattr(self, "_auto_detected_protocol", None)
+            schema = vol.Schema(
+                {
+                    vol.Required(
+                        CONF_TYPE,
+                        default=best_matching_type,
+                    ): vol.In(types),
+                }
+            )
+            if detected:
+                return self.async_show_form(
+                    step_id="select_type_auto_detected",
+                    data_schema=schema,
+                    description_placeholders={"detected_protocol": str(detected)},
+                )
             return self.async_show_form(
                 step_id="select_type",
-                data_schema=vol.Schema(
-                    {
-                        vol.Required(
-                            CONF_TYPE,
-                            default=best_matching_type,
-                        ): vol.In(types),
-                    }
-                ),
+                data_schema=schema,
             )
         else:
             return self.async_abort(reason="not_supported")
 
+    async def async_step_select_type_auto_detected(self, user_input=None):
+        return await self.async_step_select_type(user_input)
+
     async def async_step_choose_entities(self, user_input=None):
         if user_input is not None:
             title = user_input[CONF_NAME]
@@ -566,17 +589,41 @@ async def async_test_connection(config: dict, hass: HomeAssistant):
         existing["device"].pause()
         await asyncio.sleep(5)
 
-    try:
-        device = await hass.async_add_executor_job(
-            create_test_device,
-            hass,
-            config,
-        )
-        await device.async_refresh()
-        retval = device if device.has_returned_state else None
-    except Exception as e:
-        _LOGGER.warning("Connection test failed with %s %s", type(e), e)
-        retval = None
+    retval = None
+
+    if config.get(CONF_PROTOCOL_VERSION) == "auto":
+        # Test each protocol with a fresh device object. Reusing one device
+        # object across protocol rotations causes 3.4/3.5 handshakes to fail:
+        # the shared tinytuya object carries stale internal state from the
+        # prior connection attempts.
+        for proto in API_PROTOCOL_VERSIONS:
+            proto_config = {**config, CONF_PROTOCOL_VERSION: proto}
+            device = None
+            try:
+                device = await hass.async_add_executor_job(
+                    create_test_device, hass, proto_config
+                )
+                await device.async_refresh()
+                if device.has_returned_state:
+                    retval = device
+                    break
+            except Exception as e:
+                _LOGGER.debug("Protocol %s test failed with %s %s", proto, type(e), e)
+            if device is not None:
+                device._api.set_socketPersistent(False)
+                if device._api.parent:
+                    device._api.parent.set_socketPersistent(False)
+    else:
+        try:
+            device = await hass.async_add_executor_job(
+                create_test_device,
+                hass,
+                config,
+            )
+            await device.async_refresh()
+            retval = device if device.has_returned_state else None
+        except Exception as e:
+            _LOGGER.warning("Connection test failed with %s %s", type(e), e)
 
     if existing and existing.get("device"):
         _LOGGER.info("Restarting device after test")

+ 7 - 3
custom_components/tuya_local/device.py

@@ -624,12 +624,14 @@ class TuyaLocalDevice(object):
             else self._SINGLE_PROTO_CONNECTION_ATTEMPTS
         )
 
+        last_err_code = None
         for i in range(connections):
             try:
                 if not self._hass.is_stopping:
                     retval = await self._hass.async_add_executor_job(func)
                     if isinstance(retval, dict) and "Error" in retval:
-                        if retval.get("Err") == "900":
+                        last_err_code = retval.get("Err")
+                        if last_err_code == "900":
                             # Some devices (e.g. IR/RF remotes) never return
                             # status data; error 900 is their normal response
                             # to a status query. Treat as reachable with no
@@ -660,7 +662,9 @@ class TuyaLocalDevice(object):
                         self._api_protocol_working = False
                         for entity in self._children:
                             entity.async_schedule_update_ha_state()
-                    if self._api_working_protocol_failures == 1:
+                    if self._api_working_protocol_failures == 1 and not (
+                        last_err_code == "914" and self._protocol_configured == "auto"
+                    ):
                         _LOGGER.error(error_message)
                     else:
                         _LOGGER.debug(error_message)
@@ -717,7 +721,7 @@ class TuyaLocalDevice(object):
 
         new_version = API_PROTOCOL_VERSIONS[self._api_protocol_version_index]
         _LOGGER.debug(
-            "Setting protocol version for %s to %0.1f",
+            "Setting protocol version for %s to %s",
             self.name,
             new_version,
         )

+ 9 - 2
custom_components/tuya_local/translations/bg.json

@@ -51,6 +51,13 @@
                     "type": "Тип устройство"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Изберете типа на устройството",
+                "description": "Изберете типа, който съответства на вашето устройство. Версията на протокола {detected_protocol} беше автоматично открита и запазена. Ако в бъдеще актуализирате фърмуера на устройството, може да се наложи да конфигурирате отново тази интеграция.",
+                "data": {
+                    "type": "Тип устройство"
+                }
+            },
             "choose_entities": {
                 "title": "Подробности за устройството",
                 "description": "Изберете име за това устройство",
@@ -65,7 +72,7 @@
             "no_devices": "Не могат да бъдат намерени нерегистрирани устройства за акаунта."
         },
         "error": {
-            "connection": "Не може да се свърже с вашето устройство с тези данни. Възможно е да става въпрос за прекъсване или данните да са неправилни.",
+            "connection": "Не може да се свърже с вашето устройство с тези данни. Възможно е да става въпрос за прекъсване или данните да са неправилни. Ако сте избрали конкретна версия на протокола, опитайте 'auto' вместо това.",
             "does_not_need_hub": "Устройството не се нуждае от шлюз и беше избран такъв. ",
             "needs_hub": "Устройството се нуждае от шлюз и не е избран нито един."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Не може да се свърже с вашето устройство с тези данни. Възможно е да става въпрос за прекъсване или данните да са неправилни."
+            "connection": "Не може да се свърже с вашето устройство с тези данни. Възможно е да става въпрос за прекъсване или данните да са неправилни. Ако сте избрали конкретна версия на протокола, опитайте 'auto' вместо това."
         },
         "abort": {
             "not_supported": "Съжаляваме, няма поддръжка за това устройство, все още"

+ 9 - 2
custom_components/tuya_local/translations/ca.json

@@ -50,6 +50,13 @@
                     "type": "Tipus de dispositiu"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Trieu el tipus de dispositiu",
+                "description": "Trieu el tipus que coincideix amb el vostre dispositiu. La versión de protocolo {detected_protocol} se detectó automáticamente y se guardó. Si actualiza el firmware del dispositivo en el futuro, es posible que deba reconfigurar esta integración.",
+                "data": {
+                    "type": "Tipus de dispositiu"
+                }
+            },
             "choose_entities": {
                 "title": "Detalls del dispositiu",
                 "description": "Trieu un nom per a aquest dispositiu",
@@ -64,7 +71,7 @@
             "no_devices": "No s'ha pogut trobar cap dispositiu sense registrar per al compte."
         },
         "error": {
-            "connection": "No s'ha pogut connectar al vostre dispositiu amb aquests detalls. Podria ser una qüestió intermitent, o pot ser que siguin incorrectes.",
+            "connection": "No s'ha pogut conectar al vostre dispositiu con esos detalles. Podría ser un problema intermitente, o podrían ser incorrectos. Si seleccionó una versión de protocolo específica, intente 'auto' en su lugar.",
             "needs_hub": "El dispositiu necessita una passarel·la i no se n'ha seleccionat cap.",
             "does_not_need_hub": "El dispositiu no necessita una passarel·la i se n'ha seleccionat una. Reviseu les vostres opcions."
         }
@@ -96,7 +103,7 @@
             "not_supported": "No hi ha suport per a aquest dispositiu."
         },
         "error": {
-            "connection": "No s'ha pogut connectar al vostre dispositiu amb aquests detalls. Podria ser una qüestió intermitent, o pot ser que siguin incorrectes."
+            "connection": "No s'ha pogut conectar al vostre dispositiu con esos detalles. Podría ser un problema intermitente, o podrían ser incorrectos. Si seleccionó una versión de protocolo específica, intente 'auto' en su lugar."
         }
     },
     "entity": {

+ 9 - 2
custom_components/tuya_local/translations/cz.json

@@ -51,6 +51,13 @@
                     "type": "Typ zařízení"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Vyberte typ zařízení",
+                "description": "Vyberte typ, který odpovídá vašemu zařízení. Verze protokolu {detected_protocol} byla automaticky detekována a uložena. Pokud v budoucnu aktualizujete firmware zařízení, možná budete muset tuto integraci znovu nakonfigurovat.",
+                "data": {
+                    "type": "Typ zařízení"
+                }
+            },
             "choose_entities": {
                 "title": "Podrobnosti o zařízení",
                 "description": "Vyberte jméno pro toto zařízení",
@@ -65,7 +72,7 @@
             "no_devices": "Nelze najít žádná neregistrovaná zařízení pro účet."
         },
         "error": {
-            "connection": "Není možné připojit se k zařízené s těmito údaji. Může se jednat o dočasný problém, nebo zadané údaje nejsou správné.",
+            "connection": "Není možné připojit se k zařízené s těmito údaji. Může se jednat o dočasný problém, nebo zadané údaje nejsou správné. Pokud jste vybrali konkrétní verzi protokolu, zkuste místo toho 'auto'.",
             "does_not_need_hub": "Zařízení nepotřebuje bránu a byla vybrána. ",
             "needs_hub": "Zařízení potřebuje bránu a žádná nebyla vybrána."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Není možné připojit se k zařízené s těmito údaji. Může se jednat o dočasný problém, nebo zadané údaje nejsou správné."
+            "connection": "Není možné připojit se k zařízené s těmito údaji. Může se jednat o dočasný problém, nebo zadané údaje nejsou správné. Pokud jste vybrali konkrétní verzi protokolu, zkuste místo toho 'auto'."
         },
         "abort": {
             "not_supported": "Omlouváme se, toto zažízení není podporováno."

+ 9 - 2
custom_components/tuya_local/translations/de.json

@@ -51,6 +51,13 @@
                     "type": "Gerätetyp"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Wählen Sie den Gerätetyp aus",
+                "description": "Wählen Sie den Typ aus, der Ihrem Gerät entspricht. Protokollversion {detected_protocol} wurde automatisch erkannt und gespeichert. Wenn Sie die Geräte-Firmware in Zukunft aktualisieren, müssen Sie diese Integration möglicherweise neu konfigurieren.",
+                "data": {
+                    "type": "Gerätetyp"
+                }
+            },
             "choose_entities": {
                 "title": "Gerätename",
                 "description": "Wählen Sie einen Namen für dieses Gerät aus.",
@@ -65,7 +72,7 @@
             "no_devices": "Für das Konto konnten keine nicht registrierten Geräte gefunden werden."
         },
         "error": {
-            "connection": "Mit diesen Angaben kann keine Verbindung zu Ihrem Gerät hergestellt werden. Es könnte sich um ein intermittierendes Problem handeln, oder die Angaben sind falsch.",
+            "connection": "Mit diesen Angaben kann keine Verbindung zu Ihrem Gerät hergestellt werden. Es könnte sich um ein intermittierendes Problem handeln, oder die Angaben sind falsch. Wenn Sie eine bestimmte Protokollversion ausgewählt haben, versuchen Sie stattdessen 'auto'.",
             "does_not_need_hub": "Das Gerät benötigt kein Gateway und es wurde eines ausgewählt. ",
             "needs_hub": "Das Gerät benötigt ein Gateway und es wurde keines ausgewählt."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Mit diesen Angaben kann keine Verbindung zu Ihrem Gerät hergestellt werden. Es könnte sich um ein intermittierendes Problem handeln, oder die Angaben sind falsch."
+            "connection": "Mit diesen Angaben kann keine Verbindung zu Ihrem Gerät hergestellt werden. Es könnte sich um ein intermittierendes Problem handeln, oder die Angaben sind falsch. Wenn Sie eine bestimmte Protokollversion ausgewählt haben, versuchen Sie stattdessen 'auto'."
         },
         "abort": {
             "not_supported": "Dieses Gerät wird leider nicht unterstützt."

+ 9 - 2
custom_components/tuya_local/translations/el.json

@@ -51,6 +51,13 @@
                     "type": "Τύπος συσκευής"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Επιλέξτε τον τύπο της συσκευής",
+                "description": "Επιλέξτε τον τύπο που ταιριάζει στη συσκευή σας. Η έκδοση πρωτοκόλλου {detected_protocol} ανιχνεύθηκε αυτόματα και αποθηκεύτηκε. Εάν ενημερώσετε το υλικολογισμικό της συσκευής στο μέλλον, ίσως χρειαστεί να επαναδιαμορφώσετε αυτήν την ενσωμάτωση.",
+                "data": {
+                    "type": "Τύπος συσκευής"
+                }
+            },
             "choose_entities": {
                 "title": "Λεπτομέρειες συσκευής",
                 "description": "Επιλέξτε ένα όνομα για αυτή τη συσκευή",
@@ -65,7 +72,7 @@
             "no_devices": "Αδυναμία εύρεσης μη εγγεγραμμένων συσκευών για αυτό το λογαριασμό."
         },
         "error": {
-            "connection": "Αδυναμία σύνδεσης στη συσκευή σας με αυτά τα στοιχεία. Ίσως είναι προσωρινό πρόβλημα, ή τα στοιχεία που καταχωρίσατε είναι λάθος.",
+            "connection": "Αδυναμία σύνδεσης στη συσκευή σας με αυτά τα στοιχεία. Ίσως είναι προσωρινό πρόβλημα, ή τα στοιχεία που καταχωρίσατε είναι λάθος. Αν επιλέξατε μια συγκεκριμένη έκδοση πρωτοκόλλου, δοκιμάστε 'auto' αντί για αυτήν.",
             "does_not_need_hub": "Η συσκευή δεν χρειάζεται κάποιο gateway και επιλέχτηκε ένα. Παρακαλώ ελέγξτε τις επιλογές.",
             "needs_hub": "Η συσκευή χρειάζεται gateway και δεν επιλέχτηκε κάποιο."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Αδυναμία σύνδεσης στη συσκευή σας με αυτές τα στοιχεία. Ίσως είναι προσωρινό πρόβλημα, ή τα στοιxεία που καταχωρίσατε είναι λάθος."
+            "connection": "Αδυναμία σύνδεσης στη συσκευή σας με αυτά τα στοιχεία. Ίσως είναι προσωρινό πρόβλημα, ή τα στοιχεία που καταχωρίσατε είναι λάθος. Αν επιλέξατε μια συγκεκριμένη έκδοση πρωτοκόλλου, δοκιμάστε 'auto' αντί για αυτήν."
         },
         "abort": {
             "not_supported": "Λυπούμαστε, αυτή η συσκευή δεν υποστηρίζεται."

+ 10 - 3
custom_components/tuya_local/translations/en.json

@@ -46,7 +46,14 @@
             },
             "select_type": {
                 "title": "Choose the type of device",
-                "description": "Choose the type that matches your device",
+                "description": "Choose the type that matches your device.",
+                "data": {
+                    "type": "Device type"
+                }
+            },
+            "select_type_auto_detected": {
+                "title": "Choose the type of device",
+                "description": "Choose the type that matches your device. Protocol version {detected_protocol} was automatically detected and saved. If you update the device firmware in the future, you may need to reconfigure this integration.",
                 "data": {
                     "type": "Device type"
                 }
@@ -65,7 +72,7 @@
             "no_devices": "Unable to find any unregistered devices for the account."
         },
         "error": {
-            "connection": "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect.",
+            "connection": "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect. If you selected a specific protocol version, try 'auto' instead.",
             "does_not_need_hub": "Device does not need a gateway and one was selected. Please review your choices.",
             "needs_hub": "Device needs a gateway and none was selected."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect."
+            "connection": "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect. If you selected a specific protocol version, try 'auto' instead."
         },
         "abort": {
             "not_supported": "Sorry, there is no support for this device."

+ 9 - 2
custom_components/tuya_local/translations/es.json

@@ -51,6 +51,13 @@
                     "type": "Tipo de dispositivo"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Elige el tipo de dispositivo",
+                "description": "Elija el tipo que coincida con su dispositivo. La versión del protocolo {detected_protocol} se detectó automáticamente y se guardó. Si actualiza el firmware del dispositivo en el futuro, es posible que deba reconfigurar esta integración.",
+                "data": {
+                    "type": "Tipo de dispositivo"
+                }
+            },
             "choose_entities": {
                 "title": "Detalles del dispositivo",
                 "description": "Elija un nombre para este dispositivo",
@@ -65,7 +72,7 @@
             "no_devices": "No se puede encontrar ningún dispositivo no registrado para la cuenta."
         },
         "error": {
-            "connection": "No se puede conectar a su dispositivo con esos detalles. Podría ser un problema intermitente, o pueden ser incorrectos.",
+            "connection": "No se puede conectar a su dispositivo con esos detalles. Podría ser un problema intermitente, o pueden ser incorrectos. Si seleccionó una versión de protocolo específica, pruebe 'auto' en su lugar.",
             "does_not_need_hub": "El dispositivo no necesita una puerta de enlace y se seleccionó una. ",
             "needs_hub": "El dispositivo necesita una puerta de enlace y no se seleccionó ninguna."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "No se puede conectar a su dispositivo con esos detalles. Podría ser un problema intermitente, o pueden ser incorrectos."
+            "connection": "No se puede conectar a su dispositivo con esos detalles. Podría ser un problema intermitente, o pueden ser incorrectos. Si seleccionó una versión de protocolo específica, pruebe 'auto' en su lugar."
         },
         "abort": {
             "not_supported": "Lo sentimos, no hay soporte para este dispositivo."

+ 9 - 2
custom_components/tuya_local/translations/fr.json

@@ -51,6 +51,13 @@
                     "type": "Type d'appareil"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Choisissez le type d'appareil",
+                "description": "Choisissez le type qui correspond à votre appareil. La version du protocole {detected_protocol} a été automatiquement détectée et enregistrée. Si vous mettez à jour le firmware de l'appareil à l'avenir, vous devrez peut-être reconfigurer cette intégration.",
+                "data": {
+                    "type": "Type d'appareil"
+                }
+            },
             "choose_entities": {
                 "title": "Details appareil",
                 "description": "Choisissez un nom pour cet appareil",
@@ -65,7 +72,7 @@
             "no_devices": "Impossible de trouver des appareils non enregistrés pour le compte."
         },
         "error": {
-            "connection": "Impossible de se connecter à votre appareil avec ces réglages. Il peut s'agir d'un problème intermittent ou les réglages sont incorrects.",
+            "connection": "Impossible de se connecter à votre appareil avec ces détails. Il peut s'agir d'un problème intermittent, ou ils peuvent être incorrects. Si vous avez sélectionné une version de protocole spécifique, essayez 'auto' à la place.",
             "does_not_need_hub": "L'appareil n'a pas besoin de passerelle et une a été sélectionnée. ",
             "needs_hub": "L'appareil a besoin d'une passerelle et aucune n'a été sélectionnée."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Impossible de se connecter à votre appareil avec ces réglages. Il peut s'agir d'un problème intermittent ou les réglages sont incorrects."
+            "connection": "Impossible de se connecter à votre appareil avec ces détails. Il peut s'agir d'un problème intermittent, ou ils peuvent être incorrects. Si vous avez sélectionné une version de protocole spécifique, essayez 'auto' à la place."
         },
         "abort": {
             "not_supported": "Désolé, il n'y a pas de support pour cet appareil."

+ 9 - 2
custom_components/tuya_local/translations/hu.json

@@ -52,6 +52,13 @@
                     "type": "Eszköz típus"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Válaszd ki az eszköz típusát",
+                "description": "Válaszd ki azt a típust, amelyik legjobban illik az eszközödhöz. A {detected_protocol} protokoll verzió automatikusan észlelve és elmentve. Ha a jövőben frissíted az eszköz firmware-jét, előfordulhat, hogy újra kell konfigurálnod ezt az integrációt.",
+                "data": {
+                    "type": "Eszköz típus"
+                }
+            },
             "choose_entities": {
                 "title": "Eszköz részletei",
                 "description": "Válasz egy nevet az eszköznek",
@@ -66,7 +73,7 @@
             "no_devices": "Nem található a fiókhoz nem regisztrált eszköz."
         },
         "error": {
-            "connection": "A megadott adatokkal nem sikerült kapcsolódni az eszközhöz. Lehet ideiglenes a probléma, vagy nem megfelelőek a megadott adatok.",
+            "connection": "A megadott adatokkal nem sikerült kapcsolódni az eszközhöz. Lehet ideiglenes a probléma, vagy nem megfelelőek a megadott adatok. Ha egy adott protokoll verziót választottál, próbáld meg 'auto'-ra állítani.",
             "does_not_need_hub": "Az eszköznek nincs szüksége átjáróra",
             "needs_hub": "Az eszköznek átjáróra van szüksége"
         }
@@ -94,7 +101,7 @@
             }
         },
         "error": {
-            "connection": "A megadott adatokkal nem sikerült kapcsolódni az eszközhöz. Lehet ideiglenes a probléma, vagy nem megfelelőek a megadott adatok."
+            "connection": "A megadott adatokkal nem sikerült kapcsolódni az eszközhöz. Lehet ideiglenes a probléma, vagy nem megfelelőek a megadott adatok. Ha egy adott protokoll verziót választottál, próbáld meg 'auto'-ra állítani."
         },
         "abort": {
             "not_supported": "Sajnálom, ez az eszköz nem támogatott."

+ 9 - 2
custom_components/tuya_local/translations/id.json

@@ -51,6 +51,13 @@
                     "type": "Tipe perangkat"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Pilih tipe perangkat",
+                "description": "Pilih tipe yang cocok dengan perangkat Anda. Versi protokol {detected_protocol} terdeteksi secara otomatis dan disimpan. Jika Anda memperbarui firmware perangkat di masa mendatang, Anda mungkin perlu mengkonfigurasi ulang integrasi ini.",
+                "data": {
+                    "type": "Tipe perangkat"
+                }
+            },
             "choose_entities": {
                 "title": "Detail perangkat",
                 "description": "Buat nama untuk perangkat ini",
@@ -65,7 +72,7 @@
             "no_devices": "Tidak dapat menemukan perangkat yang tidak terdaftar untuk akun tersebut."
         },
         "error": {
-            "connection": "Tidak dapat terkoneksi ke perangkat tersebut. Bisa jadi sementara, atau ada kesalahan.",
+            "connection": "Tidak dapat terkoneksi ke perangkat Anda dengan detail tersebut. Bisa jadi masalah sementara, atau mungkin salah. Jika Anda memilih versi protokol tertentu, coba 'otomatis' sebagai gantinya.",
             "does_not_need_hub": "Perangkat tidak memerlukan gateway dan satu telah dipilih. ",
             "needs_hub": "Perangkat memerlukan gateway dan tidak ada yang dipilih."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Tidak dapat terkoneksi ke perangkat tersebut. Bisa jadi sementara, atau ada kesalahan."
+            "connection": "Tidak dapat terkoneksi ke perangkat Anda dengan detail tersebut. Bisa jadi masalah sementara, atau mungkin salah. Jika Anda memilih versi protokol tertentu, coba 'otomatis' sebagai gantinya."
         },
         "abort": {
             "not_supported": "Maaf, perangkat ini belum didukung."

+ 9 - 2
custom_components/tuya_local/translations/it.json

@@ -52,6 +52,13 @@
                     "type": "Tipo dispositivo"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Scegli il tipo di dispositivo",
+                "description": "Scegli il tipo che corrisponde al tuo dispositivo. La versione del protocollo {detected_protocol} è stata rilevata automaticamente e salvata. Se aggiorni il firmware del dispositivo in futuro, potresti dover riconfigurare questa integrazione.",
+                "data": {
+                    "type": "Tipo dispositivo"
+                }
+            },
             "choose_entities": {
                 "title": "Dettagli dispositivo",
                 "description": "Inserisci il nome del dispositivo",
@@ -66,7 +73,7 @@
             "no_devices": "Impossibile trovare dispositivi non registrati per l'account."
         },
         "error": {
-            "connection": "Impossibile connettersi al dispositivo. Può trattarsi di un problema temporaneo, oppure le informazioni fornite potrebbero non essere corrette.",
+            "connection": "Impossibile connettersi al dispositivo con quei dettagli. Potrebbe essere un problema intermittente o potrebbero essere errati. Se hai selezionato una versione specifica del protocollo, prova invece 'auto'.",
             "does_not_need_hub": "Il dispositivo non necessita di un gateway e ne è stato selezionato uno. ",
             "needs_hub": "Il dispositivo necessita di un gateway e non ne è stato selezionato nessuno."
         }
@@ -94,7 +101,7 @@
             }
         },
         "error": {
-            "connection": "Impossibile connettersi al dispositivo. Può trattarsi di un problema temporaneo, oppure le informazioni fornite potrebbero non essere corrette."
+            "connection": "Impossibile connettersi al dispositivo con quei dettagli. Potrebbe essere un problema intermittente o potrebbero essere errati. Se hai selezionato una versione specifica del protocollo, prova invece 'auto'."
         },
         "abort": {
             "not_supported": "Spiacente, questo dispositivo non è supportato."

+ 9 - 2
custom_components/tuya_local/translations/ja.json

@@ -51,6 +51,13 @@
                     "type": "デバイスタイプ"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "デバイスの種類を選択してください",
+                "description": "デバイスに合ったタイプを選択してください。プロトコルバージョン{detected_protocol}が自動的に検出され、保存されました。将来デバイスのファームウェアを更新する場合は、この統合を再構成する必要があるかもしれません。",
+                "data": {
+                    "type": "デバイスタイプ"
+                }
+            },
             "choose_entities": {
                 "title": "デバイスの詳細",
                 "description": "このデバイスの名前を選択してください",
@@ -65,7 +72,7 @@
             "no_devices": "アカウントに未登録のデバイスが見つかりません。"
         },
         "error": {
-            "connection": "このような詳細ではデバイスに接続できません。 断続的な問題である可能性もありますし、間違っている可能性もあります。",
+            "connection": "このような詳細ではデバイスに接続できません。 断続的な問題である可能性もありますし、間違っている可能性もあります。特定のプロトコルバージョンを選択した場合は、代わりに「auto」を試してください。",
             "does_not_need_hub": "デバイスにはゲートウェイが必要なく、ゲートウェイが選択されました。",
             "needs_hub": "デバイスにはゲートウェイが必要ですが、ゲートウェイが選択されていません。"
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "このような詳細ではデバイスに接続できません。 断続的な問題である可能性もありますし、間違っている可能性もあります。"
+            "connection": "このような詳細ではデバイスに接続できません。 断続的な問題である可能性もありますし、間違っている可能性もあります。特定のプロトコルバージョンを選択した場合は、代わりに「auto」を試してください。"
         },
         "abort": {
             "not_supported": "申し訳ございませんが、このデバイスはサポートされていません。"

+ 9 - 2
custom_components/tuya_local/translations/no-NB.json

@@ -52,6 +52,13 @@
                     "type": "Enhetstype"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Velg enhetstypen",
+                "description": "Velg typen som samsvarer med enheten din. Protokollversjon {detected_protocol} ble automatisk oppdaget og lagret. Hvis du oppdaterer enhetens firmware i fremtiden, må du kanskje konfigurere denne integrasjonen på nytt.",
+                "data": {
+                    "type": "Enhetstype"
+                }
+            },
             "choose_entities": {
                 "title": "Enhetsdetaljer",
                 "description": "Angi et navn for din enhet",
@@ -66,7 +73,7 @@
             "no_devices": "Kan ikke finne noen uregistrerte enheter for kontoen."
         },
         "error": {
-            "connection": "Kunne ikke koble til enheten med de angitte detaljene. Det kan være en midlertidig feil, eller feil med detaljene angitt.",
+            "connection": "Kunne ikke koble til enheten med de angitte detaljene. Det kan være en midlertidig feil, eller feil med detaljene angitt. Hvis du valgte en spesifikk protokollversjon, prøv 'auto' i stedet.",
             "does_not_need_hub": "Enheten trenger ikke en gateway",
             "needs_hub": "Enheten trenger en gateway"
         }
@@ -94,7 +101,7 @@
             }
         },
         "error": {
-            "connection": "Kunne ikke koble til enheten med de angitte detaljene. Det kan være en midlertidig feil, eller feil med detaljene angitt."
+            "connection": "Kunne ikke koble til enheten med de angitte detaljene. Det kan være en midlertidig feil, eller feil med detaljene angitt. Hvis du valgte en spesifikk protokollversjon, prøv 'auto' i stedet."
         },
         "abort": {
             "not_supported": "Beklager, det er ingen støtte for denne enheten"

+ 9 - 2
custom_components/tuya_local/translations/pl.json

@@ -51,6 +51,13 @@
                     "type": "Typ urządzenia"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Wybierz typ urządzenia",
+                "description": "Wybierz typ odpowiadający Twojemu urządzeniu. Wersja protokołu {detected_protocol} została automatycznie wykryta i zapisana. Jeśli zaktualizujesz oprogramowanie układowe urządzenia w przyszłości, może być konieczne ponowne skonfigurowanie tej integracji.",
+                "data": {
+                    "type": "Typ urządzenia"
+                }
+            },
             "choose_entities": {
                 "title": "Szczegóły urządzenia",
                 "description": "Wybierz nazwę dla urządzenia",
@@ -65,7 +72,7 @@
             "no_devices": "Nie udało się znaleźć żadnych niezarejestrowanych urządzeń dla konta."
         },
         "error": {
-            "connection": "Nie można podłączyć się do urządzenia z tymi danymi. To może być tymczasowy problem lub dane mogą być niewłaściwe.",
+            "connection": "Nie można podłączyć się do urządzenia z tymi danymi. To może być tymczasowy problem, lub mogą być one nieprawidłowe. Jeśli wybrałeś konkretną wersję protokołu, spróbuj zamiast tego 'auto'.",
             "does_not_need_hub": "Urządzenie nie potrzebuje bramy i taką wybrano. ",
             "needs_hub": "Urządzenie wymaga bramy"
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Nie można podłączyć się do urządzenia z tymi danymi. To może być tymczasowy problem lub dane mogą być niewłaściwe."
+            "connection": "Nie można podłączyć się do urządzenia z tymi danymi. To może być tymczasowy problem, lub mogą być one nieprawidłowe. Jeśli wybrałeś konkretną wersję protokołu, spróbuj zamiast tego 'auto'."
         },
         "abort": {
             "not_supported": "Przepraszam, to urządzenie nie jest wspierane."

+ 9 - 2
custom_components/tuya_local/translations/pt-BR.json

@@ -51,6 +51,13 @@
                     "type": "Tipo de dispositivo"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Escolha o tipo de dispositivo",
+                "description": "Escolha o tipo que corresponde ao seu dispositivo. A versão do protocolo {detected_protocol} foi detectada automaticamente e salva. Se você atualizar o firmware do dispositivo no futuro, talvez seja necessário reconfigurar esta integração.",
+                "data": {
+                    "type": "Tipo de dispositivo"
+                }
+            },
             "choose_entities": {
                 "title": "Detalhes do dispositivo",
                 "description": "Escolha um nome para este dispositivo",
@@ -65,7 +72,7 @@
             "no_devices": "Não foi possível encontrar nenhum dispositivo não registrado para a conta."
         },
         "error": {
-            "connection": "Não foi possível conectar ao seu dispositivo com esses detalhes. Pode ser um problema intermitente ou eles podem estar incorretos.",
+            "connection": "Não foi possível conectar ao seu dispositivo com esses detalhes. Pode ser um problema intermitente ou eles podem estar incorretos. Se você selecionou uma versão de protocolo específica, tente 'auto' em vez disso.",
             "does_not_need_hub": "O dispositivo não precisa de gateway e um foi selecionado. ",
             "needs_hub": "O dispositivo precisa de um gateway e nenhum foi selecionado."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Não foi possível conectar ao seu dispositivo com esses detalhes. Pode ser um problema intermitente ou eles podem estar incorretos."
+            "connection": "Não foi possível conectar ao seu dispositivo com esses detalhes. Pode ser um problema intermitente ou eles podem estar incorretos. Se você selecionou uma versão de protocolo específica, tente 'auto' em vez disso."
         },
         "abort": {
             "not_supported": "Desculpe, não há suporte para este dispositivo."

+ 9 - 2
custom_components/tuya_local/translations/pt-PT.json

@@ -51,6 +51,13 @@
                     "type": "Tipo de dispositivo"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Escolha o tipo de dispositivo",
+                "description": "Escolha o tipo que corresponde ao seu dispositivo. A versão do protocolo {detected_protocol} foi detectada automaticamente e salva. Se você atualizar o firmware do dispositivo no futuro, talvez seja necessário reconfigurar esta integração.",
+                "data": {
+                    "type": "Tipo de dispositivo"
+                }
+            },
             "choose_entities": {
                 "title": "Detalhes do dispositivo",
                 "description": "Escolha um nome para este dispositivo",
@@ -65,7 +72,7 @@
             "no_devices": "Não foi possível encontrar nenhum dispositivo ainda não registado para a conta."
         },
         "error": {
-            "connection": "Não foi possível conectar ao seu dispositivo com estes detalhes. Pode ser um problema intermitente ou podem estar incorretos.",
+            "connection": "Não foi possível conectar ao seu dispositivo com esses detalhes. Pode ser um problema intermitente ou eles podem estar incorretos. Se você selecionou uma versão de protocolo específica, tente 'auto' em vez disso.",
             "does_not_need_hub": "O dispositivo não precisa de gateway mas um foi selecionado. ",
             "needs_hub": "O dispositivo precisa de um gateway e nenhum foi selecionado."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Não foi possível conectar o seu dispositivo com estes detalhes. Pode ser um problema intermitente ou podem estar incorretos."
+            "connection": "Não foi possível conectar ao seu dispositivo com esses detalhes. Pode ser um problema intermitente ou eles podem estar incorretos. Se você selecionou uma versão de protocolo específica, tente 'auto' em vez disso."
         },
         "abort": {
             "not_supported": "Desculpe, não há suporte para este dispositivo."

+ 9 - 2
custom_components/tuya_local/translations/ro.json

@@ -51,6 +51,13 @@
                     "type": "Tip dispozitiv"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Alege tipul dispozitivului",
+                "description": "Alegeți tipul care corespunde dispozitivului dvs. Versiunea protocolului {detected_protocol} a fost detectată și salvată automat. Dacă actualizați firmware-ul dispozitivului în viitor, este posibil să fie necesar să reconfigurați această integrare.",
+                "data": {
+                    "type": "Tip dispozitiv"
+                }
+            },
             "choose_entities": {
                 "title": "Detalii dispozitiv",
                 "description": "Alegeți un nume pentru acest dispozitiv",
@@ -65,7 +72,7 @@
             "no_devices": "Nu a fost posibilă găsirea niciunui dispozitiv neînregistrat pentru cont."
         },
         "error": {
-            "connection": "Nu s-a putut conecta la dispozitiv cu aceste detalii. Poate fi o problemă temporară sau datele sunt incorecte.",
+            "connection": "Nu s-a putut conecta la dispozitiv cu aceste detalii. Poate fi o problemă temporară sau datele pot fi incorecte. Dacă ați selectat o versiune specifică a protocolului, încercați 'auto' în schimb.",
             "does_not_need_hub": "Dispozitivul nu necesită gateway și unul a fost selectat. Vă rugăm să revizuiți alegerea.",
             "needs_hub": "Dispozitivul necesită gateway și nu a fost selectat niciunul."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Nu s-a putut conecta la dispozitiv cu aceste detalii. Poate fi o problemă temporară sau datele sunt incorecte."
+            "connection": "Nu s-a putut conecta la dispozitiv cu aceste detalii. Poate fi o problemă temporară sau datele pot fi incorecte. Dacă ați selectat o versiune specifică a protocolului, încercați 'auto' în schimb."
         },
         "abort": {
             "not_supported": "Ne pare rău, acest dispozitiv nu este suportat."

+ 9 - 2
custom_components/tuya_local/translations/ru.json

@@ -51,6 +51,13 @@
                     "type": "Тип устройства"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Выберите тип устройства",
+                "description": "Выберите тип, соответствующий вашему устройству. Версия протокола {detected_protocol} была автоматически обнаружена и сохранена. Если вы обновите прошивку устройства в будущем, вам может потребоваться повторно настроить эту интеграцию.",
+                "data": {
+                    "type": "Тип устройства"
+                }
+            },
             "choose_entities": {
                 "title": "Сведения об устройстве",
                 "description": "Выберите имя для этого устройства",
@@ -65,7 +72,7 @@
             "no_devices": "Не удалось найти незарегистрированные устройства для учетной записи."
         },
         "error": {
-            "connection": "Не удается подключиться к вашему устройству с этими данными. Это может быть временная проблема, или данные могут быть неверными.",
+            "connection": "Не удается подключиться к вашему устройству с этими данными. Это может быть временная проблема, или они могут быть неверными. Если вы выбрали определенную версию протокола, попробуйте 'auto' вместо этого.",
             "does_not_need_hub": "Устройству не нужен шлюз",
             "needs_hub": "Устройству нужен шлюз"
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Не удается подключиться к вашему устройству с этими данными. Это может быть временная проблема, или данные могут быть неверными."
+            "connection": "Не удается подключиться к вашему устройству с этими данными. Это может быть временная проблема, или они могут быть неверными. Если вы выбрали определенную версию протокола, попробуйте 'auto' вместо этого."
         },
         "abort": {
             "not_supported": "К сожалению, это устройство не поддерживается."

+ 9 - 2
custom_components/tuya_local/translations/sv.json

@@ -51,6 +51,13 @@
                     "type": "Enhetstyp"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Välj enhetstyp",
+                "description": "Välj den typ som matchar din enhet. Protokollversion {detected_protocol} upptäcktes automatiskt och sparades. Om du uppdaterar enhetens firmware i framtiden kan du behöva konfigurera om denna integration.",
+                "data": {
+                    "type": "Enhetstyp"
+                }
+            },
             "choose_entities": {
                 "title": "Enhetsdetaljer",
                 "description": "Välj ett namn för enheten",
@@ -65,7 +72,7 @@
             "no_devices": "Kan inte hitta några oregistrerade enheter för kontot."
         },
         "error": {
-            "connection": "Kan inte ansluta till din enhet med dessa uppgifter. Det kan vara ett intermittent problem, eller så kan de vara felaktiga.",
+            "connection": "Kan inte ansluta till din enhet med dessa uppgifter. Det kan vara ett intermittent problem, eller så kan de vara felaktiga. Om du valde en specifik protokollversion, prova 'auto' istället.",
             "does_not_need_hub": "Enheten behöver ingen gateway och en valdes. Vänligen granska dina val.",
             "needs_hub": "Enheten behöver en gateway och ingen valdes."
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Kan inte ansluta till din enhet med dessa uppgifter. Det kan vara ett intermittent problem, eller så kan de vara felaktiga."
+            "connection": "Kan inte ansluta till din enhet med dessa uppgifter. Det kan vara ett intermittent problem, eller så kan de vara felaktiga. Om du valde en specifik protokollversion, prova 'auto' istället."
         },
         "abort": {
             "not_supported": "Tyvärr finns det inget stöd för denna enhet."

+ 9 - 2
custom_components/tuya_local/translations/uk.json

@@ -51,6 +51,13 @@
                     "type": "Тип пристрою"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "Оберіть тип пристрою",
+                "description": "Выберите тип, который соответствует вашему устройству. Версия протокола {detected_protocol} была автоматически обнаружена и сохранена. Если вы обновите прошивку устройства в будущем, вам может потребоваться повторно настроить эту интеграцию.",
+                "data": {
+                    "type": "Тип пристрою"
+                }
+            },
             "choose_entities": {
                 "title": "Налаштування пристрою",
                 "description": "Оберіть назву для цього пристрою",
@@ -65,7 +72,7 @@
             "no_devices": "Не вдалося знайти незареєстровані пристрої для облікового запису."
         },
         "error": {
-            "connection": "Неможливо підключитися до пристрою з вказаними налаштуваннями. Це може бути випадковий збій або, можливо, в налаштуваннях є помилки.",
+            "connection": "Неможливо подключиться к вашему устройству с этими данными. Это может быть временной проблемой или они могут быть неверными. Если вы выбрали конкретную версию протокола, попробуйте 'auto' вместо этого.",
             "does_not_need_hub": "Пристрою не потрібен шлюз",
             "needs_hub": "Для пристрою потрібен шлюз"
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "Неможливо підключитися до пристрою з вказаними налаштуваннями. Це може бути випадковий збій або, можливо, в налаштуваннях є помилки."
+            "connection": "Неможливо подключиться к вашему устройству с этими данными. Это может быть временной проблемой или они могут быть неверными. Если вы выбрали конкретную версию протокола, попробуйте 'auto' вместо этого."
         },
         "abort": {
             "not_supported": "На жаль, цей пристрій не підтримується."

+ 9 - 2
custom_components/tuya_local/translations/ur.json

@@ -54,6 +54,13 @@
                     "type": "آلہ کی قسم"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "آلہ کی قسم کا انتخاب کریں۔",
+                "description": "اپنے آلے سے مماثل قسم کا انتخاب کریں۔ پروٹوکول ورژن {detected_protocol} خود بخود پتہ لگایا گیا اور محفوظ کر لیا گیا ہے۔ اگر آپ مستقبل میں آلے کا فرم ویئر اپ ڈیٹ کرتے ہیں، تو آپ کو اس انضمام کو دوبارہ ترتیب دینے کی ضرورت پڑ سکتی ہے۔",
+                "data": {
+                    "type": "آلہ کی قسم"
+                }
+            },
             "choose_entities": {
                 "title": "آلہ کی تفصیلات",
                 "description": "اس آلہ کے لیے ایک نام منتخب کریں",
@@ -68,7 +75,7 @@
             "no_devices": "اکاؤنٹ کے لیے کوئی غیر رجسٹرڈ ڈیوائسز تلاش کرنے سے قاصر۔"
         },
         "error": {
-            "connection": "ان تفصیلات کے ساتھ آپ کے آلے سے منسلک ہونے سے قاصر ہے۔ یہ ایک وقفے وقفے سے جاری مسئلہ ہو سکتا ہے، یا وہ غلط ہو سکتے ہیں۔",
+            "connection": "ان تفصیلات کے ساتھ آپ کے آلے سے منسلک ہونے سے قاصر ہے۔ یہ ایک وقفے وقفے سے جاری مسئلہ ہو سکتا ہے، یا وہ غلط ہو سکتے ہیں۔ اگر آپ نے مخصوص پروٹوکول ورژن منتخب کیا ہے، تو اس کے بجائے 'auto' آزمانے کی کوشش کریں۔",
             "does_not_need_hub": "ڈیوائس کو گیٹ وے کی ضرورت نہیں ہے اور ایک کو منتخب کیا گیا تھا۔ ",
             "needs_hub": "ڈیوائس کو گیٹ وے کی ضرورت ہے اور کوئی بھی منتخب نہیں کیا گیا۔"
         }
@@ -96,7 +103,7 @@
             }
         },
         "error": {
-            "connection": "ان تفصیلات کے ساتھ آپ کے آلے سے منسلک ہونے سے قاصر ہے۔ یہ ایک وقفے وقفے سے مسئلہ ہوسکتا ہے، یا وہ غلط ہوسکتے ہیں۔."
+            "connection": "ان تفصیلات کے ساتھ آپ کے آلے سے منسلک ہونے سے قاصر ہے۔ یہ ایک وقفے وقفے سے جاری مسئلہ ہو سکتا ہے، یا وہ غلط ہو سکتے ہیں۔ اگر آپ نے مخصوص پروٹوکول ورژن منتخب کیا ہے، تو اس کے بجائے 'auto' آزمانے کی کوشش کریں۔"
         },
         "abort": {
             "not_supported": "معذرت، اس آلہ کے لیے کوئی تعاون نہیں ہے۔."

+ 9 - 2
custom_components/tuya_local/translations/zh-Hans.json

@@ -51,6 +51,13 @@
                     "type": "设备类型"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "选择设备类型",
+                "description": "选择与您的设备匹配的类型。协议版本{detected_protocol}已自动检测并保存。如果您将来更新设备固件,可能需要重新配置此集成。",
+                "data": {
+                    "type": "设备类型"
+                }
+            },
             "choose_entities": {
                 "title": "设备详情",
                 "description": "为此设备选择一个名称",
@@ -65,7 +72,7 @@
             "no_devices": "无法找到该账户的任何未注册设备。"
         },
         "error": {
-            "connection": "无法使用这些详细信息连接到您的设备。这可能是间歇性问题,或信息不正确。",
+            "connection": "无法使用这些详细信息连接到您的设备。这可能是间歇性问题,或信息不正确。如果您选择了特定的协议版本,请改为尝试“自动”。",
             "does_not_need_hub": "设备不需要网关,但选择了一个。请检查您的选择。",
             "needs_hub": "设备需要网关,但未选择。"
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "无法使用这些详细信息连接到您的设备。这可能是间歇性问题,或信息不正确。"
+            "connection": "无法使用这些详细信息连接到您的设备。这可能是间歇性问题,或信息不正确。如果您选择了特定的协议版本,请改为尝试“自动”。"
         },
         "abort": {
             "not_supported": "抱歉,不支持此设备。"

+ 9 - 2
custom_components/tuya_local/translations/zh-Hant.json

@@ -51,6 +51,13 @@
                     "type": "設備類型"
                 }
             },
+            "select_type_auto_detected": {
+                "title": "選擇設備類型",
+                "description": "選擇與您的裝置相符的類型。協議版本{detected_protocol}已自動檢測並保存。如果您將來更新設備固件,可能需要重新配置此集成。",
+                "data": {
+                    "type": "設備類型"
+                }
+            },
             "choose_entities": {
                 "title": "設備詳情",
                 "description": "為此設備選擇一個名稱",
@@ -65,7 +72,7 @@
             "no_devices": "無法找到該帳戶的任何未註冊設備。"
         },
         "error": {
-            "connection": "無法使用這些詳細資訊連接到您的裝置。這可能是間歇性問題,或資訊不正確。",
+            "connection": "無法使用這些詳細資訊連接到您的裝置。這可能是間歇性問題,或資訊不正確。如果您選擇了特定的協議版本,請改為嘗試'auto'。",
             "does_not_need_hub": "設備不需要網關,但選擇了一個。請檢查您的選擇。",
             "needs_hub": "設備需要網關,但未選擇。"
         }
@@ -93,7 +100,7 @@
             }
         },
         "error": {
-            "connection": "無法使用這些詳細資訊連接到您的裝置。這可能是間歇性問題,或資訊不正確。"
+            "connection": "無法使用這些詳細資訊連接到您的裝置。這可能是間歇性問題,或資訊不正確。如果您選擇了特定的協議版本,請改為嘗試'auto'。"
         },
         "abort": {
             "not_supported": "抱歉,不支援此設備。"

+ 2 - 0
tests/test_config_flow.py

@@ -324,6 +324,7 @@ async def test_async_test_connection_invalid(hass, mocker):
     )
     mock_instance = mocker.AsyncMock()
     mock_instance.has_returned_state = False
+    mock_instance._api = mocker.MagicMock()
     mock_device.return_value = mock_instance
     device = await config_flow.async_test_connection(
         {
@@ -374,6 +375,7 @@ def setup_device_mock(mock, mocker, failure=False, type="test"):
 async def test_flow_user_init_data_valid(hass, mocker):
     """Test we advance to the next step when connection config is valid."""
     mock_device = mocker.MagicMock()
+    mock_device._protocol_configured = "auto"
     setup_device_mock(mock_device, mocker)
     mocker.patch(
         "custom_components.tuya_local.config_flow.async_test_connection",