jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
923 stars 165 forks source link

Unable to find devices in wizard #323

Closed job2310 closed 1 year ago

job2310 commented 1 year ago

Hi, I've been using tinytuya for a while but after upgrading to the latest version, I'm unable to find my devices using the wizard. All of my details have stayed the same but it's returning 0 devices found (in the cloud). If I run the local scan it finds all 8 devices. I've double and triple checked my API key, Secret and example DeviceID but nothing seems to help.

Wondering if you might have any advice?

Many thanks, Josh

uzlonewolf commented 1 year ago

That's odd, I'm seeing this too. Seems the API we are calling suddenly stopped returning devices. I'm looking into it now.

uzlonewolf commented 1 year ago

Hmm, it seems this API is now requiring a Content-type: application/json header or it won't return anything. I'll try to release an update to fix this later today.

job2310 commented 1 year ago

Many thanks. Very odd that they would change that particular requirement at this point.

Frefdt commented 1 year ago

I've encountered this same issue, glad its been caught so fast

uzlonewolf commented 1 year ago

I have a PR in to fix this, though I like having @jasonacox look things over before I merge things just to make sure I didn't do something stupid. In the meantime, as a temporary workaround you can copy or download tinytuya/wizard.py and after line 141 add cloud.use_old_device_list = True

    else:
        cloud = tinytuya.Cloud( **config )

        # on auth error getdevices() will implode
        if cloud.error:

to

    else:
        cloud = tinytuya.Cloud( **config )
        cloud.use_old_device_list = True

        # on auth error getdevices() will implode
        if cloud.error:

and run it with python wizard.py

Frefdt commented 1 year ago

valid lmao, i'll try this in the meantime ty

On Tue, Apr 11, 2023 at 6:12 PM uzlonewolf @.***> wrote:

I have a PR in to fix this, though I like having @jasonacox https://github.com/jasonacox look things over before I merge things just to make sure I didn't do something stupid. In the meantime, as a temporary workaround you can copy or download tinytuya/wizard.py https://github.com/jasonacox/tinytuya/blob/master/tinytuya/wizard.py and after line 141 add cloud.use_old_device_list = True

else:
    cloud = tinytuya.Cloud( **config )

    # on auth error getdevices() will implode
    if cloud.error:

to

else:
    cloud = tinytuya.Cloud( **config )
    cloud.use_old_device_list = True

    # on auth error getdevices() will implode
    if cloud.error:

and run it with python wizard.py

— Reply to this email directly, view it on GitHub https://github.com/jasonacox/tinytuya/issues/323#issuecomment-1503794505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD47KWMSEOQAFGF2JN54673XAWGHTANCNFSM6AAAAAAW2EOKVI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

job2310 commented 1 year ago

Thanks so much for looking at this so quickly.

jasonacox commented 1 year ago

Release fix as v1.12.3.

pip install --upgrade tinytuya

Please report any issue.... Thanks all! 🙏

uzlonewolf commented 1 year ago

It seems Tuya made the API we were using private and is now returning a "permission deny" error instead of returning an empty list. The fix in #324 still works.