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

tuya.deviceInfo hanging if device not available? #31

Open
gaiking-uk opened this issue Jul 31, 2023 · 0 comments
Open

tuya.deviceInfo hanging if device not available? #31

gaiking-uk opened this issue Jul 31, 2023 · 0 comments

Comments

@gaiking-uk
Copy link

Hi @jasonacox,

Finally got my RPi and did some tweaks to my original python script you might remember helping me with a few months back.

Issue

The script should poll my 4 smart plugs for their current energy usage every 10 seconds, however it seems to do a one-off poll of 3 devices (writing the energy usage to a csv) but then hang... even after the 10-second sleep command and expected loop back to the beginning, the script doesn't output anything again.

  • As a workaround, if I deleted the device entry in the json file the script does then start working normally however this is not ideal as means basically hard-coding 'temporary changes' into the config file (i.e. every time I un-plug a smart plug I need to edit the json otherwise tuyapower will stop working(?)

For context

  • 2x smart plugs are online and "on", drawing power and so returning various numbers wattages, etc
  • 1x smart plug is online* but "off" and (as expected) tuyapower returns 0 for that device
  • 1x smart plug is offline (e.g. unplugged or the 240v socket is turned off, etc), these seems to cause tuyapower to hang

Query / Fix?

Assuming I have diagnosed this correctly, is there a way I can tell tuyapower to skip "offline" devices (and/or some other way to get have my script work with all 4 smart plugs in the json file (regardless whether or not they are online?

TBH, I feel like this functionality probably already exists (I've seen references to timeouts) however I'm a bit stuck trying to figure out if not this, what else could be stopping my script from working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant