[OBSOLETE] Geekbes Smart WiFi Mini Plug - Somebody Please come up with a Device Handler (uses Tuya SmartLife app)

Does the maker of that plug have an open API? That’s typically a first step.

These are on sale again.

Question is if there isn’t a DH that will make these work, can we use node to get these to work like we have to do with the TP-LINK plugs?

How do we go about figuring that out?

Any idea what chip is inside these things? Looks like a common chip is an esp8266, which seems like it might be easy to reprogram and get working.

I ordered a 3 pack to play with.

This would be awesome.
PLEASE keep us posted.

I couldn’t pass up on the deal 3 outlets for $26.

Hope we can figure something out.

check out the sonoff thread. If these have an esp8266, might be good chance they might take the firmware that was created for them.

I ordered mine from newegg coming from china, so probably going to be a while before i get my hands on them.

I received mine a few days ago.

I think a smartapp which connects to “Smart Life” needs to be created.
This is how Google Home connects to device

Just got mine today and was able to reflash the wifi chip.

If you use any of this information and burn your house down or electrocute yourself or someone else, you’re doing so at your own risk. I’m not responsible.

I used alot of the information on from the tasmota wiki for the sonoff devices in order to get this flashed.

It is in fact an ESP8266, and I was able to flash the tasmota firmware once i got the unit disassembled. There is a breakout board labeled “cdtech” which has all the pins labeled which made the wiring up to my FTDI pretty easy.

~/Downloads/esptool-2.2$ sudo python esptool.py -p /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 sonoff.bin
esptool.py v2.2
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 488080 bytes to 337379...
Wrote 488080 bytes (337379 compressed) at 0x00000000 in 29.9 seconds (effective 130.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

Couple of things to note:

  1. Its somewhat difficult to get this apart. I broke the wifi antenna when my screw driver slipped when trying to pry the face off, luckily it still has some of it and does still work… The ground pin also broke off when trying to get the PCB out of the case. I soldered it back on well enough to test it.
  2. The button on the PCB is not wired the same as the sonoff’s and can not be used to put the ESP8266 into bootloader mode. I had to wire a temporary switch from GND to GPIO0/IO0 on the CDtech PCB.
  3. I had to flash a “custom” version of tasmota with my wifi SSID and password built in, as the button does not work to put tasmota in “AP Mode” like it does with the sonoff’s. Once it had my wifi info, it was able to connect up to the wifi without issues.
  4. Once flashed and connected to my wifi, toggling the switch from the wifi seems to only toggle the button’s light, not the internal relay. I played a little bit with the “Configure Module” options, but didnt get it working. I might need to pull it apart again and figure out which GPIO the relay is connected to.


A few more pictures of the wifi module and the exposed pins. I found that IO12 controls the LED.



More progress today.

GPIO12 – Blue LED
GPIO13 – Button
GPIO15 – Relay

I was able to get it working in tasmota by adding the following section to sonoff_template.h file.

{ “Geekbes”, // Geekbes\CDTech (ESP8266)
GPIO_USER, // GPIO00
0, // GPIO01 Serial RXD and Optional sensor
GPIO_USER, // GPIO02
0, // GPIO03 Serial TXD and Optional sensor
0, // GPIO04
0, // GPIO05
0, 0, 0, 0, 0, 0, // Flash connection
GPIO_LED1, // GPIO12 Blue LED (0 = On, 1 = Off)
GPIO_KEY1, // GPIO13 Button (0 = On, 1 = Off)
GPIO_USER, // GPIO14
GPIO_REL1, // GPIO15 Relay
GPIO_USER, // GPIO16
0
}

After doing all of the above, somehow I stumbled upon some new information!



This isn’t a complete solution for Smartthings integration yet, but should eventually result in one without having to flash the firmware.

I was able to test out the script that codetheweb\tuyapi has listed on the github and can confirm it works with the Geekbes plug.

You need to get some information from when the plug initially pairs with the wifi and Smart Life app(localKey,devId/uuid). See below.

I also pieced together enough of a device handler and a nodejs script (both hacked up from Dave Gutheinz’s TPLink DHT/nodejs) to get it to cycle the plug state from within the smartthings app, just like the test script on the tuyapi github does, but no on/off or status checks are working in ST.
I’m going to continue working on the device handler and node script, but this is my first attempt at either.

The below instructions were taken from taken from the m4rcus.TuyaCore github to get the required info using android adb commands.

Retrieving Tuya Plug ID and LocalKey values:

    Install the Tuya Smart Life App onto your device
    Install ADB on your computer: https://www.xda-developers.com/install-adb-windows-macos-linux/
    Ensure your device has USB debugging enabled
    Plug device into your computer
    Run filtered ADB logcat via shell:

    > adb shell
    > logcat | grep BindDeviceSuccessPresenter

    Add the smart plug in the Tuya App, monitor the adb logcat output for the following
    Find the "localKey" and "devId" keys listed in the output, ex:

    12-06 23:58:53.544 17782 17782 D Tuya    : BindDeviceSuccessPresenter updateList devIds:[{"ability":0,"attribute":0,"bv":"5.06","cloudOnline":true,"devId":"0120015260091453a970","encrypt":false,"gwType":"s","i18nTime":0,"iconUrl":"https://images.tuyaus.com/smart/icon/1496461963_0.jpeg","isLocalOnline":false,"isOnline":true,"lat":"","localKey":"5f5f784cd82d449b","lon":"","name":"WiFi Plug ","pv":"2.1","rnFind":false,"runtimeEnv":"prod","supportGroup":false,"switchDp":0,"time":1512626328,"uuid":"0120015260091453a970","verSw":"1.0.4"}]

    In this example, the LocalKey is 5f5f784cd82d449b and the Id is 0120015260091453a970
    Find the IP address of your device via your router's DHCP leases. The IP address reported by the app is not the local IP address.

	The localKey changes when you remove and re-add the device from the Smart Life app.

Here is my github for the device handler and node script for these plugs. Last night was the first night that it survived the night, so I’m hoping some of the issues i had were corrected.

It requires codetheweb/tuyapi(npm install codetheweb/tuyapi) to be installed, and it runs on port 8083.

You need to set static IP’s for the plugs and get the devID and localKey as mentioned above.

Let me know how it works for you guys. I’m sure it needs some work still.

Get the local_key is a PIA. I suggest everyone send feedback within the Tuya app asking them to display the local_key under Device Info within app.

I did, i think if enough people ask they would add it

Does anyone have detailed steps how to make the geekbes ym-ws-1 smart plugs work with Samsung Smart Things? I have been following this discussion but not quite sure what would need to be done. Flash, don’t flash. Used ADB to update.

If someone could provide the steps I would really appreciate the information.

Thanks

Only sure fire way to get these things working at the moment is by flashing them with tasmota. Problem here being the difficulty of popping the cases on these things without destroying them. A dremel tool to the back of the case might be able to expose the GPIO/TX/RX pins i had identified earlier.

The other way is with TuyAPI, no flashing. Requires retreiving the localkeys and dev id. I had a node script and device handler working partially, which is on my github listed above, The problem here was something would happen to cause the connection to the plug go haywire. About the time I was working through that, TuyAPI was updated. I was learning both the javascript and the groovy DHT as I was going. I haven’t got around to re-working the node script since the TuyAPI changes. I’m not sure when I will have time to pick it up again.

Personally, I am hoping TuyAPI comes up with a method flashing these devices with a custom firmware(tasmota). Some of the recent progress they have made around getting API keys, etc… might go a long way towards that.

Sorry I dont have any more detailed step-by-step instructions.

1 Like

Depends on your need. If you need instant reaction, get ST or Iris smartplugs.
If your use case allows flexibility, use the geekbes plugs with IFTTT as your intermediary.

Thanks. I was hoping there was something more like a firmware flash directly, but not yet.

I am already using IFTTT but was looking for something in the Smart Things app since it doesn’t see the plugs

You can “fake it out” using virtual/simulated smart outlets so that ST indeed can know and report, and act on, the on/off status of the plug. As well as command the plug to turn on/off. There are plenty of posts on these forums about how to do this.

I am trying for find an example of how to use these through Smart Things as a virtual outlet. I created an outlet using the information I found but I am not seeing how to connect the smart plug to the virtual outlet.