Doing something useful with a smart Monoprice power strip

A while back I obtained one a STITCH by Monoprice Wireless Smart Power Strip for my smart home endeavours. I’m an avid HomeAssistant user, and the expectations I had were to be able to connect it up to my HASS instance and control it from there. So imagine my surprise when I learned that tha Tuya-based Monoprice STITCH ecosystem is actually custom and closed off for integrators. They say that it only supports Google Assistant, Alexa, and their own App. I asked them in Twitter if they had plans to open it up – to no response.

I’m not having that. So I fixed it.

I recently discovered the wonders of ESPhome, and wondered if it would be possible to reflash the micro on this power strip so I can use my own LAN-based home automation system instead of Monoprice’s closed-off developer-unfriendly cloud. Turns out the power strip is running a basic EPS8266 board, and documented heavily on Tuya’s own website. The module in use is a TYWE3S, and is installed in a very inconvenient way.

TYWE3S module placement

I had to remove a capacitor in order to get a soldering iron in to temporarily solder some wires to the module to get it programmed with the initial ESPhome firmware. The pin-out of said module is shown below;

TYWE3S - Tasmota
TYWE3S module pinout

There are 5 connections necessary in order to complete this task;

  • VCC & GND – obviously
  • TXD0 – RX on your serial programmer
  • RXD0 – TX on your serial programmer
  • GPIO0 to GND to enable programming mode

The TXD0 and RXD0 pins are very close to a couple of capacitors on the power supply side. Maybe your soldering skills will be better than mine, but I had to remove one of them in order to get my soldering iron in close enough to tack on some wires. I eventually got the task done.

TYWE3S all wired up for programming

Now it’s programming time. Knowing that this module is a standard ESP8266 module, I added a basic device to ESPhome and flashed the firmware. First time flashed but didn’t connect, flashed a second time and the device came online. I suspect the failure was due to a bad solder joint/connection. It works though, that’s the main thing.

Now it’s configuration time. I’ll cut to the chase and provide the exact configuration for the power strip with full out-of-the-box functionality.

status_led:
  pin:
    number: GPIO0
    inverted: true

switch:
  - platform: gpio
    id: port1
    name: "Port 1"
    pin: GPIO4
    restore_mode: ALWAYS_ON
  
  - platform: gpio
    id: port2
    name: "Port 2"
    pin: GPIO13
    restore_mode: ALWAYS_ON
  
  - platform: gpio
    id: port3
    name: "Port 3"
    pin: GPIO12
    restore_mode: ALWAYS_ON
  
  - platform: gpio
    id: port4
    name: "Port 4"
    pin: GPIO14
    restore_mode: ALWAYS_ON

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO5
      mode: INPUT_PULLUP
    name: "Button"
    on_press:
      - switch.toggle: port1
      - switch.toggle: port2
      - switch.toggle: port3
      - switch.toggle: port4

  - platform: status
    name: "Device Status"

Add the config above to the base configuration that ESPhome creates for the device. The status LED is used for ESPhome’s standard status light. The button toggles all 4 relays (not just turning them on/off, but actually toggling them, which I don’t think is quite out-of-the-box functionality, but it works and I think that’d be kind cool). Port 1 through 4 is actually labelled from the inside, meaning that “Port 1” is the furthest away from the incoming power cord (far right, closest to the USB sockets).

Upload the config OTA and let the device reboot. Hopefully your power strip connects up to your WiFi and can be added to/controlled by HomeAssistant.

Happy flashing!

n/a