Tuya WiFi Smart Plug: Difference between revisions

From Leo's Notes
This page was last edited on 5 December 2018, at 05:38.
Created page with "To talk to the device, you need 3 things: # The device IP address # UUID / Device ID # localKey You can get this by sniffing the traffic the Android app makes with a SSL Capt..."
 
No edit summary
Line 14: Line 14:


The localKey seems to change every time the device is reconnected to the cloud.
The localKey seems to change every time the device is reconnected to the cloud.
== tuya python ==
The status output from the AWP04L smart plug looks like this. The plug has monitoring features and should return the voltage and amperage (hence the calculated wattage).
{{highlight|lang=text|code=
{u'devId': u'02200194dc4f22137d7f', u'dps': {
u'1': True,        outlet status
u'2': 0,          ??
u'5': 56,          watts (5.6)
u'4': 73,          amps (0.073 amps)
u'6': 1198        volts
}}
}}


== See Also ==
== See Also ==
* https://github.com/clach04/python-tuya
* https://github.com/clach04/python-tuya
* https://github.com/clach04/python-tuya/wiki

Revision as of 05:38, 5 December 2018

To talk to the device, you need 3 things:

  1. The device IP address
  2. UUID / Device ID
  3. localKey

You can get this by sniffing the traffic the Android app makes with a SSL Capture app. When adding a new plug, some of the requests should contain something about a 'localKey'. One of the requests should also return all devices as well as their corresponding localKey from their server.

Self Hosted

It looks like the plug currently talks with

  • mq.gw.tuyaus.com via MQTT
  • a1.tuyaus.com via HTTP

You will probably still need to allow it to connect to the cloud once. If you don't let it completely connect, some features like voltage/wattage are disabled from the output (?).

The localKey seems to change every time the device is reconnected to the cloud.

tuya python

The status output from the AWP04L smart plug looks like this. The plug has monitoring features and should return the voltage and amperage (hence the calculated wattage).

{u'devId': u'02200194dc4f22137d7f', u'dps': {
u'1': True,        outlet status
u'2': 0,           ??
u'5': 56,          watts (5.6)
u'4': 73,          amps (0.073 amps)
u'6': 1198         volts


}}

See Also