Open katonagl opened 1 year ago
That does happen to with some devices.
Did you try this?
import tinytuya
import time
d = tinytuya.OutletDevice(DEVICEID, DEVICEIP, DEVICEKEY)
d.set_version(3.1)
data = d.status()
print(data)
print(" > Wait 5 sec < ")
time.sleep(5)
print(" > Request Update < ")
result = d.updatedps()
# some require params that you wish updated
#result = d.updatedps(['18','19','20'])
print(result)
print(" > Fetch Status Again < ")
data2 = d.status()
print(data2)
print("")
print("Before %r" % data)
print("After %r" % data2)
You could also try: https://github.com/jasonacox/tinytuya/blob/master/examples/monitor.py
d.updatedps()
was the way to go for me.
I had the same problem that every time I read:
tuyapower.deviceJSON(PLUGID2,PLUGIP2,PLUGKEY2,PLUGVERS2)
I received "frozen" values - for example for 1 hour voltage was exactly the same.
So I modified the script so that before calling for deviceJSON I'm doing:
device = tinytuya.OutletDevice(PLUGID, PLUGIP, PLUGKEY)
device.set_version(3.3)
device.updatedps()
Thanks to that I'm always getting newest data :) maybe this will be useful for somebody
My Gosund SP1 power meter plug does not refresh power data unless the smartlife app is running. I have tried all DPS update tricks found but no success. What can be the problem? The final goal would be to use it completely offline, i.e. without internet access.