ESP Week - 43, 2018

For the last few weeks I have been working on connecting an led strip I purchased at Costco to my nodemcu. I have had the controller supplied by costco die for 2 of them so far, so rather then chucking them all, have been working thru connecting them to an esp8266.

The led strips themselves are of a RGB+W type, with white being a separate LED that is directly controlled. The strip itself has 5 wires, 24V, DIN, Check, White and GND, and the strip is using the sm16703p chip to control the RGB LEDS.

For my replacement controller, I used a nodemcu/esp8266 and have been coding in LUA to make this work, and integrate into homebridge. The gory details are here

https://github.com/NorthernMan54/homebridge-mculed

I'm in the early BETA days, and have everything working, just working thru the final details prior publishing/shipping the device. My internal WAF testing has provided alot of feedback, so am working thru the final tweaks based on that.

My lua code base has a lot of advanced features that represent a culmination of a couple years of nodemcu/lua coding. For provisioning, I'm using TerryE and Marcelstoer's OTA example for OTA updates. For device discovery, I'm using mDNS and borrowed this from Frank Edelhaeuser. And for the control interface I'm using web sockets, and used the example from creationix.

Device booting looks like this

1) On boot, wait 1 second then start wifi then check for OTA updates. 2) Discover OTA update server using mDNS 3) Download and compile any updated lua code 4) Reboot device to cleanup memory usage from OTA update process 5) On reboot check for any remaining OTA updates, and if none start main program 6) Start a web socket and advertise mculed device on network via mDNS 7) In homebridge-mculed, watch mDNS for mculed devices, and when discovered creating HomeKit device based on config returned from nodemcu. 8) In homebridge create control interface to nodemcu via web sockets, and start watching for events. 9) When a local control event occurs in nodemcu, send status update events to all web socket clients. 10) In homebridge, when the device is controlled send a websocket request to nodemcu with changed settings.

Looking at this, I realize I could use mqtt instead of web sockets, but felt that web sockets offered not a lot more functionality but added more complexity to the eco system thru the need to install and maintain a mosquito server etc. My ecosystem includes a couple of different houses/networks so keeping the ecosystem simple is part of my design principals.

/r/esp8266 Thread