-
Notifications
You must be signed in to change notification settings - Fork 55
Home
Welcome to the python-tuya wiki!
Dumping ground for things related to devices and software:
- Home Assistant support - see https://github.com/home-assistant/home-assistant/pull/11000
- Need to determine device id and key? Check out https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md which requires a dev key or https://github.com/clach04/python-tuya/wiki/Setup - NOTE this is significantly easier under Android than iOS.
- Also see https://github.com/Marcus-L/m4rcus.TuyaCore#retrieving-tuya-plug-id-and-localkey-values and using adb to trace "Tuya Smart Life".
- The Tuya Smart Life app v2.8.1 download old version (https://www.apkmonk.com/app/com.tuya.smartlife/#previous) rather than the play store (https://play.google.com/store/apps/details?id=com.tuya.smartlife&hl=en_US). Play store version does not expose the localKey without rooting the device
- The Jinvoo Smart app v1.0.3 download old version (https://github.com/clach04/python-tuya/wiki/bin/Jinvoo%20Smart%201.0.3.apk) rather than Play store version (https://play.google.com/store/apps/details?id=com.xenon.jinvoo) can also be traced with adb (or logcat tools like https://play.google.com/store/apps/details?id=rs.pedjaapps.alogcatroot.app on device) but the search string to look for is
D/Business ggg
. - eFamilyCloud app v1.0.7 download old version (https://github.com/clach04/python-tuya/wiki/bin/eFamilyCloud%201.0.7.apk) rather than Play store version (https://play.google.com/store/apps/details?id=com.efamily.cloud) stores things in cache in a file location that does not require root, in
/sdcard/Android/data/com.efamily.cloud/cache/
. See https://github.com/codetheweb/tuyapi/issues/5#issuecomment-357347564 - note includes schema too (IP address in json is WAN, LAN is in log file not in json), along with WiFi name and password
- Need to use Jinvoo Smart App to register device, https://play.google.com/store/apps/details?id=com.xenon.jinvoo - see note on "determine device id and key" above
- Registering device has two modes:
- default (blue LED flashes 2 times every 2 secs), not sure but suspect device is looking for a specific named WiFi SSID with a password technique used by other devices, e.g. https://github.com/arendst/Sonoff-Tasmota/wiki/SonOTA---Espressif2Arduino---Tasmota-without-compiling - press power switch for 6 secs to enter/switch registration modes
- HostAP mode (blue LED flashes 1 time every 2 secs), device will act as a WiFi AP (SSID "SMartLife xxx"), which phone then connects to (not sure what happens after that, presumably the same as for default, probably communication over port 6668
- Registering device has two modes:
- https://github.com/codetheweb/tuyapi/issues/5 information on some of the protocol that is not yet implemented as code
- https://wikidevi.com/wiki/Xenon_SM-PW701U device that this project can control (works on 110V and 240V)
-
https://bitbucket.org/xoseperez/espurna/overview replacement firmware for ESP8266 based smart devices/switches
- https://bitbucket.org/xoseperez/espurna/pull-requests/36/add-support-for-xenon-sm-pw702u-wifi-smart/diff support for Xenon_SM-PW701U
- https://fccid.io/2AJ5F-SM-PW701U/Letter/Model-Differences-Description-3200194/ is documentation from Xenon to the FCC declaring "models SM-PW701U, SM-PW702, SM-SW801, SM-SW102, SM-S0301, SM-PZ701, SM-PZ702, SW-SZ801, SM-SZ202, and SM-SZ301 contain identical circuitry". NOTE SM-S0301-US may well have the same circuitry (I've not taken a device apart to confirm) but it does have a slightly different payload/protocol compared with SM-PW701U (due to different switches).
When removing a device from Jinvoo Smart App and then re-adding it, the localkey changes.
The devices register with DHCP with the name ESP_last_three_bytes_of_mac.
Looking at the FCC internal photos confirms its an ESP8266MOD device (see https://apps.fcc.gov/oetcf/eas/reports/ViewExhibitReport.cfm?mode=Exhibits&RequestTimeout=500&calledFromFrame=Y&application_id=6pPi3ddGo42B1Wg9IxSXTw%3D%3D&fcc_id=2AJ5F-SM-PW701U and then click on "Internal Photos").
Device spreadsheet https://docs.google.com/spreadsheets/d/1zMh_r9fq6Dw-pQQcjpleUle0Yj45VVUC3lbm0Js32Rw/edit?usp=sharing - list of devices and start of devid to see if this can be used to identify device types.
For single switch devices like SM-PW701U, the status json content looks like:
{"devId":"DEVICE_ID","dps":{"1":false,"2":0}}
NOTE all keys are strings.
dps.1 - is the switch status for ON(True)/OFF(False. dps.2 appears to be a timer specified in seconds. This reports the timeout that was set, 0 means stay on forever. This number does NOT go down, so if a time off of 10 secs has been set, querying status 5 secs later still shows 10.
dps.1 and dps.2 can be set. Setting dps.2 will change the state from the current state that many seconds later (i.e. if OFF, it will be turn on and vice-versa).
For multi switch devices like SM-S0301-US (4 separate AC switch controls and 1 for USB), the status json content looks like:
{"devId":"DEVICE_ID","dps":{"1":true,"2":false,"3":false,"4":false,"5":true,"6":0}}
dps.5 is the USB control.
NOTE dps.6 looks like a timer BUT it does not respond, setting to a value (when everything is OFF) results in nothing happening.
For thermostat devices like BECA BHT-6000GCLW, the status json content looks like:
{"devId": "DEVICE_ID", "dps": {"1":true,"3":41,"2":39,"5":false,"4":"1","6":false,"102":0,"103":"1","104":true}}
dps.1 is the screen display light (true or false)
dps.2 is the set point of thermostat in decimal from 10 to 70 (example: for 20,5 °C, we have to put 41)
dps.3 is the temperature in decimal measured by the thermostat with the same principle (example: for 25 °C, we have 50 return in this value)
dps.4 is operational mode: 0 = auto (schedule) 1 = manual
dps.5 - eco mode --> true = activated - false = deactivated
dps.6 - lock settings --> true = acivated - false = deactivated
Note: I have two devices, the difference is that in one of those i've disabled the external sensor (Sensor Types = In) in following dps first value is from the device with external sensor disabled, second is from factory settings
dps.102 27 - 0
dps.103 '0' - '1'
dps.104 'false' - 'true'
For others, we have to investigate ;-)