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

Any way to re-add device to iot.tuya.com? #321

Closed szupi-ipuzs closed 1 year ago

szupi-ipuzs commented 1 year ago

Sorry this is a bit off topic, but I can see there are people here who know quite lot about tuya apps & cloud. So, I have a birdfeeder (Pinelake BF002) which basically is a tuya camera. The instructions on the box however tell you to use their own "Birdlover" app and not Tuya. I used the original one at first, then switched to TuyaApp to be able to control it via Home Assistant (which was able to re-export the video stream to Frigate). It was working fine. Until one day I inadvertently allowed Tuya App to update firmware. After that the camera was still visible and all was working in HA, so I was relieved. But then I removed it from Tuya App and now I am no able to add it again! The device is detected, the adding process follows as usual right up to the scanning of QR code - after that the App says that "device is not supported by this app". Tried that multiple times, both with Tuya Smart and SmartLife apps. Adding it to the original Birdlover app works fine, so the device itself is not broken. I suspect the new firmware broke some compatibility with Tuya cloud (on purpose?). But I have no idea how to downgrade or is it even possible...

So, I was thinking what's I can do now: 1) Wait for a new firmware and/or new Tuya App and hope it gets fixed somehow? 2) Find a way to add the device to my dev account on iot.tuya.com without actually pairing it via Tuya App. 3) Try to obtain the local key when it's paired with Birdlover app and control it with localtuya integration or similar 4)... any other ideas?

uzlonewolf commented 1 year ago

The device is detected, the adding process follows as usual right up to the scanning of QR code

I've never seen a device which requires scanning a QR code, is this something unique to the bird feeder?

As for those options, I've done 3) before (edit: for the Sylvania app, not your bird one) so that's a possibility, and 2) should be possible as well.

I suspect this has nothing to do with the firmware update. Most likely it was a back-end or app update which wasn't noticed because everything still worked until it was removed.

szupi-ipuzs commented 1 year ago

Scanning QR code seems to be specific to cloud-based cameras. The same was with Xiaomi camera. I've noticed that the birdfeeder sets up a wireless AP while pairing, so the "usual" way of pairing would probably work as well, it's just that the app chooses QR code by default. I would be most interested with option 2), as it would (i'm guessing) allow the HA integration to pick it up. This can somehow be done with @tuyapi/link ? Could you point me to some description on how to set it up?

uzlonewolf commented 1 year ago

I had tripped over option 2) back when I was trying to get my Sylvania bulbs to cooperate and it took me a while to find it again: https://github.com/codetheweb/tuyapi/blob/55795913ffefba1fe01dbe1c73e863d28337417e/docs/SETUP.md#linking-a-tuya-device-with-smart-link

If they did something server-side to lock it to that app then I don't think this is going to work. Instead you'll need to use option 3). Once you have the details for that app you should be able to drop it into https://github.com/FlagX/ha-ledvance-tuya-resync-localkey to get automatic key syncing with HA (discussion thread: https://community.home-assistant.io/t/ledvance-integration-this-is-how-to-do-it-as-per-08-22/449783 ); you'll just need to replace the values in const.py with the ones for that app.

szupi-ipuzs commented 1 year ago

Thanks for the very useful links, I got the local key and even the secret keys for the app! Will try to integrate it with HA using localtuya or tuya-local integrations.