No announcement yet.

Energy Monitoring Smart Plug for under $10

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Thanks Michael for the flashing procedure for my remaining plugs. I'm good here. I use a Ubuntu VM with a USB Wifi adapter and an old Android phone to do the flashing with tuya-convert. Have done this on the Luntak plugs successfully.
    I'm not clear yet on the setting up of the default network:
    What is the purpose of the RPI Router? I have a spare RPI Clone and a spare wifi router. Am I trying to get the mcsTasmota flashed BL-LINK to connect to the default wifi SSID and get an IP address to which I can open a web page to configure the actual SSID the plug needs to connect to? If I use the wifi router, do I use WEP since I cannot use WPA? Sorry for being dense.


    • #17
      You are correct about the objective.

      The easiest way to get the desired SSID setup in that plug is to have an environment that has a default/default SSID/pw. Your spare router would be easier than setting up a RPi or ESP8266 as a temporary router. If you are successful at this step then the BL-LINK should stop blinking to indicate that it is not connected to the default wifi network.

      A browser is then used from a device (phone/laptop) that is also connected to default/default so it can talk to the BL-LINK plug and then change the SSID to one you really want to use. After this step you can decommission the temporary router with default/default.

      Next step would be to go to your main router, or some other device that can tell you what IP the DHCP server gave to the BL-LINK. With this IP you can connect and finish the setup and put the plug into service.

      I'm not certain what protocol Tasmota uses when trying to connect to the SSID. The source has references to WPA2, WPA and WEP. I use WPA2 on my router and never tried other modes to see was Tasmota does.

      When you flashed the Luntak plug you likely had an image that had no SSID setup so Tasmota did not use station mode, but directly into access point mode. I was not aware until now that is what it did. When a SSID is defined then it goes into station mode and tries to connect to it. The 4 short button press causes it to go to AP mode, but if the module is not configured to map the GPIO pin to the button function then no way to do the 4 presses that it will recognize except if GPIO0 does the short presses. This is because the Sonoff Basic is the default module on a Tasmota build and it uses GPIO0 for the button.

      When in station modeTasmota continues to try to connect to the defined SSID(s). I believe the core Arduino 2.5.0 has the lower level logic that actually makes the connection attempts and would have the WPA/WEP logic.


      • #18
        Got it. Thanks Michael for taking the time to explain. With the Luntak I used the flash 3 option which used the sonoff-basic.bin image. I will try with the old wifi router and report back.


        • #19
          Michael, here's what I found trying to get the mcsTasmota flashed BL-LINK to connect to the "default" SSID with "default" password on an old router with DD-WRT.

          Using WPA or WPA2: the minimum length of the password required is 8. "default" is 7 characters - so this cannot be configured on any WPA/WPA2 router
          Using WEP: "default" as a passphrase can be configured, but the plug does not connect. WEP network passwords are hexadecimal strings known as keys. A WEP network can have 4 different keys; each key is assigned a "Key Index" value. For WEP encrypted networks, you need the SSID, the key, and key number.
          From the mcsTasmota "my_user_config.h" file I do not see any configuration for a WEP hexadecimal key or key number

          Also, I found the following code in the tasmota "support_wifi.ino" file that leads me to believe that WEP is not supported in tasmota while WPA is supported.

          ************************************************************ **********
          void WifiWpsStatusCallback(wps_cb_status status)
          /* from user_interface.h:
          enum wps_cb_status {
          WPS_CB_ST_SUCCESS = 0,
          WPS_CB_ST_WEP, // WPS failed because that WEP is not supported
          WPS_CB_ST_SCAN_ERR, // can not find the target WPS AP

          / Enable from 6.0.0a until 6.1.0a - disabled due to possible cause of bad wifi connect on core 2.3.0
          // Re-enabled from with ESP.restart replaced by ESP.reset
          void WifiDisconnect(void)
          // Courtesy of EspEasy
          WiFi.persistent(true); // use SDK storage of SSID/WPA parameters
          wifi_station_disconnect(); // this will store empty ssid/wpa into sdk storage
          WiFi.persistent(false); // Do not use SDK storage of SSID/WPA parameters
          ************************************************************ *******

          So, because the mcsTasmota image has a built-in password of 7 characters, it will not connect to a WPA SSID due to WPA password requirements not being met, nor to a WEP SSID because WEP is not supported.
          Do you agree?

          I'm not willing to open the plug and mess with GPIO pins - so from my perspective - the plug is bricked.
          What are your thoughts?


          • #20
            Sorry to put you through all of this. I can confirm that when a AP is setup using WEP/ASCII that Tasmota does not connect.

            I had a router provided by my ISP and it came with SSID of default and no password. The open system worked for me since I live in a very remote area. When I replaced it with a Ubiquiti AP a couple years ago I was more sensitive of security so never ran into a WPA key length problem. I learned a few things working with you on this.

            It is not that hard for me to reflash it via serial since I know the layout. If you are interested in sending it to me rather than discarding it I can paypal you $10. Let me know at mcsSolutions at CenturyTel dot net if you are interested.


            • #21
              Michael, No apologies necessary. I am learning as you are with this experience...and in my opinion - having a bricked device once in a way is a fair price to pay
              Also, I should have asked you the about the correct procedure to flash your binary instead of assuming that I could directly flash it with tuya-convert.
              As far as the bricked plug - I will return it for a replacement.
              I just succeeded in flashing the sonoff_basic.bin on to another BN-LINK and doing a firmware upgrade to the mcsTasmota image. I will play with the power calibration after I get my replacement plugs.
              A couple of suggestions. Please add in your mcsMQTT manual to first do the flash 3 option on the BN-LINK before upgrading to your mcsTasmota image via "Firmware Upgrade" on the tasmota web page. Also, perhaps change the SSID/password in your image to be WPA compliant.
              Thanks again for all your help with this and your awesome mcSMQTT plugin!


              • #22
                Thanks for the suggestion, I already took care of the and left the SSID blank to force AP mode. I will update the manual too just to make others aware of what we learned.


                • #23
                  Just wanted to follow up on this. I successfully flashed my 4-pack of the BN-LINK plugs with tuya-convert using the Proxmox container documented here:
         . It's very convenient if you run ProxMox. If not, here's the tuya-convert github page for the normal process:

                  I flashed with the built-in sonoff-basic.bin file and configured the module using the tasmota template for the BN-LINK - and it works great:


                  All four plugs needed to be power calibrated - which was easy to do following the tasmota wiki here:

                  Here's the plug web page after calibration with a 40w incandescent lamp:

                  Thanks again Michael for your guidance, excellent support and awesome plugin:


                  • #24

                    I did not know about templates. Thanks for pointing me to something new. I see that the template provides the functionality for special chips such as the one this module uses for energy monitoring.

                    Where did you find the info about the ANNCY? Is it something supported in current Tasmota builds?


                    • #25
                      The ANCCY info was part of the BN-LINK template page. See the link for this page in my post above. ANCCY is supported with tuya-convert. See this page: