This project emulates a Philips Hue Bridge that is able to control Hue lights (using original Hue Bridge), IKEA Tradfri lights (usign Tradfri Bridge), Mi-Light bulbs (using MiLight Hub), Neopixel strips (WS2812B and SK6812) and any cheep ESP8266 based bulb from market by replacing firmware with custom one. Is written in python and will run on all small boxes like RaspberryPi. There are provided sketches for Hue Dimmer Switch, Hue Tap Switch and Hue Motion Sensor. Lights are two-way synchronized so any change made from original Philips/Tradfri sensors and switches will be applied also to bridge emulator.
Update: starting with version 2 is possible to use ZigBee lights, sensors and switches with Raspbee module for RaspberryPI.
Components
1×
RaspberryPi
OrangePi, BananaPi must work as whell
3×
esp8266 boards
nodemcu, wemos d1 mini, etc. Qty is related to number of sensors/ lights
Hue Bridge emulator was rewrite in python and now require just to install nmap package and execute the python script with sudo. For startup you can create systemd service with a simple config file or you can add it directly to /etc/rc.local
Open http://{bridgeIP}/tradfri, type Ikea bridge ip and security key in form and then click "Save". If everything was fine you will see all lights paired with Tradfri bridge in Hue applications. Important: coap-client-linux binary is compiled for arm devices like raspberry pi. If you will use an x86 computer then you will need to recompile this.
MI-LIGHT:
esp8266_milight_hub is required https://github.com/sidoh/esp8266_milight_hub. Open http://{bridgeIP}/milight, complete the form and click Save. You need to repet this step for every light as there is no way to retrive the list of lights from milight hub.
LIGHT STRIPS:
Supported neopixel led are WS2812B and SK6812 (rgbw). Data in pin of the leds must be connected to dedicated harware pin of the esp8266 platforms (rx pin on wemos d1 mini and esp-12e) Compilation require Makuna/NeoPixelBus and WiFiManager libraries that can be very easy downloaded from Arduino library manager.
Options in skeches:
lightsCount x //number of emulated lights per strip
pixelCount xx // number of leds in stri
IPAddress strip_ip ( xxx, xxx, xxx, xxx); //if you want to use static ip uncommented with gateway_ip, subnet_mask and WiFi.config(strip_ip, gateway_ip, subnet_mask); lights can be controlled with any browser. example url:
hue: value between 0 and 65535, represent the hue of the light.
sat: saturation of the light. 255 is the most saturated and 0 is the least saturated.
bri: brightness of the light, 255 is the maximum brightness, 1 is the minimum, 0 will turn the light on to previews state
transitiontime: duration of the transition from the light’s current state to the new stat. default 4 represent 0.4 seconds.
bri_inc: increase of decrease the brightness with specified value
COLOR DREAM RGBW BULBS:
I found these bulbs are esp8266 based devices that can be adapted to work with this bridge. Despite the low price these bulbs feels solid, are more heavy than regular bulbs and i expect to be modium to long life. I was not able to flash the memory by connecting vdd, gnd, rx, tx, rst and gpio0 pins to a nodemcu dev board, but was very easy for me to replace the SPI flash chip from an already programmed epb8266 board. This operation took me about 30 seconds, while soldering the small wires took me more than 5 minutes. Future firmware updates will be easy to perform via Arduino OTA (wifi). Sketch for these bulbs can be found in RgbwHueBulb folder, the gpio pins defined (12, 13, 14 and 5) are the correct ones connected to leds. Bulbs where buyed from here:https://www.aliexpress.com/item/AC85-240V-5W-7W-9W-RGBW-WIFI-LED-Bulb-Light-Colorful-Dimmable-LED-Light-Support-IOS/32785628736.html?spm=2114.13010608.0.0.B8FcLh
3
Step 3
SENSORS:
DIMMER SWITCH and TAP SWITCH
Require basic knowlege of electronics, in order to build the circuit from picture!
If is used an ESP-12E module, then must connect pin gpio15 with a 10k resitor to ground and pin CH_PD with a 10k resistor to VDD.
If everything is ok on first power on you will be able to see and configure a new switch in application. Is important to use static ip's because dhcp require extra time to perform the action. Switch will stay alive just 5 seconds, then will enter in deep sleep mode and will consume just 17uA. Once a button is pressed there will be a short negative pulse on RST pin that will wake up the module. This operation will take about 0.5 seconds. If the button is released in this period the chip will be unable to detect what button was pressed and will not send any requests to bridge.
By having a quilck look at the HueEmulator3.py I couldn't easily figure out if you actually rely on other gateways, if you rather recreate a new environment with all new Arduino devices or a mixture of both ?
Hi, this looks like a nice environment that brings many vendors together in one platform. Plus the organisation of the github looks very clean.
I wonder if you targeted the issue of using for a Zigbee sensor events, as The Hue API had limitations in that regard, that deCONZ solved with a websocket events notification. I started an example here https://github.com/nRFMesh/nRF52_Mesh/blob/master/raspi/conbee/conbee.py
By having a quilck look at the HueEmulator3.py I couldn't easily figure out if you actually rely on other gateways, if you rather recreate a new environment with all new Arduino devices or a mixture of both ?