WiFi Scene Controller with MQTT


Skip to the nonsense and just buy the thing here on Amazon: https://amzn.to/2S9MFpX

In my weirdo tech geek cruising of FCC certifications I stumbled upon an interesting 8 button scene controller by TopGreener.  It fits in a standard decora face plate, flexible to fit in whatever gang size box you choose with standard face plates. The ESP8266 based Tuya module in the internal pictures caught my attention.  I searched the stores for it but alas it wasn't for sell yet. Then the Jedi mind wipe of the holiday season happened, fast forward to January and a viewer, Buckyfan reminded me about this switch and had one in hand!  I found the switch on Amazon and ordered mine immediately.  




So what is this thing and what can I do with it?  It is designed to replace an existing light switch in your home and then add 7 other buttons with single and double tap actions.  Of course following our motto of "Get your shhhzzz... out of the cloud!" we flashed ours with Tasmota using Tuya-Convert.  It doesn't require any special template or anything, simply choose the TuyaMCU module in the Configure Module section and its practically done.  You don't even need to follow my TuyaMCU setup video as the relay/button for the standard light switch is ready to roll.



But what about the other 7 buttons?  Well first that's up to you to come up with 14 actions that you can remember what they all do.  As someone suggested in the live stream showing this switch, it would be mind boggling to put 4 of these side by side.  Just make sure you leave a book for the other household members!  The technical side of things is pretty easy.  There are two methods we will use to tackle this switch/scene controller; Tasmota Rules and NodeRed.

To do all the processing of the buttons with NodeRed, apply this rule in the Tasmota console:

Rule1 on TuyaReceived#Data do publish Scene1/data %value% endon

Then apply the following command to turn the rule on:

Rule1 1

This will make all of the serial messages from the TuyaMCU that interacts with the button presses to be sent to a custom MQTT topic of Scene1/data , you can change this topic in the rule if you want something different.

Then utilize a flow such as the following:



In the Switch Node I have 7 of the 14 buttons as logic branches to call various functions in Home Assistant or whatever you choose to do.  You could also do the same thing inside of Home Assistant automations if you are more comfortable with those.


Serial Message to Button Translations
#1 55AA00070005650400010075   Double Tap - 55AA000700056C040001007C
#2 55AA00070005660400010076   Double Tap - 55AA000700056D040001007D
#3 55AA00070005670400010077   Double Tap - 55AA000700056E040001007E
#4 55AA00070005680400010078   Double Tap - 55AA000700056F040001007F
#5 55AA00070005690400010079   Double Tap - 55AA00070005700400010080
#6 55AA000700056A040001007A  Double Tap - 55AA00070005710400010081
#7 55AA000700056B040001007B  Double Tap - 55AA00070005720400010082

An alternate look, you can move all the translations to Tasmota rules and have it push the various topics/payloads by using these rules.

rule1 on TuyaReceived#Data=55AA00070005650400010075 do publish scene/button1 toggle endon
on TuyaReceived#Data=55AA00070005660400010076 do publish scene/button2 toggle endon
on TuyaReceived#Data=55AA00070005670400010077 do publish scene/button3 toggle endon
on TuyaReceived#Data=55AA00070005680400010078 do publish scene/button4 toggle endon
on TuyaReceived#Data=55AA00070005690400010079 do publish scene/button5 toggle endon
on TuyaReceived#Data=55AA000700056A040001007A do publish scene/button6 toggle endon

rule2 on TuyaReceived#Data=55AA000700056B040001007B do publish scene/button7 toggle endon
on TuyaReceived#Data=55AA000700056C040001007C do publish scene/button1b toggle endon
on TuyaReceived#Data=55AA000700056D040001007D do publish scene/button2b toggle endon
on TuyaReceived#Data=55AA000700056E040001007E do publish scene/button3b toggle endon
on TuyaReceived#Data=55AA000700056F040001007F do publish scene/button4b toggle endon

rule3 on TuyaReceived#Data=55AA00070005700400010080 do publish scene/button5b toggle endon
on TuyaReceived#Data=55AA00070005710400010081 do publish scene/button6b toggle endon
on TuyaReceived#Data=55AA00070005720400010082 do publish scene/button7b toggle endon

Don't forget to turn on your rules with:
Rule1 1
Rule2 1
Rule3 1

Let us know what you plan to use this switch for in Discord and share
some ideas with us!






Comments

  1. Thanks for this. I bought one of these and was having a hard time integrating with HA until I saw your tasmota rules.

    Do you know if there is a way to control the LEDs next to each of the buttons? I'm trying to use this to control some input booleans, and would love if the LEDs could show the state of them. I've tried commands like TuyaSend4 101,1 but haven't figured out a way to control the LEDs.

    ReplyDelete
    Replies
    1. I tried a few sends but haven't been able to figure out how to trigger the lights. Not 100% sure if you can though as they only light when pressed and I don't see anything about that in the manual.

      Delete
    2. Does the 3-way switch work with a conventional 3 way switch? I bought one to work across 2 attached houses - dont ask, 1 is 1860s vintage being remodeled and the other was built onto that.

      Delete
    3. I haven't used it in a 3 way configuration only a 2 way.

      Delete
  2. This is prefect to work with Shelly so I can use one keypad to control four lights in my home in stead of need switches everywhere

    ReplyDelete
  3. I have one of these controllers and some RGBW LED tape lights that run off the Magic Home app. Is there any way to map the scenes from the Magic Home app to the buttons on this controller. I have not done any flashing of smart/wifi control devices. If that is the only way I guess I will get to learning:) But if there is a method I am missing without flashing that would be great.

    ReplyDelete
    Replies
    1. I should and I am using the Smart Life app for the 8 button controller.

      Delete
  4. I got one of these and am having trouble getting Tuya Convert to work. Is there anything special you have to do to get it into the right mode for tuya convert to work?

    ReplyDelete
    Replies
    1. No error. The switch is blinking fast, when I start tuya convert it stops blinking but tuya converts keep trying over and over but never connects. I am using my phone as the donor device it connects to vtrust-flash fine so I was thinking the problem was not on the tuya-convert side but the switch side.

      Delete
    2. Is this your first Tuya convert?

      Delete
    3. no, I have done 8 or 10 of them already. I had a few that did not work and soldered on the leads. But I saw this one could work with tuya-convert but I am wondering if I am not getting it into the correct mode. When I first power it up it blinks fast. I have tried with that fast blinking. If I hold button it blinks fast for a couple of seconds and stops. When it is blinking fast green, when I start Tuya-convert it stops blinking.

      Delete
    4. You check the logs for the decryption error?

      Delete
    5. I did not see any log files in the tuya-convert directory. I looked in the system logs and the only file I find "tuya" in is the auth log when it sudos.

      Delete
    6. TuyaConvert not working? Check the log files in the scripts folder: smarthack-web.log for any warnings of a non-ESP82xx device. smarthack-psk.log for "DECRYPTION_FAILED_OR_BAD_RECORD_MAC"

      Delete
  5. I just bought one of these on Amazon (US). Used tuya-convert with no issues. Now running the latest Tasmota on it. On the back of the device it said 2006Ver.1.1.2. Maybe that might help determine when they start putting the new Tuya Firmware on it.

    ReplyDelete
  6. Very excited about the switch and followed your guide and am able to see the MQTT messages in Node Red running on my Home Assistant. Is there a way to send a command back to control the AC switch from Node Red / Home Assistant?

    ReplyDelete
    Replies
    1. Just send the cmnd/yourtopic/power1 topic with a payload of on, off, or toggle.

      Delete
    2. Thanks, I will give that a try! Any chance you have attempted to migrate this to ESPhome?

      Delete
    3. No. I stick to Tasmota for pre-built devices. Esphome for me is more of custom sensor devices.

      Delete
  7. Do you know how to adapt this to be used with smartthings?

    ReplyDelete
  8. i see that it has a traveler wire, have you gotten it to work in a 3way configuration?

    ReplyDelete
    Replies
    1. It should work as designed as the TuyaMCU inside handles all the switching.

      Delete
    2. it does not. i replaced it where i had a zwave 3 way switch. Not working. May have to move it and put a martin jerry there

      Delete
    3. Did you follow their wiring diagram?

      Delete
    4. Yes, i did the 3-way wiring on the load side per my setup and their document. Will pull it apart this weekend and either fix it or replace with MJ 3-way

      Delete
    5. Thank you for all your help on here and on discord. I signed up for a year on patreon to show my appreciation. keep up the great work!

      Delete
  9. I'm trying to use this with ESPhome. Do you have a pin out for this switch? How can I figure it out myself?

    ReplyDelete
    Replies
    1. It utilizes a secondary TuyaMCU. Only two serial pins are needed. As you can see here I just grab the serial packets to determine the key presses.

      Delete
  10. Anyone figure out if there is a possibility of sending commands to the tuya MCU to control the LED's next to the scene buttons?

    ReplyDelete
    Replies
    1. I didn't see the dpIDs exposed to do this unfortunately

      Delete
  11. I can't get the standard relay/button to show up as a button or relay. I set the Module to Tuya MCU (54) but no relays show up and POWER 2 results in...

    'MQT: stat/TasmotaSceneController/RESULT = {"Command":"Error"}'

    ReplyDelete
    Replies
    1. There's only one relay on these. It is designed to replace an existing switch and add the 7 other button functions.

      Delete
    2. Yes. I have the 7 other buttons doing single and double press actions, which is awesome, but I can't control the relay for button8. I can't even figure out how to get the relay to show up on the main menu page. I've tried setting all unused GPIO's to relays but none of them turn button8 on/off. I do see TUYARECEIVED#DATA=55AA0007000501010001010F and TUYARECEIVED#DATA=55AA0007000501010001000E in the console when I toggle button8 on/off.

      Delete
    3. Did you change the device to TuyaMCU in configure module? It should bind automatically to relay1.

      Delete
    4. Yes, changed the Module to Tuya MC (54) but it had no effect. I was able to send web commands to a Shelly device using 'on TUYARECEIVED#DATA=' of button8's on/off. I then set up that same Shelly to do a URL Hit to /cm?cmnd=tuyasend1%201%2C0 when the Shelly output is switched off. This keeps the Scene Controller button8 LED in sync with the Shelly relay (which I have working like a 3-way switch). I still don't see a physical TOGGLE on the Tasmota Main Menu (as pictured above by you) but at least it works!

      Delete
    5. It should be default have the relay. To add it

      TuyaMCU 11,1

      On the console.

      Delete

Post a Comment