Hi Everyone,
I have just bought a 2 gang light switch from Aliexpress (https://bit.ly/2qirAM8). It’s model number is SM-SW102U.
Blockquote 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”.
I thought that I would easily get this up and running using the existing Tuya work that has been done. https://github.com/sean6541/tuya-homeassistant / GitHub - clach04/python-tuya: Python interface to ESP8266MOD WiFi smart devices from Shenzhen Xenon. NOTE I'm not using any devices with this library so I can't test :-(
Unfortunately, the tuya protocol on this switch seems to be slightly different. I have used WireShark whilst registering the device and the packets are different. See below:
POST /gw.json?a=s.gw.token.get&gwId=01200950ecfabc795eb3&other={“token”:“7wBxo260”,“region”:“AZ”,“tlinkStat”:{“configure”:“smartconfig”,“time”:6,“source”:“station”,“path”:“multicast”}}&t=7&v=3.0&sign=cd5c887908064c32c8f8185ac32ffbf5 HTTP/1.1
POST /gw.json?a=s.gw.dev.pk.active&gwId=01200950ecfabc795eb3&other={“token”:“7wBxo260”}&t=1523597921&v=3.0&sign=84da2c27ddbf551ec2f0938c0790c7d6 HTTP/1.1 (application/x-www-form-urlencoded)
POST /gw.json?a=s.gw.update&gwId=01200950ecfabc795eb3&t=1523598924&v=2.0&sign=01468796fe75f6b66f2e5a8e67533349 HTTP/1.1 (application/x-www-form-urlencoded)
POST /gw.json?a=atop.online.debug.log&gwId=01200950ecfabc795eb3&t=1523578928&sign=56d0cf5a79efac8fc4fde30f7a4740e5 HTTP/1.1 (application/x-www-form-urlencoded)strong text
POST /gw.json?a=s.gw.dev.timer.count&gwId=01200950ecfabc795eb3&t=1523578939&sign=dc95e227bbd7bd6ca5036e1c68cd99f4 HTTP/1.1 (application/x-www-form-urlencoded)
The code to implement https://github.com/sean6541/tuya-homeassistant looks like the below:
switch:
- platform: tuya
host: xxx.xxx.xxx.xxx
local_key: xxxxxxxxxxxxxxxx
device_id: xxxxxxxxxxxxxxxxxxxx
switches:
switch1:
friendly_name: Switch 1
id: 1
switch2:
friendly_name: Switch 2
id: 2
switch3:
friendly_name: Switch 3
id: 3
switch4:
friendly_name: Switch 4
id: 4
I now know the host, device_id, but cannot seem to identify to the local_key from what I have from WireShark.
Has anyone got one of these working? Or could make some suggestions it would be greatly appreciated!
Fastrax