EDIT: Note this will only work with the original smart plug that comes in an orange box. The series 2 plug that comes in a purple box has an incompatible Wifi module that would require a transplant.
I’m getting to the end of the 20 or so Officeworks Brilliant power monitoring smart plugs I purchased before they changed to be unflashable by Tuya Convert. And surprise surprise some of mine are unflashable too.
So I went to town on the ultrasonicly welded case of an unflashable one with the “vice of knowledge™ Big Clive” to see what was inside. It came apart fairly easily and without damage. And the Wifi module was a TYWE2S, which is easily flashable. So I thought I’d write up a bit of a how to.
You will need a vice and a thin spudger (literally a dime a dozen on Ali Express).
The secret is to use just enough pressure to crack the ultrasonic weld without damaging the case. Take your time. Work slowly and carefully.
Squeeze one side at a time, experimenting with height of the case in the vice slowly applying pressure. Do not apply any more pressure once you hear the satisfying “crack” of an ultrasonic weld parting.
Use the spudger to carefully propegate the split if needed.
If you get a stubborn weld, work on the other sides. Keep moving around all four sides until you have at least three free.
Once you have three sides free you can pull the two halves of the case apart breaking the final stubborn weld.
Put the 240V pin side of the case downwards and push them and the PCB out of the case. This takes quite a bit of force. There is a plastic ring that can sometimes prevent this from happening. Use a flat blade screwdriver to gently pry this ring against the inside of the case - do not lever against the PCB.
The case plastic is quite tough and I did not need to use soft jaws in the vice.
Once you have the PCB free of the case you need to solder 5 wires to the TYWE2S module. The four on top are fairly straight forward.
Scrape the conformal coating off the pins with a small blade. Use a powerful soldering iron with a small tip. Tin your wires first. Add a little 60/40 Sn/Pb solder to the 4 pads. The lead free solder is a high temperature type and difficult to melt. A magnified desk lamp helps considerably.
The IO0 connection on the back of the module can be a bit tricky. Put some solder on the pad first. Then attach the tinned wire with the soldering iron.
IO0 must be shorted temporarily to the GND pad before powering up the module with the USB - TTL serial adaptor (do not power up with 240V!). Once you hear the “bing-bong” USB device connected sound you can remove this connection. I just hold this connection by hand.
Flash your device. There are many tutorials on how to do this and an example ESPHome config file is available at the end of this topic. The power monitoring will require calibration.
The module needs a power cycle after flashing before it will connect.
Once you have confirmed the flash worked, disconnect the USB serial adaptor from the PC and unsolder the wires.
Check closely for any solder bridges or unattached bits of solder left behind.
Carefully push the PCB back into the case, making sure the 240V pins are all the way through and that the two small plastic locating pegs are in the holes in the PCB.
Apply a very thin bead of superglue to the inside of the case lid where the roughness of the split ultrasonic welds are. Hold the case halves together for 10 seconds or so for the glue to set.
Tada!
esphome:
name: brilliant-lounge-av
platform: ESP8266
board: esp01_1m
wifi:
ssid: 'WAPLO'
password: !secret wifi_pwd
manual_ip:
static_ip: 10.1.1.174
gateway: 10.1.1.1
subnet: 255.255.255.0
ap:
ssid: "brilliant_lounge_av"
password: !secret wifi_pwd
captive_portal:
logger:
api:
password: !secret api_password
encryption:
key: !secret api_encryption_key
ota:
password: !secret esp_pwd
binary_sensor:
- platform: gpio
pin:
number: 3
mode: INPUT_PULLUP
inverted: true
name: "Lounge AV Power Button"
on_press:
- switch.toggle: relay
- platform: status
name: "Lounge AV Status"
switch:
- platform: gpio
id: led
pin:
number: GPIO13
inverted: true
- platform: gpio
name: "Lounge AV"
pin: GPIO14
id: relay
icon: mdi:audio-video
restore_mode: ALWAYS_ON
- platform: restart
name: "Lounge AV Restart"
sensor:
- platform: wifi_signal
name: "Lounge AV WiFi Signal"
update_interval: 15s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
send_first_at: 1
icon: mdi:wifi
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO04
cf1_pin: GPIO05
current:
name: "Lounge AV Current"
unit_of_measurement: A
icon: mdi:current-ac
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 10
send_first_at: 1
voltage:
name: "Lounge AV Voltage"
unit_of_measurement: V
icon: mdi:flash
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 10
send_first_at: 1
power:
id: lounge_av_wattage
name: "Lounge AV Power"
unit_of_measurement: W
icon: mdi:gauge
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 10
send_first_at: 1
current_resistor: "0.00098" ### HIGHER VALUE GIVES LOWER WATTAGE
voltage_divider: "2196" ### LOWER VALUE GIVES LOWER VOLTAGE
change_mode_every: 8
update_interval: 5s
- platform: total_daily_energy
name: "Lounge AV Daily Energy"
power_id: lounge_av_wattage
filters:
- multiply: 0.001
- sliding_window_moving_average:
window_size: 10
send_every: 10
send_first_at: 1
unit_of_measurement: kWh
icon: mdi:chart-bar
time:
- platform: homeassistant
id: homeassistant_time