Announcement

Collapse

Contacting HomeSeer This Week

HomeSeer is open and operational this week. All orders are being processed and shipped as usual. However, some staff are working from home. If you need to contact HomeSeer for support or customer service, please use our Email or Chat options. https://homeseer.com/contact-us/
See more
See less

WiFi Controlled USB and Mains Power Strip

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

  • Michael McSharry
    replied
    Great!

    Leave a comment:


  • mterry63
    replied
    Just to follow up, I fired up the RPI today and the conversion went as smooth as butter. Go figure, maybe I was tired last night. All working now in HS3, thanks for the great info, support, and plugin!

    Leave a comment:


  • mterry63
    replied
    Thanks Michael. Yes, I was able to follow the instructions and join my phone to the SSID, got a 10.42.42.x address and "no internet connection" on my phone, which was expected. I'll give it another shot, and if that fails get out the soldering iron.

    Leave a comment:


  • Michael McSharry
    replied
    It has been awhile since I did it so I do not have memory of exactly what I did. I do not remember any difficulty using TuyaConvert. The plug's manual https://cdn.shopify.com/s/files/1/26...96118104426612 indicates to use the power button for 3-5 seconds with the LED then blinking quickly.

    One never actually has it explicitly join the AP when using TuyaConvert. It is all handled by the application. You need to use something else such as smartphone to connect to vtrust-flash SSID and then the exploit can be exercised. I have a shorthand description of the process in http://mcsSprinklers.com/mcsMQTT.pdf Section 14.12.

    Leave a comment:


  • mterry63
    replied
    I never got around to cracking open the Wheswell ZLD-44USA-W, and my son loaned me a RPI, so I loaded up the software. I can't get the power strip to join the AP SSID, no changes from the .... display. Is there some trick to get it into pairing mode? It seems there is a "fast led flash" mode and "slow led flash" mode. The slow mode shows a SSID broadcast from the power strip with the last digits of it's ID. Neither appears to connect to the vtrust-flash SSID. Any help?

    Leave a comment:


  • rcrules
    replied
    Michael, This worked great and makes the strip even more useful. Now I wish I had ordered more when they were $20. Thanks!!

    Leave a comment:


  • Michael McSharry
    replied
    Here is a rule definition that will have relay1 act as a master for the four main relays. Each line can be entered from the Tasmota console or mcsMQTT Publist tab. The Publist puts the commands in a file so they can be executed again in the future easily if desired.

    There are two rules. Rule1 is what happens when relay1 is ON. Rule2 is what happens when relay1 is OFF.

    The first line (poweronstate 3) restores the power at each relay to the same state it was after a reboot.

    During Rule1 as each relay is changed it remembers the state of the relay. For example for relay2 "on power2#state do mem2 %value% endon". When relay1 goes OFF then a one-second timer is set and the rules are toggled so Rule2 becomes active and Rule1 is no longer active.

    During Rule2 when the 1 second timer expires it turns the four main relays OFF. When relay1 goes ON it restores the mains relays to their prior state and toggles the rules

    If you also want to control the USB with relay1 then in Rule2 add "power6 %mem1%;" before the "rule1 1;" directive.

    The fourth and fifth line initializes Rule2 to OFF and Rule1 to ON

    Code:
    poweronstate 3
    rule1 on power2#state do mem2 %value% endon  on power3#state do mem3 %value% endon on power4#state do mem4 %value% endon on power5#state do mem5 %value% endon on power6#state do mem1 %value% endon on power1#state=0 do backlog ruletimer1 1; rule2 1; rule1 0 endon
    rule2 on rules#timer=1 do backlog power2 0; power3 0; power4 0; power5 0 endon on power1#state=1 do backlog power2 %mem2%; power3 %mem3%; power4 %mem4%; power5 %mem5%; rule1 1; rule2 0 endon
    rule2 0
    rule1 1
    Relay1 can be commanded via MQTT/HTTP/Console and via the button on the power strip to cause the rules to be executed. After power cycles the relays will be restored and then the rules will be set per the relay1 state.

    Leave a comment:


  • Michael McSharry
    replied
    Out of the box it is only a LED. If you want it to do more then I suggest using Tasmota rules. For example, you can setup a rule that when relay1 is OFF then all mains power is OFF or all mains and USB is OFF, depending upon your use case. Rules have memory variables too so that you should be able to save and restore the state of individuals relays when relays goes from OFF to ON. That was my intention, but I have not done it yet. I will post my rule after I give it try.

    Leave a comment:


  • rcrules
    replied
    Michael,

    What is the purpose of Relay1 / "POWER1"? Is see that it lights up the power button LED, is that all that it does?

    Thanks!!

    Leave a comment:


  • rcrules
    replied
    Originally posted by Michael McSharry View Post
    rcrules, you need to distinguish publish and subscribe topics....
    YOWZA! I have added all of the entries for the Power Strip as you stated. Everything works and each "POWER" status updates as it should. Thanks for all of the explanation. Now I will have to go back and fix all of the other things I added less correctly (zigbee, ESP8266, etc).

    Thanks again!!!

    Leave a comment:


  • mterry63
    replied
    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.

    Leave a comment:


  • Michael McSharry
    replied
    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.

    Leave a comment:


  • Michael McSharry
    replied
    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.

    Leave a comment:


  • mterry63
    replied
    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

    Leave a comment:


  • rcrules
    replied
    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.

    Leave a comment:

Working...
X