Comments (10)
See https://github.com/clach04/python-tuya/blob/master/pytuya/__init__.py#L264 for technique that appears to work reliably.
from tuyapi.
That looks like it could work, but isn't there usually stuff after the data payload that your code doesn't remove?
from tuyapi.
I've not seen any packets like that and there haven't been any user reports yet.... doesn't mean there won't be some though :-)
There are at least two Home Assistant users so they would have reported if they had seen a packet like that. HA will hammer away on devices for status updates a few times every minute. Most users are switch users (and maybe a bulb user) so it may depend on the device?
That being said, my current code could benefit from adding some protection code to dump out packets under error conditions for postmortem debugging - I'm not sure I'm going to get around to that though :(
from tuyapi.
Forgot to add, that code is about 4 months old - so its been out in the wild for a while.
clach04/python-tuya@8d70404
from tuyapi.
Do you happen to have any examples of encrypted data packets being returned (when setting the status)? My device returns packets like this:
000055aa00000000000000080000008b00000000332e3164316439613931613733356239373937594b69334b424c686f2b452b5958546d7550594b6e536974354c6f4741334d6746594e6169434174687330366c68334135494c555375344541627848585342506f79302b314d6a5a6c54475279304f796f44325a647677706e54544c3237773064526d774a7a5a334f7a6b3dd72badbe0000aa55
EDIT: Github won't correctly format the bytes that have no ASCII representation, you'll have to go here to convert the above hex string.
from tuyapi.
@codetheweb that looks exactly like what I had to handle. I do not have an example payload, that's the point I was trying to make above about adding logging on error for postmortem, its also a weakness in the test suite I have sigh.
I recall setting timers and then hammering the device to induce this . If I had a log I'd email it privately as one could in theory derive the key ;) - but I don't (not near a device at the moment). I did post a tool somewhere for decrypting arbitrary packets let me see where I posted that....
from tuyapi.
decrypting arbitrary packets posted to #5 (comment) - not used this in ages as not seen any packets I couldn't parse.
from tuyapi.
Oh, my bad; I didn't see line 233 π. I couldn't figure out how you managed to successfully decrypt the above payload without remove the prefix and suffix. Never mind.
from tuyapi.
@clach04 FYI on at least my test plug devices pressing the physical button on them to change their state results in.an encrypted message. The content is the same as a normal status response but also includes a time stamp and one other field that isnβt needed. So status poll non encrypted, user actions are. Also I found at startup the devices will send one packets stating the json object is invalid (including a cute misspelling of unvalid) on the second status poll this goes away. Only found it unplugging/replugging devices to test my reconnection code.
from tuyapi.
Fixed in 2fb33c0.
from tuyapi.
Related Issues (20)
- Some of my localtuya devices periodically become unavailable HOT 2
- App show "no access". I turn on all permissions when creating new Cloud Project. And I cheched my region. All right. HOT 1
- Implement 3.5 protocol
- Setting brightness overrides color / set multiple properties only applies last HOT 2
- Weird encrypted response from tuya bulb ? HOT 6
- Philips Avent Baby Monitor uses Tuya HOT 3
- Virtual device timed out HOT 1
- Tuya IOT Platform error 1106: permission deny HOT 1
- Cannot install with "npm install codetheweb/tuyapi" HOT 1
- device.get() never returns HOT 9
- Not being able to connect using device.connect() HOT 7
- tuya-cli get does not work, ECONNRESET error. HOT 1
- 302 status on my TuyaPlatform plugin HOT 1
- `dp-refresh` fire for all devices of the gateway instead of the only one concerned HOT 1
- is there a breaking change at tuya ? HOT 6
- Use Insecure Algorithm AES-ECB as Default Encryption Method HOT 1
- npm install codetheweb/tuyapi Infinite loading occurs during installation.
- virtual ID HOT 1
- Just lost all my Local Tuya devices HOT 1
- Smart plug doesn't return Received data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tuyapi.