jasonacox / tuyapower

Python module to read status and energy monitoring data from Tuya based WiFi smart devices. This includes state (on/off), current (mA), voltage (V), and power (wattage).
MIT License
140 stars 22 forks source link

`tuya.deviceInfo` hanging if device not available? #31

Open gaiking-uk opened 1 year ago

gaiking-uk commented 1 year ago

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.

For context

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.