Many devices use current on standby mode. So we like to plug them into a power strip with a switch on it. And we hide it behind some furniture because it's quite ugly to look at cables. But now it's hard to reach. So... if we could control the switch remotely from the comfort of our couch? That's what IoT is for.
WiringWorking with 110V AC or 230V AC is very dangerous and should be done only by a professional! Not only can it kill you, you also suffer incredible pain while you die!
Configure MQTT-ClientThe MQTT broker and your client device has to be either in the same network or at least reachable through the internet (not really recommended). You enter the IP and port of your broker to connect to it. Add a new widget for on/off mode. Then you subscribe to the channel the ESP is sending it's status to. It is: "esp/3/power/out" in this code. You need now to enter the channel, where you want to publish commands to. The ESP subscribes messages from this channel. I used "esp/3/power/in" for this case. Now, the only thing left to do is to define the messages for on and off. Usually it would be best to use 1 for on and 0 for off. I go for 10 for off and 11 for on.
Links- Banggood 11.11 Global Shopping Carnival Electronic Special -- https://goo.gl/zHEiJW
Comments