Announcement

Collapse
No announcement yet.

WiFi Controlled USB and Mains Power Strip

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WiFi Controlled USB and Mains Power Strip

    I reflashed the Wheswell ZLD-44USA-W Wifi Power Strip that is available from Amazon https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1.

    Remote controlled power strips are pretty common, but I have not seen many remote control of USB power.

    Click image for larger version

Name:	Capture.PNG
Views:	74
Size:	102.3 KB
ID:	1288943

    I installed Tasmota that allows for remote control via HTTP or MQTT. Seven of the eleven GPIO of the ESP8266 were used for control and status. The configuration I used is shown in the attachment. Relay 1 (inverted) is setup as a master and Relay 2 through 6 are used for mains and USB control. Each has a LED for local feedback that is wired in parallel with its relay. From console "poweronstate 3" was setup so power state of the plugs is maintained after power cycles.

    While I was exploring the GPIO configuration I put the unit into an unbootable state so I opened it up and found flashing via serial straightforward. The digital card was well labeled and access to the necessary pads was easy. Not as easy as a Sonoff with header pins, but solder connections were on the circuit card edge so easy to tack on some wires for the serial connection. Now that I have identified the configuration nobody else that is interested in this unit will need to go through the same steps. Just a OTA firmware update per instructions in Section 14.12 of http://mcsSprinklers.com/mcsMQTT.pdf.

    I was surprised as the amount of electronics that existed on the USB power circuit card. It looked pretty hefty Nothing like the little cubes one uses that comes with smartphone or other small electronics that are powered via USB.

    Click image for larger version

Name:	20190228_203932.jpg
Views:	53
Size:	98.7 KB
ID:	1288944

    Click image for larger version

Name:	Capture.PNG
Views:	55
Size:	32.6 KB
ID:	1288945

  • #2
    Let us know how it works out... I may get one if I can send simple HTTP commands from HS3.

    Comment


    • #3
      Are the usb switched as one or independently? So far on the Tuya ones it is all.

      Comment


      • #4
        Originally posted by bsobel View Post
        Are the usb switched as one or independently? So far on the Tuya ones it is all.
        The USB are NOT switched independently. They are all on or all off.

        Comment


        • #5
          Originally posted by drhtmal View Post

          The USB are NOT switched independently. They are all on or all off.
          Thanks (darn)

          Comment


          • #6
            Let us know how it works out... I may get one if I can send simple HTTP commands from HS3.
            Tasmota supports HTTP control. I believe, but bsobel needs to confirm, that his plugin will also control it with the original Tuya firmware.

            [/quote]The USB are NOT switched independently. They are all on or all off.[/quote]
            confirmed. GPIO14 is used to control the USB so they are all on or off. I have seen a mini plug on Amazon https://www.amazon.com/dp/B07G78YSQS..._t2_B074YGV2NK that indicates the USB can be turned on/off via App. Since it is only one USB port you could stack these and have individual control of each USB.

            Comment


            • #7
              So I bought one of these, but reviewing the OTA flash instructions I'm challenged. I don't have an RPI, and my native wifi network at home is 192.168.4.0, so... care to share the serial flash instructions? Same as a Sonoff Basic? I've done a couple of those.

              Comment


              • #8
                It is actually easier than the SonOTA.exe for doing Sonoff devices, but you need to have something like RPi to run the Tuya emulation. I am not aware of anybody who has tried to port this to Windows. The first one I saw is at https://www.youtube.com/watch?v=O5GYh470m5k. I also put the shorthand version in http://mcsSprinklers.com/mcsMQTT.pdf Section 14.12. It only takes a couple minutes to reflash them once setup with the software loaded on RPi. If you want to bear the shipping cost then I will do it for you. Alternately you can have it shipped to me and I will resend when flashed.

                Comment


                • #9
                  This is cool stuf!! You never cease to amaze Michael. I got my power strip in and reflashed the firmware. I am still slow on picking up the mcsMQTT skills but I got one of the outlets to go ON/OFF using the attached info. Thanks again!!

                  Comment


                  • #10
                    Good news that you got it working. Since your image is purple you likely have not got it setup in the best way. This should mean that you have an existing HS device that you associated with the MQTT topic.

                    The normal situation is to have a mcsMQTT device for this purpose. Undo what you did to associate the topic to HS device. On the Association tab find the status from the power strip. This will be something like sonoff/stateower. Click the A checkbox on this row. It will create a mcsMQTT device. Then for the pub: text box on this device use what you entered for the first one you created.

                    When I setup my Tasmota devices I have the MQTT Full topic to be %topic%/ and the Topic to be whatever I want to call the device (e.g. sonoff-powerstrip-1). Doing it this way I remove the Sonoff from the start of the Topic. Nothing wrong with what you have, but I find it just extra text of no value to me.

                    Comment


                    • #11
                      I changed the "Full Topic" to %topic%/ and "Topic" to sonoff-powerstrip-1. When I publish "sonoff-powerstrip-1/POWER2 ON" with a regular MQTT client, the power strip does not turn on. If I make the "Full Topic" %topic%/%prefix% and publish "sonoff-powerstrip-1/cmnd/POWER2 ON" the power strip does turn on.

                      I also cannot get the mcsMQTT device to publish the ON/OFF status. When I use the Payload of $$STATUS: it will only publish 0/100 instead of ON/OFF.

                      Comment


                      • #12
                        Originally posted by Michael McSharry View Post
                        It is actually easier than the SonOTA.exe for doing Sonoff devices, but you need to have something like RPi to run the Tuya emulation. I am not aware of anybody who has tried to port this to Windows. The first one I saw is at https://www.youtube.com/watch?v=O5GYh470m5k. I also put the shorthand version in http://mcsSprinklers.com/mcsMQTT.pdf Section 14.12. It only takes a couple minutes to reflash them once setup with the software loaded on RPi. If you want to bear the shipping cost then I will do it for you. Alternately you can have it shipped to me and I will resend when flashed.
                        Since I already have the serial hardware and flash software I would prefer to do that. I've got the soldering skills.


                        Sent from my Pixel 2 using Tapatalk

                        Comment


                        • #13
                          Now I understand. There are 6 rubber feet that are pulled off to expose 6 triangle slot screws to remove the bottom. You need to get to the bottom of the main circuit card which I show in Figure 106 of http://mcsSprinklers.com/mcsMQTT.pdf. I removed the USB board and then screws to remove the power wires from the circuit card and the screws to remove the circuit card to the case. The metal contact bar also came off.

                          The bottom of the main board where it solders to the digital board is where 3.3v, Gnd, Rx, and Tx, are easily accessed. You can see them labeled in Figure 105. On the top side of the digital board is a pad labeled IO0 and a couple pads labeled Gnd. You can see this in Figure 105. I soldered wire to Gnd and then touched the other end to IO0 pad as I plugged in the Serial adapter.

                          Standard flashing procedure: Rx on Serial connected to Tx on digital board, Tx on Serial to Rx on digital board, 3.3V and Gnd between Serial and digital board (or alternate power source to provide 3.3V). IO0 is grounded at power on and then floats during programming. I use EspEasy_Mega distribution that contains ESP.Easy.Flasher.exe on Windows to do the flashing or any bin file. Arduino IDE, esptool.py are other techniques.

                          Comment


                          • #14
                            rcrules, you need to distinguish publish and subscribe topics. Your Tasmota device is expecting sonoff-powerstrip-1/cmnd/power2 as the topic to control the second relay. This is not what mcsMQTT client is expecting, but will be what mcsMQTT is sending. The Tasmota device will publish a JSON message every 5 minutes with topic sonoff-powerstrip-1/STATE and in the JSON payload will be something like "POWER2":"OFF". On the mcsMQTT Association tab there will be a row with topic column of sonoff-powerstrip-1/STATE:POWER2 and OFF in the payload column. This is the row that you want to check the A column checkbox. It will create the HS device. On this row you will want to fill in the Pub: text box be the topic that the Tasmota device is expecting. In this case it is sonoff-powerstrip-1/cmnd/power2.

                            I changed the "Full Topic" to %topic%/ and "Topic" to sonoff-powerstrip-1. When I publish "sonoff-powerstrip-1/POWER2 ON" with a regular MQTT client, the power strip does not turn on. If I make the "Full Topic" %topic%/%prefix% and publish "sonoff-powerstrip-1/cmnd/POWER2 ON" the power strip does turn on.
                            If you setup Tasmota device to be Full topic is %topic%/ then you will want another MQTT client to send "sonoff-powerstrip-1/cmnd/POWER2" to control the second relay. As you indicated you could also explicitly define the Full topic to be %topic%/%prefix%, and the same "sonoff-powerstrip-1/cmnd/POWER2" is used to control the second relay. You can look on the Information page of the Tasmota device to see what the topic is to which it responds.

                            What you have setup is a mcsMQTT subscription to sonoff-powerstrip-1/cmnd/power2. You do not want this becasue it is the Tasmota device that you want to be subscribing to this topic. You want mcsMQTT to subscribe to something that the Tasmota device published. This could be the STATE, POWER, or RESULT messages published by the Tasmota device. The example I gave in the first paragraph is with the STATE message.

                            You can send the Tasmota device 0 and not zero payloads to turn off and turn on relay. You can also sent it OFF and ON. What you actually do is setup on the Edit tab. In your screenshot you have the Device Control UI to be a number. Since you want to send OFF and ON you need for it to be Button (or List) so there can be a relationship defined between a number and the text. This is the Value Status Pairs used by Homeseer.

                            When you select Button then the row below the Control UI will show the number/text VSP relationships that are being used. mcsMQTT monitors every topic and keeps track of the text received in the payload. The Tasmota device will have published "OFF" and/or "ON" for POWER2 so mcMQTT will assign numbers of 0 to OFF and 1 to ON. These numbers are what is actually updated in HS Device. The VSP definition, in concert with use the $$STATUS: in the publish payload template will send ON and OFF when the HS device is controlled.

                            When you are testing with another MQTT client and sending the /cmnd/ topic you only want this topic to be used by the Tasmota device. You can observe it in mcsMQTT, but there is no practical use other than observing that some other client has commanded the Tasmota device on/off. mcsMQTT/Homeseer will use something that is published by the Tasmota device because it is actually the state of the relay. If you need immediate update of the HS device then you will select the sonoff-powerstrip-1/POWER2 or sonoff-powerstrip-1/RESULT topic published by Tasmota device. If you use the sonoff-powerstrip-1/STATE topic as I showed above you do not get immediate feedback in HS, but do assure that HS knows the state even if it was not online when the last relay change was published. You could also use the MQTT retain feature, but that is a different subject.

                            Comment


                            • #15
                              Originally posted by Michael McSharry View Post
                              Now I understand. There are 6 rubber feet that are pulled off to expose 6 triangle slot screws to remove the bottom. You need to get to the bottom of the main circuit card which I show in Figure 106 of http://mcsSprinklers.com/mcsMQTT.pdf. I removed the USB board and then screws to remove the power wires from the circuit card and the screws to remove the circuit card to the case. The metal contact bar also came off.

                              The bottom of the main board where it solders to the digital board is where 3.3v, Gnd, Rx, and Tx, are easily accessed. You can see them labeled in Figure 105. On the top side of the digital board is a pad labeled IO0 and a couple pads labeled Gnd. You can see this in Figure 105. I soldered wire to Gnd and then touched the other end to IO0 pad as I plugged in the Serial adapter.

                              Standard flashing procedure: Rx on Serial connected to Tx on digital board, Tx on Serial to Rx on digital board, 3.3V and Gnd between Serial and digital board (or alternate power source to provide 3.3V). IO0 is grounded at power on and then floats during programming. I use EspEasy_Mega distribution that contains ESP.Easy.Flasher.exe on Windows to do the flashing or any bin file. Arduino IDE, esptool.py are other techniques.
                              Thanks, I'll give it a shot.

                              Comment

                              Working...
                              X