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
{{ message }}
This repository was archived by the owner on Sep 4, 2021. It is now read-only.
The light connected to my device starts in the ON (True) state.. I run the following python script:
import pytuya, time
old_state=[False, False, False]
SmartLife=["", "", ""]
SmartLife[1] = pytuya.OutletDevice('02200270ecfabc8e2ff0', '192.168.20.39', 'ceb9acd336c853f2')
SmartLife[2] = pytuya.OutletDevice('04200086b4e62d121b87', '192.168.20.14', '3e637e09ea909522') #Desk Lamp
device_set={2}
for i in device_set:
data = SmartLife[i].status()
old_state[i] = data['dps']['1']
print ("*** Polling started " + time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
+ " " + str(i) + " " + str(old_state[i]) )
while True:
for i in device_set:
data = SmartLife[i].status()
state = data['dps']['1']
if (state != old_state[i]):
print time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) + " State has changed to " + str(i) + " " + str(state)
old_state[i]=state
time.sleep(0.5)
The resulting console output:
*** Polling started Thu, 28 Jun 2018 10:18:46 2 True
Thu, 28 Jun 2018 10:48:33 State has changed to 2 False
There are no timers on the device. Nor is there user intervention. The light turns off by itself. This is repeatable (and an eventuality) on multiple but not all devices.