
I will present here the interior of a very cheap "outdoor" Tuya socket, which also offers energy measurement. Here I will provide information on how to change its firmware and show the ready configuration OpenBeken for this slot. I will show how to run the statistics system for this socket in OBK and use the Home Assistant Discovery. This socket has a WB2S WiFi module inside and a BL0937 chip for energy measurement OpenBeken Support.
Mycket Smart Socket PE-01E IP44
The socket is quite distinctive, I think it will be easy to recognize, even though I won't include screenshots from the listing here - I just got them from its importer who supports OpenBeken's development.
Here is the box:






The interior of the PE-01E, loading the charge
Unfortunately, it is not a Blitzwolf BW-SHP6 that is easy to disassemble and assemble. It is also not simply a clone of LSPA9. The cover can be removed, but then there is a problem with the pins:

You can see the energy measurement system - BL0937.


The pins do not twist. They are soldered. Unfortunately...
The PCB was removed, but at what cost:


There is a WB2S module inside. I took it out for programming:


I only connect VDD, GND, RX and TX. USB to UART adapter in 3.3V mode. VDD is 3.3V. bkWriter is able to program this module. To perform a RESET, I cut off the power.
Just like, among others here:
Electric socket with LSPA9 energy measurement - we program our own firmware
We take bins from here:
https://github.com/openshwprojects/OpenBK7231T_App/releases
Pairing with Tuya
The purpose of the game is to change the load, but I did a short test with the Tuya app anyway. Let's see how Tuya sees this nest ...




I steamed them like this:

OpenBeken configuration
To configure the firmware after the change, we need to know what pins are the button, relay and signals from BL0937 on.
This is shown in the screenshot below:


Additionally, the energy measurement should be calibrated in accordance with:
https://www.elektroda.pl/rtvforum/topic3887748.html
This socket additionally has a separate LED diode, which can be used either as a WiFi status LED or connected to the relay status (with _n if we want with negation).
Energy consumption statistics
It is worth adding that thanks to the latest updates, OpenBeken also counts how much we used in watt hours. It always counts how much we have used in total, but it can also count the consumption in the last period of time (e.g. in an hour). This can be run through a console command, which we enter, for example, in 'Short startup command':
SetupEnergyStats [enable] [sample_time] [sample_count]
SetupEnergyStats 1 60 60
sample_time - how many times it saves the measurement in seconds
sample_count - how many samples we save in total

Here is the view from the panel:

Little later:


Pairing with Home Assistant
There are already two ways at the moment.
Method 1 - Home Assistant Discovery:
Just set up MQTT. Then we open "Generate Home Assistant CFG" and there we have:

I emphasize - recently the Discovery also automatically adds the measurement fields to the HA, i.e. voltage, power, etc. You do not have to do it manually anymore.
Method 2 - handwriting Yaml like in this topic:
https://www.elektroda.pl/rtvforum/topic3887748.html
Summary
Those slightly more budgetary power metering sockets, the Mycket Smart Socket PE-01E, NAS-WR01W and NAS-WR07W models are a bit more difficult to take apart. I had problems with each of them. I finally put this Mycket together, but I had to figure out how to solder the pins of the plug so that they would stick firmly. Luckily I had a soldering iron strong enough and the pins returned to their place (because yes, they were soldered to the pads by the manufacturer).
I have already prepared a tuya-cloudcutter profile for this socket, including the pull request:
https://github.com/tuya-cloudcutter/tuya-clou...mmit/41f82d20b0e4d450ec6d788441e612910740dc32
Tuya-cloudcutter will allow you to change the load of this socket remotely - without opening the housing. Details can be found in their repository.
Cool? Ranking DIY Helpful post? Buy me a coffee.