Replies: 15 comments 21 replies
-
Hi @vjbutt can you detail or link about the Tuya device (WiFi Dual Meter)? I have had a few older devices that would stop responding to the local network requests but would continue to work with the cloud (Smart Life). Power cycling them was the only that that would fix them. It would be interesting to see if you could run a monitoring loop with a persistent connect to see if that helps. See https://github.com/jasonacox/tinytuya/blob/master/examples/monitor.py as an example. |
Beta Was this translation helpful? Give feedback.
-
@jasonacox thanks for your suggestions, I will try that plus a few other things. It seems that I have bought one of these older devices :(. The error that I reported above is wrong (that was actually due to a missing DP ID in one of the returned data). The actual error that I am getting when the WiFi Dual Meter gives up on the local connection is: {'Error': 'Check device key or version', 'Err': '914', 'Payload': None} The device key is definitely correct, because when I power cycle the device it works. I will next check the version. I am currently setting this to 3.4, as is reported by the device, but maybe I should set this to 3.3. |
Beta Was this translation helpful? Give feedback.
-
@jasonacox I have tried setting the version 3.3, but tinytuya does not even manage to get the status. So the correct value to set is actually 3.4. I still need to find some time to check with a monitoring loop over a persistent connection. BTW the device is this one - https://www.amazon.co.uk/Energy-Electricity-Monitor-Control-Management/dp/B0CDXF3J1K/ref=cm_cr_arp_d_product_top?ie=UTF8 Haven't managed to find a link to the manufacturer though :-( |
Beta Was this translation helpful? Give feedback.
-
@uzlonewolf that was exactly what I was thinking, that somehow there must be some memory corruption. However, today I was surprised to note that the device started to respond to status updates again after about 1 hour of giving {'Error': 'Check device key or version', 'Err': '914', 'Payload': None} (without necessitating a power cycle). So maybe it is not memory corruption. Furthermore, just before it started to respond correctly again to status queries, it returned the following status: {'protocol': 4, 't': 20, 'data': {'dps': {'2': 1887}}, 'dps': {'2': 1887}} It seems to me that the device is somehow switching to protocol 4. Why should it do this is beyond me. The problem is that tinytuya does not support version 4, so maybe those error messages were being generated because the device switched to version 4. Note that these protocol 4 messages are being received also in between correctly received status updates. They seem to be returned quite at random. One other thing to note is that the time stamp ('t':20) returned in the above status seems to indicate that the device had rebooted. From previous protocol 4 status messages, it is clear that this is a Unix timestamp. So a timestamp of 20 seems to indicate that not even the real-time clock on board of the device had yet been updated before this status was returned. This may indicate a more serious case of memory corruption. Will keep monitoring. |
Beta Was this translation helpful? Give feedback.
-
@uzlonewolf, indeed that is now my impression as well. The presence of these protocol 4 packets increases drastically when I've set set_socketPersistent(True). They basically contain a very small subset of the DPS data that eventually follows in a full data payload. Interestingly, setting a persistent connection also seems to have solved my problem in that the device is still alive and supplying "valid" data after more than 24 hours of continuous operation. However, it has now created a new problem. The status command is returning repeated payloads. I still see the measurements being updated on the Smart Life app, but not in tinytuya. As a consequence the returned data is practically useless. I have tried to force the update of the DPS using the function updatedps() but this does not seem to resolve the issue. Why would a persistent connection cause repeated payloads and not return the actual data being measured? Note that I am only reading the status every 10s, which is compatible with the value set in the report rate control. |
Beta Was this translation helpful? Give feedback.
-
Got the same situation with this device: |
Beta Was this translation helpful? Give feedback.
-
I have a similar problem with a Ciarra cooker hood. I was connected to it and it was happily reporting status, and suddenly it started returning the same error. I was running this:
.. and it just stopped:
Now it reports the same error every time I try to connect. The Android app was working, and a power cycle seems to have fixed it for tinytuya too. |
Beta Was this translation helpful? Give feedback.
-
Same here, with this heater: https://eurom.nl/en/product/permanent-heating/bathroom-heaters-permanent/sani-bathroom-radiator-1000-wifi-white/ Stops responding after a while (several hours), and complains about the key not being valid. 2 Smartplugs that I'm polling work fine. A power cycle for the heater does resolve the situation (for a while). |
Beta Was this translation helpful? Give feedback.
-
same problem with a Wifi Power meter, it worked for a month, then started like this.... the bad is that I couldn't find a way to powercycle it, even from the app, and that's a mess, because it is needed a physical powercycle. |
Beta Was this translation helpful? Give feedback.
-
Hi, similar issue with a unit described as "Tuya Smart 2 Way WiFi Energy Meter Bidirection 2 Channel with Clamp" I bought from ebay in 2023. The listing has been removed so I can't post a link. It normally works for weeks or months then seems to need a power cycle to get it going again. Yesterday and today it's done it several times! I get a mixture of these errors: I can't see any model number on the case of the device - only the front is printed: Shout if you want more details / want me to run some debug code... |
Beta Was this translation helpful? Give feedback.
-
Same issue with EARU Eelectric Wi-Fi Two-way Energy Meter. The first two weeks they worked well.. Now if they work a few hours without giving me the 914 error, it's already an achievement. The only way to get them to work is to cut off the power and then turn it back on (always praying that they will work at least for a while).
Post the debug output of my code:
Thanks |
Beta Was this translation helpful? Give feedback.
-
Not sure if it helps, but just looking in the Tuya cloud Device Log I can match the timing of a locally reported set of "Network Error: Unable to Connect', 'Err': '901'" errors with the device reporting to Tuya that it was offline due to a "keepalive_timeout". The online Tuya log only seems to go back seven days - my last Err 914 was almost two weeks ago! I'll have a look at the log next time I get a 914... (The online log is here: https://platform.tuya.com/cloud/ - "Open Project", "Devices", "Debug Device", "Device Logs") |
Beta Was this translation helpful? Give feedback.
-
Got this error after 2 days of querying thing: https://www.aliexpress.com/item/1005004153509348.html Interesting thing is that I was keeping the connection open to avoid memory leaks and stuff. {"Error": "Check device key or version", "Err": "914", "Payload": null} |
Beta Was this translation helpful? Give feedback.
-
However, after that something strange and miraculous started happening. I've noticed that when I open the mobile app (Smart Life) the device starts responding again (and stops when I close it). |
Beta Was this translation helpful? Give feedback.
-
@Dronec Can you share a bit more about your setup? I cannot replicate this behavior with the Smart Life app.... I know updating the firmware restarts the device and it starts working again, any way we can trigger this reboot remotely as well? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am getting the status from a WiFi Dual Meter every 10s using tinytuya. Everything works fine for a few hours. Then I start getting the following error:
Unexpected error: <class 'KeyError'>
I can still read the meter data using the Smart Life app whilst I am getting this error. However, in order to get the status working again using tinytuya, I have to power cycle the WiFi Dual Meter. Any idea what could be wrong?
Beta Was this translation helpful? Give feedback.
All reactions