You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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-secondsleep
command and expected loop back to the beginning, the script doesn't output anything again.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 otherwisetuyapower
will stop working(?)For context
tuyapower
returns 0 for that devicetuyapower
to hangQuery / 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 thejson
file (regardless whether or not they are online?The text was updated successfully, but these errors were encountered: