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

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.

Hi Blawson327,

I bought Geekbes YM-WS-1. Using dremel I managed to open it without damage to internal electronics.
I have soldered following connections:

  • TX, RX, GND, 3.3V -> FTDI
  • GND, GPIO15 -> switch
  • GPIO0 -> bootloader mode

I have a plan of retrofitting these to EU light wall switches in my apartment. Physical switch would serve as on/off switch; flashing Tasmota in order to connect Geekbes to HomeAsisstant -> turning lights on/off using connected devices.

Powered it on for the first time using FTDI - switch was working –> switching relay on and off (prior to any flashing).

After that I downloaded latest release of Tasmota (5.12.0) and followed your instructions for flashing:

  • To section sonoff_tamplate.h I added your code.
  • To section user_config.h I added my ssid and pass

Successfully flashed using following settings in IDE:
Board Mode: "Generic ESP8266 Module"
Flash Mode: DIO
Flash Frequency: 40Mhz
CPU Frequency: 80Mhz
Flash Size: 1M (64k SPIFFS)
Debug Port: disabled

But powering it on after flashing does nothing. I can not find it connected to my WIFI network.

Is there something I am doing wrong? I would kindly ask for your help :slightly_smiling_face:

You will need two IFTTT recipes per geekbes outlet. Geekbes works thru the SmartLife app.
Sooo recipe #1:

  • if SmartThings simulated Outlet switched ‘on’, Then turn on SmartLife geekbes Outlet

Recipe #2:

  • if SmartThings simulated Outlet switched ‘off’, Then turn off SmartLife geekbes Outlet

Do that, and you can automate the outlet by automating the virtual outlet you created in SmartThings.

1 Like

You need a total of 4 IFTTT recipes if you want feedback of the state into the SmartThings app.

What are the other two? I made one for on and another for off, I can’t think of two more?

Notifications of manual state changes, I think.

Does anyone have any examples how to make these work? I have the virtual device but still don’t see how to make the virtual device control the Geekbes plug.

Ok… for your “virtual device”, you went into SmartThings IDE and created a Simulated Switch… right?
What did you name that switch?

Did you set up your outlets on the SmartLife app?

If you did those things, the IFTTT recipes I noted just a couple days ago will work.

Thanks Glen. I did create a virtual switch through Samsung IDE. I can see it in Smart Things. I cannot add it to Smart Life . I don’t see how I can add the device since it is virtual and can’t be added like a physical device. That is the problem I am having. Trying to tie the virtual device to the physical geekbes device.

Do I add it to Smart Life a different way because it is virtual?

No, you don’t add that switch to SmartLife.
You go to IFTTT, and follow what I stated a few posts ago.

You will have to enable IFTTT for both SmartThings and SmartLife.
In SmartThings, you will need to add the IFTTT smart app.

It’s been some weeks so I forget the particulars of linking Smart Life to IFTTT.

In any event, once you do that you create recipes in IFTTT as specified.

Thanks Glen, just figured that out. In IFTTT (if ST virtual) (then SL plug). It needs 1 on and one off but that works.

Thanks for all the help

When the switch turns off, you need a return IFTTT recipe so that Smart Life turns the SmartThings virtual switch off. Only needed if something else can somehow control the Smart Life switch, like direct Alexa or Google Home integration. (or someone using the Smart Life app itself).

My use case is to do one thing: turn the outlet back on.

I’m using it with a three-stage “touch dimmer” which is plugged into that outlet. It’s there so that when I say to Alexa “turn off downstairs”, if the touch-dim light string is on it will be turned off. When that occurs, IFTTT tells SmartThings to turn off the simulated switch associated with that outlet, which controls the touch dimmer.

The SmartThings automation does the following: if that simulated switch turns off, turn it back on.
This in turn fires an IFTTT recipe that turns the Outlet back on.

This way, the touch dimmer is OFF but ready to use again.

I got a trio of waza round-style smart plugs that use the tuya app. Any forward progress on this? :slight_smile:

Simplify, simplify!

Changed my setup for this. Made it so IFTTT handles the on: IF SmartLife plug turns off, THEN turn on SmartLife plug. Took it out of ST entirely. No need for it to be there.

Blawson. I have been looking for custom firmware and DH for a 3-gang switch running on ESP8266 similar to the Sonoff Touch (1-gang wall swtich). The switch uses SmartLife app rather than the eWeLink app. I am wondering whether it will works with the Sonoff custom firmware and DH.

Thank you very much for your code!!! On the other hand, I am new to this automation world and if you don’t mind to guide me on the process of how to make this Tuya devices available from SmartThings app I would really appreciate it.
This is what I did:

  1. I got and installed the codetheweb/tuyapi
  2. ran your server.js file
  3. I have created a Device Handler in my Smasung account using the code you have posted.

What I didn’t understood very well is

  1. how can I do to make the device visible on my Smarthings App. As far as I know, for Sonoff integration, I have added a Device Handler and a SmartApp from my SmartThings account and I could be able to see the device.
  2. I was able to get the local key and the devid. Where I should be using those?

Thank you very much in advance!
Javier

@Blawson327
Not sure if this discussion died or not but I’m still hoping the DTH for SmartLife continues for ST.

I was able to get the server.js file running on a PI3 and installed the SmartLife DTH.
Since there is no smart app, I assume the next step is to create a device in IDE using the DTH provided. Then in profile, edit to add the DevID, Key, Gateway IP and Device IP. Tried it but got the following error in the node server when I tried to turn off the device:

(where the error occurred which means it’s trying to turn off so it is communicating with ST)
/home/pi/TuyaST/TuyAPI_Server_v1.js:87
tuya.setStatus(0, function(error, result) {
^
TypeError: tuya.setStatus is not a function
at processDeviceCommand (/home/pi/TuyaST/TuyAPI_Server_v1.js:87:9)
at Server.onRequest (/home/pi/TuyaST/TuyAPI_Server_v1.js:55:4)
at Server.emit (events.js:182:13)
at parserOnIncoming (_http_server.js:657:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)

not sure if I got the wrong file or mismatch somewhere

UPDATE: I modified the .js file to sync up with the commands in the latest codetheweb\tuyapi (example: setStatus(xxx) is now set(xxx)

Got a little further however hits this now:
deviceCommand sending to IP: 192.168.86.191 Command: on
(node:14216) UnhandledPromiseRejectionWarning: Error: Timeout waiting for response
at Timeout._sendTimeout.setTimeout [as _onTimeout] (/home/pi/node_modules/tuyapi/index.js:379:25)
at listOnTimeout (timers.js:324:15)
at processTimers (timers.js:268:5)
(node:14216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

So I assume I have something set wrong in the key or dev id but not sure yet…

Ok fixed all the issues for ST version of this thing. Can now work cleanly with any Smart Life Tuya plug to turn on and off and updated status.
Needed to update the node.js as well as the DTH quite a bit to keep up with codetheweb’s Tuya API.

Now looking to add other devices and power strips if possible. Hubitat seems to be where everyone went to do this though but still worth having on ST just in case.

1 Like

I’m just about to have a go at getting this working too!

And chance you can submit a PR to the Github with the code changes save me fishing for them myself :slight_smile: