Announcement

Collapse
No announcement yet.

Energy Monitoring Smart Plug for under $10

Collapse
X
 
  • 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.
    Thanks

    Comment


      #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.

      Comment


        #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.

        Comment


          #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_FAILED,
          WPS_CB_ST_TIMEOUT,
          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 6.3.0.7 with ESP.restart replaced by ESP.reset
          void WifiDisconnect(void)
          {
          // Courtesy of EspEasy
          WiFi.persistent(true); // use SDK storage of SSID/WPA parameters
          ETS_UART_INTR_DISABLE();
          wifi_station_disconnect(); // this will store empty ssid/wpa into sdk storage
          ETS_UART_INTR_ENABLE();
          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?

          Comment


            #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.

            Comment


              #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!

              Comment


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

                Comment


                  #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:
                  https://github.com/whiskerz007/proxm...vert_container . It's very convenient if you run ProxMox. If not, here's the tuya-convert github page for the normal process: https://github.com/ct-Open-Source/tuya-convert

                  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:

                  https://blakadder.github.io/template...nk_bnc-60.html


                  All four plugs needed to be power calibrated - which was easy to do following the tasmota wiki here: https://github.com/arendst/Sonoff-Ta...ng-calibration

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


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

                  Comment


                    #24
                    Great!

                    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?

                    Comment


                      #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: https://github.com/ct-Open-Source/tu...atible-devices

                      Comment


                        #26
                        Originally posted by taylormia View Post

                        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:

                        https://blakadder.github.io/template...nk_bnc-60.html

                        Taylormia and/or Michael McSharry,

                        I too flashed 8 of these with Tuya-convert a couple of weeks back. I applied the template linked to above, but the energy monitoring doesn't quite work correctly. I calibrated voltage and current, and the reported Power is correct.

                        I can report, however, that reported energy consumption is not at all accurate. That is, accumulated energy for these modules is always between 1.7 and 2x too high for a given power level.

                        For example, I have a module reporting right now that 230W is being consumed. The reported voltage and current have been confirmed with a multimeter, and the reported power is verified to be the product of the voltage and current. i.e. V=121V, I=1.898A, P=230W. With that load, it takes about 1.5 minutes for 'Energy Today' to increment by .01 kWh. 1.5 min is .025 hours. .01/.025= .4 kW = 400 watts. That is about 1.74x too high.

                        I've run the numbers for all kinds of loads from a 25w LED bulb up to 1400 watt level 1 EV charger. The accumulated kwh is always way too high.

                        Can either or both of you verify that your kWh is being reported properly? Thanks!

                        Comment


                          #27
                          I observed the data on the main Tasmota page for the smartplug. I see the Energy Today increment every two seconds. I ran a test for 10 minutes for a plug that was not used today until the test. The load is resisttive space heater using 1500 watts as shown by both the smartplug and killawatt meter. Voltage at 113V. After 10 minutes the Energy Today reading on the Tasmota page was 250. These numbers all line up to be reporting as expected.

                          I don't recall the procedure I used to calibrate with Tasmota, but likely I used all calibration factors that were available. (FrequencySet, CurrentSet, VoltageSet, and PowerSet) based upon data that was showing on the Killawatt meter.

                          Comment


                            #28
                            Originally posted by Michael McSharry View Post
                            I observed the data on the main Tasmota page for the smartplug. I see the Energy Today increment every two seconds. I ran a test for 10 minutes for a plug that was not used today until the test. The load is resisttive space heater using 1500 watts as shown by both the smartplug and killawatt meter. Voltage at 113V. After 10 minutes the Energy Today reading on the Tasmota page was 250. These numbers all line up to be reporting as expected.

                            I don't recall the procedure I used to calibrate with Tasmota, but likely I used all calibration factors that were available. (FrequencySet, CurrentSet, VoltageSet, and PowerSet) based upon data that was showing on the Killawatt meter.
                            Thanks for the sanity check. I will admit, I didn't calibrate power or frequency, only Voltage and Current. I guess I just figured that since power was reported correctly, it didn't need calibration. I also don't have an accurate way to measure frequency. I do have a UPS that reports 60hz, so I will set it to that...

                            Hopefully taylormia will weigh in with a check since mine are theoretically identically configured (i.e., all of them do NOT use your firmware build). I'm on 6.5.0, and I believe I saw your build is based on 6.4.1 or something. Perhaps a regression was introduced, not sure.

                            I will do a full calibration run and report back...

                            Comment


                              #29
                              Originally posted by hivberger View Post


                              I will do a full calibration run and report back...

                              I ran PowerSet from the console using the wattage indicated by the plug and lo and behold, it works fine. Seems odd to me you need to separately calibrate power even when voltage and current have been calibrated. But I have no idea how the chip works.... devil is no doubt in those details.

                              FWIW, however, FrequencySet returns {"Command":"Unknown"}

                              Thanks much!

                              Comment


                                #30
                                Just converted my first BN-LINK plug and every thing looks good using 6.5.0 and the appropriate template. What I have not been able to figure out is how to turn it ON and OFF using mcsMQTT plugin. I'm assuming it's publishing the proper command but I have not figured out what that is. Any help would be appreciated

                                Comment

                                Working...
                                X