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
My apologies for the message, but I hope someone can help with the problem I am encountering.
I have four devices - two switches the same; one switch of a different type, and a "Type A" bulb.
I have written proof of concept code, and had each working independently so thought it was time to add it all together.
My code paraphrased is as follows:-
Initialisations (using deviceScan()) and counting the number of devices - also counting the number of devices from the devices.json file - although I am not sure what I will do if there is a difference - but at the moment, all four devices are detected.
I then await an external trigger, and upon that trigger, I do the following (in pseudo code):-
if bulb:
d = bulbDevice( ip address, version, deviceID, ...)
d.set_version (3.3) # Which matches the version in setting the bulb device
d.set_socketPersistent (True) # just in case I am going to do retries - but have tried without this with the same effect
data = d.status()
if "dps" is not in data:
retry
else:
if bulb_ON:
d.turn_on()
else:
d.turn_off()
and the above is repeated for the switches using OutletDevice, ....
Sometimes this works perfectly, but sometimes, one or more of the devices returns the data as not containing "dps", but is {'Err': '901', 'Error': 'Network Error: Unable to Connect', 'Payload': None}
Even retrying doesn't help - however, it was detected using the deviceScan.
I try 20 retries before giving up - but the time for each retry can vary quite noticeably.
I have mobile devices with "the" app on, and they have no trouble changing the state, so I don't believe this is a network error, or the mobile devices would not be able to connect.
The switches are the most reliable, with most working some - or most of the time, and the bulb never working!
The switches are each located within maybe a few metres of the router - and my original code was able to (mostly) control the bulb.
The differences between my proof of concept code and my new code, is mainly that there is an external (software) trigger.
Are there any suggestions as to what may be wrong in my code.
Many thanks for any help!
The text was updated successfully, but these errors were encountered:
I have mobile devices with "the" app on, and they have no trouble changing the state, so I don't believe this is a network error, or the mobile devices would not be able to connect.
Many Tuya devices will stop responding to local (e.g. TinyTuya) access requests when the SmartLife App is open. Does it work better if you close the mobile App? Also, even if the Tuya device is not available on the LAN, the SmartLife app will use the Cloud connection to manage the device.
If you are still having issues after closing the app, try running a device scan (e.g.python3 -m tinytuya scan) to see if the device is still listening and responding. Also, verify you are using the correct local key.
Many thanks indeed - I have tried a couple of times, and I have been able to connect a couple of times perfectly - but I had the app closed, and my phone locked.
I had been using the app to check on the status as the devices are scattered about so I have now managed to get the devices to respond - which is brilliant (including the bulb - and changing the colour - so thank you very much indeed - there are a few "quirks" in my code, but I can move on to get more devices operating now - so again, my sincere thanks!
My apologies for the message, but I hope someone can help with the problem I am encountering.
I have four devices - two switches the same; one switch of a different type, and a "Type A" bulb.
I have written proof of concept code, and had each working independently so thought it was time to add it all together.
My code paraphrased is as follows:-
Initialisations (using deviceScan()) and counting the number of devices - also counting the number of devices from the devices.json file - although I am not sure what I will do if there is a difference - but at the moment, all four devices are detected.
I then await an external trigger, and upon that trigger, I do the following (in pseudo code):-
and the above is repeated for the switches using OutletDevice, ....
Sometimes this works perfectly, but sometimes, one or more of the devices returns the data as not containing "dps", but is
{'Err': '901', 'Error': 'Network Error: Unable to Connect', 'Payload': None}
Even retrying doesn't help - however, it was detected using the deviceScan.
I try 20 retries before giving up - but the time for each retry can vary quite noticeably.
I have mobile devices with "the" app on, and they have no trouble changing the state, so I don't believe this is a network error, or the mobile devices would not be able to connect.
The switches are the most reliable, with most working some - or most of the time, and the bulb never working!
The switches are each located within maybe a few metres of the router - and my original code was able to (mostly) control the bulb.
The differences between my proof of concept code and my new code, is mainly that there is an external (software) trigger.
Are there any suggestions as to what may be wrong in my code.
Many thanks for any help!
The text was updated successfully, but these errors were encountered: