GithubHelp home page GithubHelp logo

Comments (10)

clach04 avatar clach04 commented on May 23, 2024

See https://github.com/clach04/python-tuya/blob/master/pytuya/__init__.py#L264 for technique that appears to work reliably.

from tuyapi.

codetheweb avatar codetheweb commented on May 23, 2024

That looks like it could work, but isn't there usually stuff after the data payload that your code doesn't remove?

from tuyapi.

clach04 avatar clach04 commented on May 23, 2024

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.

clach04 avatar clach04 commented on May 23, 2024

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.

codetheweb avatar codetheweb commented on May 23, 2024

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.

clach04 avatar clach04 commented on May 23, 2024

@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.

clach04 avatar clach04 commented on May 23, 2024

decrypting arbitrary packets posted to #5 (comment) - not used this in ages as not seen any packets I couldn't parse.

from tuyapi.

codetheweb avatar codetheweb commented on May 23, 2024

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.

BillSobel avatar BillSobel commented on May 23, 2024

@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.

codetheweb avatar codetheweb commented on May 23, 2024

Fixed in 2fb33c0.

from tuyapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.