Introduction: Smart Light Switch With M5stack Fire

Hi. I am a fourth grader, and today we are going to make a smart light switch, with m5stack fire.


Step 1: Coding

First make sure that your m5stack has been charging for an hour, that way it can connect to the network properly. Also make sure your WYZE bulb is linked to IFTTT and WYZE in advance. Now we are going to make an applet on IFTTT. First at the top left corner click the “menu” button. Next press “create”, then press on “applets”. Next press on “if this”, then type in the search "webhooks", after that click on it. Then click on “receive a web request”, then type in "ON" then press on “create trigger”. Next press “then that”, next type in “WYZE”, next click on it. Then press “turn bulb on”. Then select the name of the bulb. After that press “create action”. Next press “continue”, then press “finish”. Now make another applet but for webhooks type in “OFF” and for WYZE press “turn bulb off”. Now that we have created two applets let’s go to m5flow. When you get there select the beta version. And then press the menu button at the top right of the screen. Then press the gear button for settings and where it says “api key” put in the api key from the screen of your m5stack. After that press the icon of the m5stack fire. Next press “ok”, after that go to event and select “button A waspressed” next double click on it. That will create a clone of it, and then change A to C. Next press “advanced”, then scroll down. After that, press on “network”. Then press “connect to Wi-Fi SSID”, after that drag it to setup. Next put in your Wi-Fi SSID and password, next go back to setup and click on "wifi reconnect". then double click on it, that will create a clone of it. then drag one to button A waspressed then drag another one to button C waspressed. then go to timer and press on “wait 1 s” next double click on it, then drag one under wifi reconnect in button A waspressed and another one under wifi reconnect in button C waspressed. After that go back to IFTTT, Then when you get there, search “webhooks”. Then click on it, next at the top left click “documentation”. Next, copy what it says at the bottom of “Make a POST or GET web request to:”. Then go back to m5flow, after that click on "Http" and press on the block that at the top of it it says "Http Request". Next double click on it and that will create a clone of it. Next, drag one inside of "button A waspressed" and another one inside "button C waspressed". Then where it says "URL" on "button A waspressed" and paste in the text box there. Then where it says "{event}" get rid of the brackets. Next where it says "event" replace that with "ON". Now do the same thing with "button C waspressed but instead of "ON" type in "OFF". After that at the top left corner click the play button.

Step 2: Testing

press “A” to turn the lights on, and “C” to turn them off.


Block Code Contest

Participated in the
Block Code Contest