About The Device Nedis Wi-Fi Smart Plug WIFIP121FWT, Remote controllable plug with energy monitoring.
Disassembled The plug itself
To remove the bottom cover, there is need only for simple small screw driver. The cover has small fastener in the each corner of the cover. A bit force is needed, but not that much there is any fear of breaking the cover.
There seems to be CB2S BK7231N inside the plug
And the energy monitorig chip is BL0937
Flasing Since I am not electronics guy, I couldn't find regulator from the PCB. There might be, but I went through all chips which I found and none of them were regulator for my eyes. So I used normal FTDI USB to TTL adapter. I soldered short cables to the 3.3V, GND, TX, RX and CEN pins of the BK7231N module.
Once done I started flasher in my linux machine and connected the CEN pin to GND for 1seconds.
uartprogram ~/Downloads/OpenBK7231N_QIO_1.14.1.bin -d /dev/ttyUSB0 --unprotect -w --startaddr 0x0
And the result was this:
Gotten Bus... : | |[ ?k/s]caution: ignoring unexpected reply in SetBaudRate
Write Successful: |##################################################|[ 16.8k/s]
Pinout Before assembling everything back I used multimeter to check where the pins are connected from module to energy monitoring chip. Other pins were a bit tough for me so I decided to test those in the configuration.
BL0937 SEL (pin 8)
BL0937 pin 7 (CF1) was not connected to anywhere.
Job done Once the work was done. I removed the wires from the module and plugged in the just flashed plug. Connected to the plug with phone and changed proper SSID and PSK for it.
Then rebooted it and connected to it from my desktop and everything seems to be working so far.
Configuration Tested where the relay is connected (not TX1 which I assume would be pin 11, and pin 26 since those are energy monitor chip). Found out that relay starts to give nice sound when configured to P8. LED started to work at P6.
Then configured 11 to be BL0937SEL and 26 to BL0937CF
The problem The relay works so the plug can be remotely controlled. Unfortunately the BL0937 is not automatically starting up during reboot. When using command startDriver BL0937 the chip seems to be available, but once trying to give VoltageSet etc.. there is just information:
Info:EnergyMeter:VoltageSet: you gave 230.000000, set ref to inf
The index page seems like this after the VoltageSet (or after any BL0937 command)
Hey @elurkki , thanks for the post and the teardown, I will add it to our online teardowns database.
Regarding your issue.... that's strange, please give me a while to investigate. I will update my post here later.
EDIT: I know what might be wrong.
the res_v variable is 0 so you get the division by zero here.
When dividing by zero, you get infinity.
It sounds like an invalid configuration of BL0937.
And now that I look at the post...
This sounds very implausible.
CF1 is used to count voltage pulses:
It is not possible to measure voltage without CF1. This is why you have zero value in res_v variable.
How to fix? Well, you have two options.
1. recheck connections with multimeter to determine where CF1 goes
2. try to guess where CF1 is, maybe look at other templates, and just try it out, but remember to reboot every time after changing config so BL0937 driver can be reset.
You are absolutely correct! I opened the plug again and measured all the pins again. The pin 6 was just covered something and didn't give values until I used a bit force to get some values. Sorry for this inconvenience.
The pin for this is BK7231N (24) -> BL0937 (CF1). Now the BL0937 starts up at the startup.
Now after setting bootup values like below, everything seems to be working.
Hi. Tested how the OTA updating works, and it was really fluent. I do now have 1.14.10 version uploaded to the plug. The Consumption is shown nicely on the plugin web page.
Is it possible to get the consumption to be shown on Home Assistant? I removed the plug from HA and allowed the plug to do the discovery again, though just Voltage, Current and Power are shown in HA just like earlier with 1.14.1.
I am not sure if I understand. Are you asking if the "Energy Consumed Last Hour" is included in the Home Assistant Discovery?
If so, then no, you'd have to take it out manually. Only Voltage, Current and Power are included in HA discovery.
That's because the Consumption was added today, we didn't have time to update the Discovery.
Also, the consumption will be changed in next update and will require configuration by the user with a startup command. Still, it will be more flexible that way. You will be able to change the number of samples, etc.
version 1.14.11 should report alls topic in Home Assistant Discovery.
It should post: 1x relay 6x sensors (voltage, current, power, energycounter, energycounter_last_hour, consumption_stats)
5x sensor - float value
consumption_stats - JSON string
As a reader, I don't know what the author of the above-mentioned of the article he had in mind.
This article by a friend from the USA or abroad, was machine translated, shows the inside of a smart WiFi socket and documents what's inside (what WiFi module and what energy measurement system) so that other users know what to expect. The process of uploading the batch is also described. This is generally analogous to: https://www.elektroda.pl/rtvforum/topic3887748.html it's just that there is a little bit of these sockets together with the users OBK we try to document them so that later it can be easier to change the batch (we give ready pin configuration, etc.).
I will try to improve the translation of the article in my free time.
Sorry my mistake it was already introduced in earlier version 1.14.7. But confirmed it on my MQTT log, where discovery message was sent from device, may be HA ignored it.????
I am not really familiar with HA.
@valeklubomir I am testing your new stats system for power consumption (measure the power consumption during last hour and a total one) and I must admit it's great addition! Thank you.
I've also fixed a realloc issue in cJSON library on T platform, it should be OK now.