Replies: 2 comments 6 replies
-
Packets with the 'protocol' header means it is either a response to a command or an asynchronous update. Are you calling .receive() without an accompanying request anywhere? Async updates are going to mess with your flow if not. I recommend doing something like this to read all the unexpected async updates: if [something about data is unexpected]:
while data and 'Err' not in data:
data = d.receive() |
Beta Was this translation helpful? Give feedback.
-
When I used persistent mode I found that status updates were delayed by several seconds, and lots of data points were simply dropped. |
Beta Was this translation helpful? Give feedback.
-
I have encountered a problem. I have a script that gets the status from an Energy Meter every 10s. In most cases, I get the measurements in the correct format, something like this:
{'dps': {'1': 28123, '2': 11684, '101': 9099, '102': 'REVERSE', '104': 'REVERSE', '105': 12942, '106': 28123, '107': 3633, '108': 0, '109': 8051, '110': 92, '111': 4913, '112': 2496, '113': 3929, '114': 5186, '115': -22041, '116': 1000, '117': 1000, '118': 1000, '119': 1000, '121': 99, '122': 1000, '123': 1000, '124': 1000, '125': 1000, '127': 1000, '128': 1000, '129': 10}}
However, every now and then, I am getting the following value returned from a status call:
{'protocol': 4, 't': 1706791016, 'data': {'dps': {'112': 2519}}, 'dps': {'112': 2519}}
This is a reduced set of measurement values (just one in fact) with an additional protocol 4 header and a timestamp. I am not sure why this is happening. Any ideas?
When I get such a status, I am reading the status continuously (without any delay) until I receive a standard status.
This is working fine most of the time, however, sometimes TinyTuya gets stuck with status values starting with protocol 4, and therefore incomplete data. This can happen when I switch off and on my Energy Meter. The only way to get TinyTuya to return the correct status again is by restarting my script. Is there a clean way how I can re-initialise the class? I am using the OutletDevice class.
Beta Was this translation helpful? Give feedback.
All reactions