tuya-home-assistant icon indicating copy to clipboard operation
tuya-home-assistant copied to clipboard

Invalid authentication - skill id failed

Open ScndWave opened this issue 2 years ago • 13 comments

Authetication is not work.

tried all founded way, new iot project, different country codes etc.

always end up ”invalid authentication” and in log file has: This error originated from a custom integration.

Logger: custom_components.tuya_v2.config_flow Source: custom_components/tuya_v2/config_flow.py:139 Integration: Tuya v2 (documentation) First occurred: 7:03:27 PM (7 occurrences) Last logged: 9:56:03 PM

Login failed: {'code': 2406, 'msg': 'skill id invalid', 'success': False, 't': 1634838065447}

Devices is available on cloud project. Using latest hassio and fresh tuya v2

ScndWave avatar Oct 21 '21 19:10 ScndWave

I have exactly this same issue. First integration (newy sreated Tuya project, newer integrated etc.). Tried few time last days with different settings.

Log:

Logger: custom_components.tuya_v2.config_flow Source: custom_components/tuya_v2/config_flow.py:139 Integration: Tuya v2 (documentation) First occurred: 2:38:26 PM (1 occurrences) Last logged: 2:38:26 PM

Login failed: {'code': 2406, 'msg': 'skill id invalid', 'success': False, 't': 1634906306752}

System info:

Country code: 48

Version | core-2021.10.6 Installation Type | Home Assistant OS Development | false Supervisor | true Docker | true User | root Virtual Environment | false Python Version | 3.9.7 Operating System Family | Linux Operating System Version | 5.10.17-v8 CPU Architecture | aarch64

PshemoSK avatar Oct 22 '21 12:10 PshemoSK

To be clear, this error is documented in the documentation, but the documentation states that it should only happen with Tuya Cloud projects created before May 2021 - it's happening for me with a completely freshly created project.

Some Googling (e.g. here) indicates that this may be restricted to users who've selected certain countries (e.g., Australia) on their Tuya account.

werdnum avatar Oct 23 '21 21:10 werdnum

To be clear, this error is documented in the documentation, but the documentation states that it should only happen with Tuya Cloud projects created before May 2021 - it's happening for me with a completely freshly created project.

Some Googling (e.g. here) indicates that this may be restricted to users who've selected certain countries (e.g., Australia) on their Tuya account.

I ran into it when having only one DC selected, just select them all and see if it resolves

clienthax avatar Oct 24 '21 01:10 clienthax

That did not help.

On Sun, Oct 24, 2021 at 12:20 PM clienthax @.***> wrote:

To be clear, this error is documented in the documentation, but the documentation states that it should only happen with Tuya Cloud projects created before May 2021 - it's happening for me with a completely freshly created project.

Some Googling (e.g. here https://www.reddit.com/r/homeassistant/comments/qdd3sx/tuya_integration_login_error_2406_skill_id_invalid/) indicates that this may be restricted to users who've selected certain countries (e.g., Australia) on their Tuya account.

I ran into it when having only one DC selected, just select them all and see if it resolves

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuya/tuya-home-assistant/issues/619#issuecomment-950242325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACCFXUK6YQIXRMRM54VJVLUINNOLANCNFSM5GO3QVVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- — Andrew Garrett

werdnum avatar Oct 24 '21 03:10 werdnum

Same. Didn’t help even all DC’s selected. Or that cloud project was freshly made few days ago. What is confirmed combination of countrys to work?

i have now: Tuya smart app user: Finland Iot.tuya.com cloud project data center: Central Europe Iot.tuya user country: finland

hassio integration country code : 358 (Finland country code)

ScndWave avatar Oct 24 '21 10:10 ScndWave

Having the same problems for Sweden (46).

Managed to get it to work by editing this file: config\custom_components\tuya_v2\config_flow.py

Replaced the value of TUYA_ENDPOINT_OTHER to the Europe endpoint found in fromconst.py. (Or here below)

TUYA_ENDPOINTS = {
    "America": "https://openapi.tuyaus.com",
    "China": "https://openapi.tuyacn.com",
    "Europe": "https://openapi.tuyaeu.com",
    "India": "https://openapi.tuyain.com",
    "Eastern America": "https://openapi-ueaz.tuyaus.com",
    "Western Europe": "https://openapi-weaz.tuyaeu.com",
}

Changes in config_flow.py to use the "Europe" endpoint.

TUYA_ENDPOINT_OTHER = "https://openapi.tuyaeu.com"
#TUYA_ENDPOINT_OTHER = "https://openapi.tuyaus.com" #old

There are some logic to switch endpoint based on China or not. Guessing that works well for US or China but not for EU? But I am no Python expert.

            if user_input[CONF_COUNTRY_CODE] in COUNTRY_CODE_CHINA:
                api.endpoint = TUYA_ENDPOINT_BASE
            else:
                api.endpoint = TUYA_ENDPOINT_OTHER

Anyway, hope it help someone! Now I am off to automate some more awesome stuff :-)

taxx avatar Oct 24 '21 10:10 taxx

Thanks! I’ll try to do this, but I am using the ordinary integration, not the V2, so I’ll have to figure out the equivalent edit.

On Sun, 24 Oct 2021 at 21:42, taxx @.***> wrote:

Having the same problems for Sweden (46).

Managed to get it to work by editing this file: config\custom_components\tuya_v2\config_flow.py

Replaced the value of TUYA_ENDPOINT_OTHER to the Europe endpoint found in fromconst.py. (Or here below)

TUYA_ENDPOINTS = { "America": "https://openapi.tuyaus.com", "China": "https://openapi.tuyacn.com", "Europe": "https://openapi.tuyaeu.com", "India": "https://openapi.tuyain.com", "Eastern America": "https://openapi-ueaz.tuyaus.com", "Western Europe": "https://openapi-weaz.tuyaeu.com", }

Changes in config_flow.py to use the "Europe" endpoint.

TUYA_ENDPOINT_OTHER = "https://openapi.tuyaeu.com"#TUYA_ENDPOINT_OTHER = "https://openapi.tuyaus.com" #old

There are some logic to switch endpoint based on China or not. Guessing that works well for US or China but not for EU? But I am no Python expert.

        if user_input[CONF_COUNTRY_CODE] in COUNTRY_CODE_CHINA:
            api.endpoint = TUYA_ENDPOINT_BASE
        else:
            api.endpoint = TUYA_ENDPOINT_OTHER

Anyway, hope it help someone! Now I am off to automate some more awesome stuff :-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tuya/tuya-home-assistant/issues/619#issuecomment-950300757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACCFXSF2V6HPR34FB3DQ5DUIPPJBANCNFSM5GO3QVVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- — Andrew Garrett

werdnum avatar Oct 24 '21 11:10 werdnum

Thanks @taxx it works!

ScndWave avatar Oct 24 '21 15:10 ScndWave

I just realized that the code for this integration is now in home assistant! https://www.home-assistant.io/integrations/tuya/

Tested that on another instance of Home Assistant and it worked without any problems or adjustments.

More details here: https://github.com/tuya/tuya-home-assistant/blob/master/README.md#important-note

taxx avatar Oct 24 '21 15:10 taxx

The reason has been announced here https://github.com/tuya/tuya-home-assistant/issues/613#issuecomment-948646557 and indeed as stated by @taxx is an endpoint issue. maintainers recommend using the new one because this won't be supported despite the new one lacks of features.

mazzy89 avatar Oct 24 '21 17:10 mazzy89

If it can help, I fixed not only with taxx suggestion, but as well by revoking services and re-subscribe to them for the project on Iot platform.

srodighiero avatar Oct 28 '21 11:10 srodighiero

Hi! This has been fixed in the Home Assistant Core integration version. This fix will become available with Home Assistant Core 2021.11 - 3rd, November.

As we stop maintain it now, please help to create your github issues in the Home Assistant Core repository. And it's still maintained by the Tuya developer team and Home Assistant Team.

zlinoliver avatar Oct 29 '21 01:10 zlinoliver

I faced this same 2406 issue and I'm on Eastern Canada/US coast. Please see this comment , might help you figure it out.

baylanger avatar Feb 23 '22 14:02 baylanger