Close

Uploading LUA scripts...

A project log for All-In-One ESP8266 IFTTT Button

This is an IFTTT IoT button based on Noel Portugal's design but implemented on an ESP826-07 breakout board with a built-in button.

stopsendingmejunkstopsendingmejunk 12/31/2015 at 03:220 Comments

The next step is to upload the LUA scripts to the ESP8266 board.

I downloaded the LUA scripts from the IFTTT Smart Button v2 project page.

I had to update setwifi.lua with my wifi network name and key. I also updated the ip address schema which is slightly different than default on my home network. [update: don't do this part. This is for configuring the AP on the board, not for connecting to your home wifi]

ifttt.lua also needed to be updated with a maker channel key from IFTTT.com. To get one, log into ifttt and connect the maker channel. Then you can find your key at ifttt.com/maker. I made a recipe to toggle my HUE lights using the trigger "button" as defined in the tutorial.

Next I needed to actually load the lua scripts to the board. A quick Google search revealed this tool.

I used the following commands to flash the board (I did not need to put it back into bootloader mode):

python ./luatool/luatool.py --port /dev/tty.wchusbserialfa140 --src /PATH/TO/ifttt.lua --dest ifttt.lua --verbose

python ./luatool/luatool.py --port /dev/tty.wchusbserialfa140 --src /PATH/TO/setwifi.lua --dest setwifi.lua --verbose

python ./luatool/luatool.py --port /dev/tty.wchusbserialfa140 --src /PATH/TO/init.lua --dest init.lua --verbose
Again, you'll use your own device address and paths. [Update: Sending the files doesn't always work and sometimes you have to try several times. It seems to help if you send init.lua LAST]

Everything seems to have worked. To test I held the reset button for five seconds to put the IFTTT button into AP mode. Sure enough, an AP soon showed up. I didn't realize it, but the network config I put into setwifi.lua defined the AP setup, not the setup for which wifi to connect to. I ended up having the AP mode using the same network name as my home AP.

I edited the file back to its original state and re-flashed it.

At this point I haven't hooked anything else up to the board, so there is no button to press to test if everything is working on the IFTTT side. This board is supposed to let you use the flash button as an input so the next thing is to try to figure that out. If I can use the onboard button this will be a completely self-contained unit!

Discussions