Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tinytuya server command /sync is deleting mappings in #439

Open
JRB202 opened this issue Dec 19, 2023 · 1 comment
Open

Tinytuya server command /sync is deleting mappings in #439

JRB202 opened this issue Dec 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@JRB202
Copy link

JRB202 commented Dec 19, 2023

Hi Jason,

I also discovered an other problem with mapping readings :

The tinytuya server command /sync is purging mapping descriptions in devices.json !
Obviously, following command /status/ are missing these dps_mapping.

To reproduce the problem :
On machine running tinytuya server
1° Stop server : docker stop tinytuya
2) python3 -m tinytuya wizard with correct Tuya Cloud credentials
3) nano devices.json (as just updated by wizard) and see "mapping" field containing all devices mappings
4) docker start tinytuya

  1. Open url like : http://192.168.xx.xx:8888/status/
    and see the mapping codes and values correctly displayed as last field of screen
  2. Execute http://192.168.xx.xx:8888/sync Result is Ok But ...
  3. Reopen same url as step 5 and see that mappings are not displayed anymore
  4. nano devices.json and see that mappings have been deleted from device definition
    which is cause of http://192.168.xx.xx:8888/status/ failure to display mappings

To restore correct mapping displays by server /status ,
rerun steps from 1 to 4
and do NOT execute http://192.168.xx.xx:8888/sync again !

The problem is probably localized in def getdevices from cloud.py between lines 396 and 513

@JRB202
Copy link
Author

JRB202 commented Dec 19, 2023

As temporary workaround,
this bash script could be used to regenerate correct mappings in devices.json
instead of using tinyserver command /sync

#!/bin/bash
cd ~/tinytuya
docker stop tinytuya
printf 'Y\nY\n\N\n' | python3 -m tinytuya wizard
docker start tinytuya
sleep 3 # Wait 3 seconds to let server be started before following commands
exit

@jasonacox jasonacox added the bug Something isn't working label Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants