How To: Inexpensive ($10 US) WiFi RGB Bulb that works with Home Assistant

As said before, cool update, love it :slight_smile:

In my DHCP server I give my bulbs a reserved IP address and I also put an entry in my DNS server, like, ailight01.mydomain.local, ailight02.mydomain.local ectā€¦

So in my case, instead of putting the IP I should be able to put the DNS name in OTA settings?

Yes, if you run your own DNS server, and set the hostnames like that, it should work fine. Just make sure those names resolve to the lightsā€™ IP address.

I also run my own local DNS, but feel itā€™s not set up correctly. Need to rethink about the configuration and all those IoT devices :unamused:

It should be possible to make the bulbs to self registrate to the DNS server from the DHCP server. It then looks what the hostname is and then makes an entry in the DNS server.

If your DNS/DHCP servers support that then yes it can work. I am not an expert on DNS/DHCP matters, so I might be wrong.

when I try to do a nom install or yarn install I get an error message,ā€¦
ā€œbash: npm: command not foundā€ or ā€œbash: yarn: command not foundā€
Iā€™m on OSX running Atom

@DariBer I believe you need to install NodeJS first. For OS X you can download and install it from the nodejs.org website here. After that I believe you should be able to run ā€˜npm installā€™. NOTE: Per Sachaā€™s instructions, donā€™t forget to do this in the directory where you cloned AiLight (e.g ā€˜AiLightā€™), otherwise the NodeJS packages will not get installed. In other words, make sure youā€™re in the same directory as package.json, or else none of the packages will install properly and youā€™ll get all kinds of errors when you try to compile.

thanx. now I was able to run nom install. I did run the command from PlatformIO inside the AiLight directory

and when i try to ā€œbuildā€ I get an error message.

Compiling .pioenvs/dev/FrameworkArduino/core_esp8266_eboot_command.o
Compiling .pioenvs/dev/FrameworkArduino/core_esp8266_eboot_command.o
*** [.pioenvs/dev/src/main.ino.o] Error 1
Compiling .pioenvs/dev/FrameworkArduino/core_esp8266_flash_utils.o
Compiling .pioenvs/dev/FrameworkArduino/core_esp8266_flash_utils.o
*** [.pioenvs/dev/src/main.ino.o] Error 1
========================== [ERROR] Took 1.99 seconds ==========================
Environment dev [ERROR]
========================== [ERROR] Took 1.99 seconds ==========================

I saw that I missed some more error message I got when building.

before_build([".pioenvs/dev/src/main.ino.o"], ["src/main.ino.cpp"])
gulp
sh: gulp: command not found
*** Error 127

before_build([".pioenvs/dev/src/main.ino.o"], ["src/main.ino.cpp"])
gulp
Compiling .pioenvs/dev/src/main.ino.o
sh: gulp: command not found
*** Error 127
Compiling .pioenvs/dev/src/main.ino.o
In file included from /Users/user/Documents/Arduino/ProjectsPlatformIO/AiLight/src/main.ino:13:0:
src/main.h:36:21: fatal error: html.gz.h: No such file or directory
#include "html.gz.h"
^
compilation terminated.
In file included from /Users/user/Documents/Arduino/ProjectsPlatformIO/AiLight/src/main.ino:13:0:
src/main.h:36:21: fatal error: html.gz.h: No such file or directory
#include "html.gz.h"
^
compilation terminated.

Hmmm, looks like the compiler canā€™t find gulp, etc. gulp should have been installed as a dependency when you ran ā€˜npm installā€™ from inside the same directory as package.json. I made the mistake of running ā€˜npm installā€™ when not in the same directory as package.json and ended up with similar compiler errors. Iā€™m not sure if thatā€™s whatā€™s happening, but my guess is that not all the dependencies were installed from the package.json file.

As @ekim said, please run the ā€˜npm installā€™ command (or if you prefer Yarn: ā€˜yarn installā€™) in the directory where you cloned the repository. You can also delete the node_modules directory and run the ā€˜npm installā€™ command again.

Seeing that people have some difficulties with building the UI part (NodeJS), I can put a precompiled version of the UI (html.gz.h) on Github. Only for people that want to modify and build it themselves need to install NodeJSā€¦

I had the same problem with the out of the box AiLight firmware. I am running on a MAC and using nvm to manage node versions, but that might not be relevant.

I solved the problem as follows:

  • Install dependencies with npm install
  • In build.py replace
env.Execute("gulp")

with

env.Execute("node_modules/gulp/bin/gulp.js --gulpfile gulpfile.js")
  • Since Iā€™m using nvm, I was forced into using a platformio terminal session rather than the IDE (due to environment issues) where I setup the proper node environment using nvm prior to executing the build. One might be able to use the IDE if the proper environment is setup at loginā€¦but I tend to not do that. I uploaded the new firmware OTA using the following from a platformio terminal session:
> pio run --environment dev-ota --target upload

Worked fine. I actually was able to OTA the firmware onto an existing espurna install on the light. I just had to make sure that the upload hostname in platformio.ini was the hostname as defined by espurna for the initial OTA upload. Thereafter, the hostname format as defined by stelgenhof firmware is sufficient.

See this StackOverflow post for details.

Ah, thanks for catching this @bhaonvashon! I believed that Gulp must be installed both globally and locally. See also this post: http://blog.dwaynecrooks.com/post/110903139442/why-do-we-need-to-install-gulp-globally-and

However, I think using only the locally installed gulp binary is a better approach. Let me adjust the build.py file accordingly so people wonā€™t have this issue anymore.

Thanks again!

I changed the path in the build.py file so the locally installed Gulp binary is used.

(Please note that the latest master branch contains other changes, so be aware of that when you update your repository.)

Hey guys my 20 bulbs arrived. Now before I break the first one, does the glass bit pull off or screw off?

I twisted and pulled and it didnā€™t come off easily. I donā€™t want to break itā€¦

Cool! The plastic cap has no thread so you need to pull it off. I usually twist it around and then try to open it at an angle (Like a lid). It usually pops off quite easily.

(Also ordered another 10 of them :slight_smile: )

cool, hope you get them off, for me it was just twist little bit and then pull off one side first.

I have started to make a jig so that I donā€™t need to solder every bulb. I have my pogo pins and now Iā€™m building the PCB board that will hold the pins on right place.

@DariBer Interested in your jig! I donā€™t mind soldering but those pads are pretty small :slight_smile:

Yeah I pulled harder while twisting and achieved separation.

Was thinking of a pogo pin jig, so very keen to learn more of your project @DariBer.

My friend borrowed my Dermel, will try to get it so that I can finish the build this weekend. will take photos and try to describe how I build it.

right now I have just made a template of where the pogo pins will be. I just took transparent tape, and put it on the side where the pads are and marked on the tape with a pen.

Will get back this weekend with more info

Simple enough. I was going to take a photo with a ruler included, so I could then CAD something to scale.

I foresee the real difficulty being rotational alignment as you try to join the pogo pin assembly to the bulb. I was thinking something like a pi camera so you can see on a screen how the pins are lining up with the pads.

I may be over thinking it of course.