├── .gitmodules ├── Images ├── Hue_Tap ├── 2_Lamps.jpeg ├── Switch1.jpg ├── Switch2.jpg ├── hue-map.png ├── lightGUI.png ├── test_room.jpg ├── Motion_Sensor_1.jpg ├── Motion_Sensor_2.jpg ├── Motion_Sensor_3.jpg ├── Motion_Sensor_4.jpg ├── Ring_Lamp_Inner.jpg ├── 3-Boxes_Lamp_Controller.jpeg ├── 3-Boxes_Lamp_Controller2.jpeg ├── sensor_power_consumption_alive.jpg ├── strip_wiring_to_wemos_d1_mini.jpg ├── Color_Dream_bulb_with_flash_replaced.jpg ├── MiLight_RGB_CCT_converted_to_ESP-12S.jpg ├── sensor_power_consumption_deep_sleep.jpg ├── Hue_Motion_sensor_circuit_prototype_v2.png └── Hue_Tap-Dimmer_switch_circuit_prototype.png ├── BridgeEmulator ├── protocols │ └── __init__.py ├── web-ui-src │ ├── .prettierrc │ ├── build │ │ ├── config.js.example │ │ ├── favicon.ico │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── mstile-70x70.png │ │ ├── apple-touch-icon.png │ │ ├── mstile-144x144.png │ │ ├── mstile-150x150.png │ │ ├── mstile-310x150.png │ │ ├── mstile-310x310.png │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── asset-manifest.json │ │ ├── browserconfig.xml │ │ ├── site.webmanifest │ │ ├── html_code.html │ │ ├── index.html │ │ ├── safari-pinned-tab.svg │ │ ├── service-worker.js │ │ └── static │ │ │ └── css │ │ │ └── main.23de7225.css │ ├── public │ │ ├── config.js.example │ │ ├── favicon.ico │ │ ├── mstile-70x70.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── mstile-144x144.png │ │ ├── mstile-150x150.png │ │ ├── mstile-310x150.png │ │ ├── mstile-310x310.png │ │ ├── apple-touch-icon.png │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── browserconfig.xml │ │ ├── site.webmanifest │ │ ├── html_code.html │ │ ├── safari-pinned-tab.svg │ │ └── index.html │ ├── package.json │ └── src │ │ ├── index.js │ │ ├── color.js │ │ └── App.js ├── web-ui │ ├── config.js.example │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── mstile-70x70.png │ ├── apple-touch-icon.png │ ├── mstile-144x144.png │ ├── mstile-150x150.png │ ├── mstile-310x150.png │ ├── mstile-310x310.png │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── asset-manifest.json │ ├── browserconfig.xml │ ├── site.webmanifest │ ├── html_code.html │ ├── index.html │ ├── safari-pinned-tab.svg │ ├── service-worker.js │ └── static │ │ └── css │ │ └── main.23de7225.css ├── coap-client-arm ├── entertainment-arm ├── coap-client-x86_64 ├── entertainment-x86_64 ├── updater ├── hue-emulator.service ├── functions │ ├── __init__.py │ ├── colors.py │ └── ssdp.py ├── debug │ └── clip.html └── easy_install.sh ├── requirements.txt ├── .gitattributes ├── Lights ├── PlatformIO │ ├── SK6812HueStrip │ │ ├── .gitignore │ │ ├── src │ │ │ └── .DS_Store │ │ ├── lib │ │ │ └── readme.txt │ │ ├── platformio.ini │ │ └── .travis.yml │ ├── WS2812BHueStrip │ │ ├── .gitignore │ │ ├── src │ │ │ └── .DS_Store │ │ ├── platformio.ini │ │ ├── lib │ │ │ └── readme.txt │ │ └── .travis.yml │ ├── Generic_CCT_Light │ │ ├── .gitignore │ │ ├── .DS_Store │ │ ├── lib │ │ │ ├── .DS_Store │ │ │ └── readme.txt │ │ ├── src │ │ │ └── .DS_Store │ │ ├── platformio.ini │ │ └── .travis.yml │ ├── Generic_RGBW_Light │ │ ├── .gitignore │ │ ├── .DS_Store │ │ ├── lib │ │ │ ├── .DS_Store │ │ │ └── readme.txt │ │ ├── src │ │ │ └── .DS_Store │ │ ├── platformio.ini │ │ └── .travis.yml │ ├── Generic_RGB_Light │ │ ├── .gitignore │ │ ├── .DS_Store │ │ ├── lib │ │ │ ├── .DS_Store │ │ │ └── readme.txt │ │ ├── platformio.ini │ │ └── .travis.yml │ └── Generic_RGB_CCT_Light │ │ ├── .gitignore │ │ ├── .DS_Store │ │ ├── lib │ │ ├── .DS_Store │ │ └── readme.txt │ │ ├── src │ │ └── .DS_Store │ │ ├── platformio.ini │ │ └── .travis.yml ├── PCB_Files │ └── ESP8266-01_4Channels │ │ ├── Project Outputs for LED_Controller_4Channels │ │ ├── LED_Controller_4Channels-macro.APR_LIB │ │ ├── LED_Controller_4Channels.RUL │ │ ├── Status Report.Txt │ │ ├── LED_Controller_4Channels.EXTREP │ │ ├── LED_Controller_4Channels.GTP │ │ ├── LED_Controller_4Channels.GBP │ │ ├── LED_Controller_4Channels.GBO │ │ ├── LED_Controller_4Channels.GBS │ │ ├── LED_Controller_4Channels.GTS │ │ ├── LED_Controller_4Channels.apr │ │ ├── LED_Controller_4Channels.GG1 │ │ ├── LED_Controller_4Channels.REP │ │ └── LED_Controller_4Channels.GD1 │ │ ├── LED_Controller_4Channels.PrjPcbStructure │ │ ├── LED_Controller_4Channels.cam │ │ ├── LED_Controller_4Channels.PcbDoc │ │ ├── LED_Controller_4Channels.SchDoc │ │ └── __Previews │ │ └── LED_Controller_4Channels.PcbDocPreview └── Arduino │ ├── MY92XX_RGBW_Light │ ├── .DS_Store │ ├── my92xx.h │ └── my92xx.cpp │ ├── Sonoff_S20 │ └── images │ │ ├── SONOFF.jpg │ │ └── sonoff_s20.jpg │ ├── Generic_RGBW_Light │ ├── images │ │ ├── Over.jpg │ │ ├── Under.jpg │ │ └── schematic.JPG │ └── README.md │ ├── Generic_Dimmable_Light │ ├── images │ │ ├── Over.jpg │ │ └── Under.jpg │ └── README.md │ ├── Generic_ON_OFF_device_433Mhz │ ├── images │ │ ├── PCB1.jpg │ │ ├── PCB2.jpg │ │ ├── Fritzing.JPG │ │ └── Schematic.JPG │ └── readme.md │ ├── fastLED_SM16726_RGBW_Bulb │ └── README.md │ └── Generic_ON_OFF_device │ └── Generic_ON_OFF_device.ino ├── Sensors ├── HueSensorStandardLightSwitch │ ├── InApp.png │ ├── Wiring_1.jpg │ ├── Wiring_2.jpg │ ├── Placed_in_a_wall.jpg │ ├── Wiring_schematic.png │ ├── Readme.txt │ └── Arduino │ │ └── HueSensorStandardLightSwitchV2 │ │ └── HueSensorStandardLightSwitchV2.ino ├── HueDimmerSwitch │ ├── README.md │ └── HueDimmerSwitch.ino ├── HueTapSwitch │ ├── README.md │ └── HueTapSwitch.ino └── HueMotionSensor │ ├── README.md │ └── HueMotionSensor.ino ├── .gitignore ├── .build ├── docker-compose.yml ├── openssl.conf ├── genCert.sh ├── startup.sh ├── arm.Dockerfile └── amd64.Dockerfile ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── docker-bug-report.md ├── .travis.yml └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Images/Hue_Tap: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BridgeEmulator/protocols/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/.prettierrc: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | astral==1.6.1 2 | ws4py==0.5.1 3 | requests==2.20.0 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | Lights/* linguist-vendored 2 | Sensors/* linguist-vendored 3 | -------------------------------------------------------------------------------- /Images/2_Lamps.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/2_Lamps.jpeg -------------------------------------------------------------------------------- /Images/Switch1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Switch1.jpg -------------------------------------------------------------------------------- /Images/Switch2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Switch2.jpg -------------------------------------------------------------------------------- /Images/hue-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/hue-map.png -------------------------------------------------------------------------------- /Images/lightGUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/lightGUI.png -------------------------------------------------------------------------------- /Images/test_room.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/test_room.jpg -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/config.js.example: -------------------------------------------------------------------------------- 1 | window.config = { 2 | API_KEY: "BRIDGE_API_KEY_HERE" 3 | }; 4 | -------------------------------------------------------------------------------- /Images/Motion_Sensor_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Motion_Sensor_1.jpg -------------------------------------------------------------------------------- /Images/Motion_Sensor_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Motion_Sensor_2.jpg -------------------------------------------------------------------------------- /Images/Motion_Sensor_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Motion_Sensor_3.jpg -------------------------------------------------------------------------------- /Images/Motion_Sensor_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Motion_Sensor_4.jpg -------------------------------------------------------------------------------- /Images/Ring_Lamp_Inner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Ring_Lamp_Inner.jpg -------------------------------------------------------------------------------- /Lights/PlatformIO/SK6812HueStrip/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /Lights/PlatformIO/WS2812BHueStrip/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/config.js.example: -------------------------------------------------------------------------------- 1 | window.config = { 2 | API_KEY: "BRIDGE_API_KEY_HERE", 3 | }; 4 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/config.js.example: -------------------------------------------------------------------------------- 1 | window.config = { 2 | API_KEY: "BRIDGE_API_KEY_HERE" 3 | }; 4 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /BridgeEmulator/coap-client-arm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/coap-client-arm -------------------------------------------------------------------------------- /BridgeEmulator/entertainment-arm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/entertainment-arm -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels-macro.APR_LIB: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /BridgeEmulator/coap-client-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/coap-client-x86_64 -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/favicon.ico -------------------------------------------------------------------------------- /BridgeEmulator/entertainment-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/entertainment-x86_64 -------------------------------------------------------------------------------- /Images/3-Boxes_Lamp_Controller.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/3-Boxes_Lamp_Controller.jpeg -------------------------------------------------------------------------------- /Images/3-Boxes_Lamp_Controller2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/3-Boxes_Lamp_Controller2.jpeg -------------------------------------------------------------------------------- /BridgeEmulator/updater: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "apiversion": "1.24.0", 4 | "swversion": "1809121051" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/favicon-16x16.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/favicon-32x32.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/mstile-70x70.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/apple-touch-icon.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/mstile-144x144.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/mstile-150x150.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/mstile-310x150.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/mstile-310x310.png -------------------------------------------------------------------------------- /Images/sensor_power_consumption_alive.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/sensor_power_consumption_alive.jpg -------------------------------------------------------------------------------- /Images/strip_wiring_to_wemos_d1_mini.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/strip_wiring_to_wemos_d1_mini.jpg -------------------------------------------------------------------------------- /Lights/Arduino/MY92XX_RGBW_Light/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/MY92XX_RGBW_Light/.DS_Store -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/favicon.ico -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/favicon.ico -------------------------------------------------------------------------------- /Lights/Arduino/Sonoff_S20/images/SONOFF.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Sonoff_S20/images/SONOFF.jpg -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.PrjPcbStructure: -------------------------------------------------------------------------------- 1 | Record=TopLevelDocument|FileName=LED_Controller_4Channels.SchDoc 2 | -------------------------------------------------------------------------------- /Images/Color_Dream_bulb_with_flash_replaced.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Color_Dream_bulb_with_flash_replaced.jpg -------------------------------------------------------------------------------- /Images/MiLight_RGB_CCT_converted_to_ESP-12S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/MiLight_RGB_CCT_converted_to_ESP-12S.jpg -------------------------------------------------------------------------------- /Images/sensor_power_consumption_deep_sleep.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/sensor_power_consumption_deep_sleep.jpg -------------------------------------------------------------------------------- /Lights/Arduino/Sonoff_S20/images/sonoff_s20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Sonoff_S20/images/sonoff_s20.jpg -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_CCT_Light/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGBW_Light/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_Light/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGB_Light/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/SK6812HueStrip/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/SK6812HueStrip/src/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/WS2812BHueStrip/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/WS2812BHueStrip/src/.DS_Store -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/InApp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Sensors/HueSensorStandardLightSwitch/InApp.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/favicon-16x16.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/favicon-32x32.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/mstile-70x70.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/mstile-70x70.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/android-chrome-192x192.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui/android-chrome-512x512.png -------------------------------------------------------------------------------- /Images/Hue_Motion_sensor_circuit_prototype_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Hue_Motion_sensor_circuit_prototype_v2.png -------------------------------------------------------------------------------- /Lights/Arduino/Generic_RGBW_Light/images/Over.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_RGBW_Light/images/Over.jpg -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_CCT_Light/lib/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_CCT_Light/src/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGB_CCT_Light/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_Light/lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGB_Light/lib/.DS_Store -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/Wiring_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Sensors/HueSensorStandardLightSwitch/Wiring_1.jpg -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/Wiring_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Sensors/HueSensorStandardLightSwitch/Wiring_2.jpg -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/apple-touch-icon.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/mstile-144x144.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/mstile-150x150.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/mstile-310x150.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/mstile-310x310.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/favicon-16x16.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/favicon-32x32.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/mstile-144x144.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/mstile-150x150.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/mstile-310x150.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/mstile-310x310.png -------------------------------------------------------------------------------- /Images/Hue_Tap-Dimmer_switch_circuit_prototype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Images/Hue_Tap-Dimmer_switch_circuit_prototype.png -------------------------------------------------------------------------------- /Lights/Arduino/Generic_RGBW_Light/images/Under.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_RGBW_Light/images/Under.jpg -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGBW_Light/lib/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGBW_Light/src/.DS_Store -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/apple-touch-icon.png -------------------------------------------------------------------------------- /Lights/Arduino/Generic_Dimmable_Light/images/Over.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_Dimmable_Light/images/Over.jpg -------------------------------------------------------------------------------- /Lights/Arduino/Generic_Dimmable_Light/images/Under.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_Dimmable_Light/images/Under.jpg -------------------------------------------------------------------------------- /Lights/Arduino/Generic_RGBW_Light/images/schematic.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_RGBW_Light/images/schematic.JPG -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGB_CCT_Light/lib/.DS_Store -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PlatformIO/Generic_RGB_CCT_Light/src/.DS_Store -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/Placed_in_a_wall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Sensors/HueSensorStandardLightSwitch/Placed_in_a_wall.jpg -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/Wiring_schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Sensors/HueSensorStandardLightSwitch/Wiring_schematic.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/android-chrome-192x192.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/build/android-chrome-512x512.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/BridgeEmulator/web-ui-src/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB1.jpg -------------------------------------------------------------------------------- /Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB2.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | __pycache__ 3 | BridgeEmulator/web-ui/public/config.js 4 | BridgeEmulator/web-ui/public/config.js 5 | node_modules 6 | BridgeEmulator/config.json 7 | ./exports -------------------------------------------------------------------------------- /Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Fritzing.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Fritzing.JPG -------------------------------------------------------------------------------- /Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Schematic.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Schematic.JPG -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.cam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.cam -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.PcbDoc -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/diyHue/master/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.SchDoc -------------------------------------------------------------------------------- /.build/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | diyHue: 4 | image: diyhue/core:amd64 5 | restart: always 6 | volumes: 7 | - ../exports:/opt/hue-emulator/export 8 | network_mode: "host" -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "main.css": "static/css/main.23de7225.css", 3 | "main.css.map": "static/css/main.23de7225.css.map", 4 | "main.js": "static/js/main.7409e575.js", 5 | "main.js.map": "static/js/main.7409e575.js.map" 6 | } -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "main.css": "static/css/main.23de7225.css", 3 | "main.css.map": "static/css/main.23de7225.css.map", 4 | "main.js": "static/js/main.8451d178.js", 5 | "main.js.map": "static/js/main.8451d178.js.map" 6 | } -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #ffc40d 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #ffc40d 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #ffc40d 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /BridgeEmulator/hue-emulator.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Hue Emulator Service 3 | After=multi-user.target 4 | 5 | [Service] 6 | Type=idle 7 | Restart=always 8 | RestartSec=30 9 | StartLimitInterval=200 10 | StartLimitBurst=5 11 | 12 | WorkingDirectory=/opt/hue-emulator 13 | ExecStart=/opt/hue-emulator/HueEmulator3.py 14 | ExecStop=/usr/bin/curl http://127.0.0.1/save 15 | ExecStop=/bin/sleep 1 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.RUL: -------------------------------------------------------------------------------- 1 | DRC Rules Export File for PCB: E:\_DATEN\Alexander\Projekte\_Projektordner\HueBridge\diyHue\Lights\PCB_Files\ESP8266-01_4Channels\LED_Controller_4Channels.PcbDoc 2 | RuleKind=ShortCircuit|RuleName=ShortCircuit|Scope=Board|Allowed=0 3 | RuleKind=Clearance|RuleName=Clearance|Scope=Board|Minimum=10.00 4 | RuleKind=Width|RuleName=Width|Scope=Board|Minimum=10.00 5 | RuleKind=SolderMaskExpansion|RuleName=SolderMaskExpansion|Scope=Board|Minimum=4.00 6 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "diyHue", 3 | "short_name": "diyHue", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "diyHue", 3 | "short_name": "diyHue", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "diyHue", 3 | "short_name": "diyHue", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/html_code.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/html_code.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/html_code.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve this project 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Logs** 21 | If applicable, provide output logs. These can be obtained via manually running HueEmulator3.py with `python3 HueEmulator3.py`. 22 | 23 | **Additional context** 24 | Add any other context about the problem here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. If you can provide an example solution then even better! 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /Lights/PlatformIO/WS2812BHueStrip/platformio.ini: -------------------------------------------------------------------------------- 1 | 2 | [common] 3 | lib_deps_external = 4 | NeoPixelBus 5 | WiFiManager 6 | 7 | [env:nodemcuv2] 8 | platform = espressif8266 9 | framework = arduino 10 | board = nodemcuv2 11 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2 12 | lib_deps = ${common.lib_deps_external} 13 | 14 | [env:d1_mini] 15 | platform = espressif8266 16 | framework = arduino 17 | board = d1_mini 18 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini 19 | lib_deps = ${common.lib_deps_external} 20 | 21 | [env:esp12] 22 | platform = espressif8266 23 | board = esp12e 24 | framework = arduino 25 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12 26 | lib_deps = ${common.lib_deps_external} 27 | -------------------------------------------------------------------------------- /.build/openssl.conf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 1024 3 | default_md = sha256 4 | default_keyfile = privkey.pem 5 | distinguished_name = req_distinguished_name 6 | attributes = req_attributes 7 | req_extensions = v3_req 8 | x509_extensions = usr_cert 9 | 10 | 11 | [ usr_cert ] 12 | basicConstraints=critical,CA:FALSE 13 | subjectKeyIdentifier=hash 14 | authorityKeyIdentifier=keyid,issuer 15 | keyUsage = critical, digitalSignature, keyEncipherment 16 | extendedKeyUsage = serverAuth 17 | 18 | [ v3_req ] 19 | extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection 20 | basicConstraints = CA:FALSE 21 | keyUsage = nonRepudiation, digitalSignature, keyEncipherment 22 | 23 | [ req_distinguished_name ] 24 | 25 | [ req_attributes ] 26 | -------------------------------------------------------------------------------- /Sensors/HueDimmerSwitch/README.md: -------------------------------------------------------------------------------- 1 | ## How Is working 2 | 3 | When any button is pressed there will be a voltage difference on PNP transistor between the emitter and the base witch will trigger the NPN transistor and the ESP will receive a short pulse on RST pin for deep sleep wake up. 4 | Because the circuit is supposed to be powered with Li-Ion battery there is a battery level monitor integrated witch will stop the operation when this become too low. 5 | OTA firmware upgrade cam be activated by pressing button 1 and 4 in the same time (led will flash 5 times). 6 | Is mandatory to set wifi name, wifi password, bridge emulator and static ip fields in the sketch header. 7 | 8 | ## Circuit diagram 9 | 10 | ![Circuit Diagram](https://github.com/mariusmotea/diyHue/raw/master/Images/Hue_Tap-Dimmer_switch_circuit_prototype.png) 11 | -------------------------------------------------------------------------------- /Sensors/HueTapSwitch/README.md: -------------------------------------------------------------------------------- 1 | ## How Is working 2 | 3 | When any button is pressed there will be a voltage difference on PNP transistor between the emitter and the base witch will trigger the NPN transistor and the ESP will receive a short pulse on RST pin for deep sleep wake up. 4 | Because the circuit is supposed to be powered with Li-Ion battery there is a battery level monitor integrated witch will stop the operation when this become too low. 5 | OTA firmware upgrade cam be activated by pressing button 1 and 4 in the same time (led will flash 5 times). 6 | Is mandatory to set wifi name, wifi password, bridge emulator and static ip fields in the sketch header. 7 | 8 | ## Circuit diagram 9 | 10 | ![Circuit Diagram](https://github.com/mariusmotea/diyHue/raw/master/Images/Hue_Tap-Dimmer_switch_circuit_prototype.png) 11 | -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/Readme.txt: -------------------------------------------------------------------------------- 1 | You can wire 2 switches with one ESP8266-01 2 | Using a ESP8266-12 etc. is possible but you can not controll more than 2 switches 3 | The module will register as 'Tap-Switch'. 4 | 5 | If you only use one switch connect the not used input (GPIO2 or RX) to GND 6 | 7 | 8 | MAKE SURE YOU DONT CONNECT ANY 230V POWERLINES TO THE SWITCH! only the 5V AC/DC-Regulator should be connected to 230V 9 | 10 | As AC/DC-Regulator i recommend something like this: 11 | https://www.amazon.de/dp/B00SEIILAG/ref=cm_sw_em_r_mt_dp_dDbXzb2H1XPQ7 12 | or something like this: 13 | https://www.banggood.com/US-Plug-Charger-USB-Power-Charger-For-Mobile-Phones-p-82319.html 14 | 15 | Break it open, desolder the 5V USB Female connector and you have a very tiny little power converter. 16 | 17 | 18 | Look at the pictures for more informations! 19 | 20 | 21 | -------------------------------------------------------------------------------- /.build/genCert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ -z ${1+x} ]; then 3 | echo "MAC not passed" 4 | mac=`cat /sys/class/net/$(ip route get 8.8.8.8 | sed -n 's/.* dev \([^ ]*\).*/\1/p')/address` 5 | else 6 | echo "MAC passed as '$1'" 7 | mac=$1 8 | fi 9 | 10 | echo -e "\033[33m--Host MAC address is $mac--\033[0m" 11 | 12 | serial="${mac:0:2}${mac:3:2}${mac:6:2}fffe${mac:9:2}${mac:12:2}${mac:15:2}" 13 | dec_serial=`python3 -c "print(int(\"$serial\", 16))"` 14 | openssl req -new -config /opt/hue-emulator/openssl.conf -nodes -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -subj "/C=NL/O=Philips Hue/CN=$serial" -keyout private.key -out public.crt -set_serial $dec_serial 15 | 16 | touch /opt/hue-emulator/cert.pem 17 | 18 | cat private.key > /opt/hue-emulator/cert.pem 19 | cat public.crt >> /opt/hue-emulator/cert.pem 20 | rm private.key public.crt 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docker-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Docker Bug report 3 | about: Create a report to help us improve our docker images 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Logs** 21 | If applicable, provide output logs. These can be obtained via running `docker logs diyHue` 22 | 23 | **Docker Info (please complete the following information):** 24 | - Architecture: [e.g. x86, ARM] 25 | - Docker image version: [e.g. latest, arm-05f043b] 26 | - Hardware: [e.g. PC, Raspberry Pi 1/2/3/Zero] 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/Status Report.Txt: -------------------------------------------------------------------------------- 1 | Output: Gerber Files 2 | Type : Gerber 3 | From : Variant [[No Variations]] of Project [LED_Controller_4Channels.PrjPcb] 4 | Generated File[LED_Controller_4Channels.GTL] 5 | Generated File[LED_Controller_4Channels.GBL] 6 | Generated File[LED_Controller_4Channels.GTO] 7 | Generated File[LED_Controller_4Channels.GTP] 8 | Generated File[LED_Controller_4Channels.GTS] 9 | Generated File[LED_Controller_4Channels.GBS] 10 | Generated File[LED_Controller_4Channels.GBP] 11 | Generated File[LED_Controller_4Channels.GBO] 12 | Generated File[LED_Controller_4Channels.GD1] 13 | Generated File[LED_Controller_4Channels.GG1] 14 | Generated File[LED_Controller_4Channels.RUL] 15 | Generated File[LED_Controller_4Channels.EXTREP] 16 | Generated File[LED_Controller_4Channels.REP] 17 | 18 | 19 | Files Generated : 13 20 | Documents Printed : 0 21 | 22 | Finished Output Generation At 19:24:17 On 17.10.2017 23 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/index.html: -------------------------------------------------------------------------------- 1 | diyHue
-------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/index.html: -------------------------------------------------------------------------------- 1 | diyHue
-------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hue-emulator-ui", 3 | "version": "1.0.0", 4 | "description": "", 5 | "keywords": [], 6 | "main": "src/index.js", 7 | "proxy": { 8 | "/api": { 9 | "target": "http://10.0.0.19" 10 | } 11 | }, 12 | "dependencies": { 13 | "@material-ui/core": "1.0.0-rc.0", 14 | "@material-ui/icons": "1.0.0-rc.0", 15 | "emotion": "9.1.3", 16 | "lodash": "^4.17.10", 17 | "mdi-react": "3.3.0", 18 | "rc-slider": "8.6.1", 19 | "react": "16.3.2", 20 | "react-color": "2.14.1", 21 | "react-dom": "16.3.2", 22 | "react-emotion": "9.1.3", 23 | "react-powerplug": "^1.0.0-rc.1", 24 | "react-scripts": "1.1.4" 25 | }, 26 | "devDependencies": { 27 | "husky": "^0.14.3", 28 | "pretty-quick": "^1.5.0" 29 | }, 30 | "scripts": { 31 | "start": "react-scripts start", 32 | "build": "react-scripts build", 33 | "test": "react-scripts test --env=jsdom", 34 | "eject": "react-scripts eject", 35 | "precommit": "pretty-quick --staged" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Lights/PlatformIO/SK6812HueStrip/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /Lights/PlatformIO/WS2812BHueStrip/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_Light/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [common] 12 | lib_deps_external = 13 | WiFiManager 14 | 15 | [env:nodemcuv2] 16 | platform = espressif8266 17 | framework = arduino 18 | board = nodemcuv2 19 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2 20 | lib_deps = 21 | ${common.lib_deps_external} 22 | 23 | [env:d1_mini] 24 | platform = espressif8266 25 | framework = arduino 26 | board = d1_mini 27 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini 28 | lib_deps = 29 | ${common.lib_deps_external} 30 | 31 | [env:esp12] 32 | platform = espressif8266 33 | board = esp12e 34 | framework = arduino 35 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12 36 | lib_deps = 37 | ${common.lib_deps_external} 38 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [common] 12 | lib_deps_external = 13 | WiFiManager 14 | 15 | [env:nodemcuv2] 16 | platform = espressif8266 17 | framework = arduino 18 | board = nodemcuv2 19 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2 20 | lib_deps = 21 | ${common.lib_deps_external} 22 | 23 | [env:d1_mini] 24 | platform = espressif8266 25 | framework = arduino 26 | board = d1_mini 27 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini 28 | lib_deps = 29 | ${common.lib_deps_external} 30 | 31 | [env:esp12] 32 | platform = espressif8266 33 | board = esp12e 34 | framework = arduino 35 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12 36 | lib_deps = 37 | ${common.lib_deps_external} 38 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_Light/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [common] 12 | lib_deps_external = 13 | WiFiManager 14 | 15 | [env:nodemcuv2] 16 | platform = espressif8266 17 | framework = arduino 18 | board = nodemcuv2 19 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2 20 | lib_deps = 21 | ${common.lib_deps_external} 22 | 23 | [env:d1_mini] 24 | platform = espressif8266 25 | framework = arduino 26 | board = d1_mini 27 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini 28 | lib_deps = 29 | ${common.lib_deps_external} 30 | 31 | [env:esp12] 32 | platform = espressif8266 33 | board = esp12e 34 | framework = arduino 35 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12 36 | lib_deps = 37 | ${common.lib_deps_external} 38 | -------------------------------------------------------------------------------- /BridgeEmulator/functions/__init__.py: -------------------------------------------------------------------------------- 1 | from .colors import * 2 | from .html import * 3 | from .ssdp import * 4 | 5 | 6 | def nextFreeId(bridge_config, element): 7 | i = 1 8 | while (str(i)) in bridge_config[element]: 9 | i += 1 10 | return str(i) 11 | 12 | 13 | light_types = {"LCT015": {"state": {"on": False, "bri": 200, "hue": 0, "sat": 0, "xy": [0.0, 0.0], "ct": 461, "alert": "none", "effect": "none", "colormode": "ct", "reachable": True}, "type": "Extended color light", "swversion": "1.29.0_r21169"}, "LST002": {"state": {"on": False, "bri": 200, "hue": 0, "sat": 0, "xy": [0.0, 0.0], "ct": 461, "alert": "none", "effect": "none", "colormode": "ct", "reachable": True}, "type": "Color light", "swversion": "5.105.0.21169"}, "LWB010": {"state": {"on": False, "bri": 254,"alert": "none", "reachable": True}, "type": "Dimmable light", "swversion": "1.15.0_r18729"}, "LTW001": {"state": {"on": False, "colormode": "ct", "alert": "none", "reachable": True, "bri": 254, "ct": 230}, "type": "Color temperature light", "swversion": "5.50.1.19085"}, "Plug 01": {"state": {"on": False, "alert": "none", "reachable": True}, "type": "On/Off plug-in unit", "swversion": "V1.04.12"}} 14 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [common] 12 | lib_deps_external = 13 | WiFiManager 14 | 15 | [env:nodemcuv2] 16 | platform = espressif8266 17 | framework = arduino 18 | board = nodemcuv2 19 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2 20 | lib_deps = 21 | ${common.lib_deps_external} 22 | 23 | [env:d1_mini] 24 | platform = espressif8266 25 | framework = arduino 26 | board = d1_mini 27 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini 28 | lib_deps = 29 | ${common.lib_deps_external} 30 | 31 | [env:esp12] 32 | platform = espressif8266 33 | board = esp12e 34 | framework = arduino 35 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12 36 | lib_deps = 37 | ${common.lib_deps_external} 38 | -------------------------------------------------------------------------------- /Lights/PlatformIO/SK6812HueStrip/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [common] 12 | lib_deps_external = 13 | NeoPixelBus 14 | WiFiManager 15 | 16 | [env:nodemcuv2] 17 | platform = espressif8266 18 | framework = arduino 19 | board = nodemcuv2 20 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=nodemcuv2 21 | lib_deps = 22 | ${common.lib_deps_external} 23 | 24 | [env:d1_mini] 25 | platform = espressif8266 26 | framework = arduino 27 | board = d1_mini 28 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=d1_mini 29 | lib_deps = 30 | ${common.lib_deps_external} 31 | 32 | [env:esp12] 33 | platform = espressif8266 34 | board = esp12e 35 | framework = arduino 36 | build_flags = -Wl,-Tesp8266.flash.4m1m.ld -D FIRMWARE_VARIANT=esp12 37 | lib_deps = 38 | ${common.lib_deps_external} 39 | -------------------------------------------------------------------------------- /Sensors/HueMotionSensor/README.md: -------------------------------------------------------------------------------- 1 | ## How Is working 2 | 3 | Hue Motion sensor need to send the folowing informations to bridge: 4 | - light level (default is at every 20 minutes) 5 | - when motion is detectet (instant) 6 | - when there is no motions enymore (30 seconds after last motion detected) 7 | 8 | Because deepsleep mode is used to preserve battery life the rtc memory is used to store the last state. 9 | In order to solve rf interferences issue of the previews version now esp8266 is wake up in non rf mode, read the GPIO pin states and then reset in default rf mode to send the data. This will add a very small delay (<500ms). 10 | 11 | ## Circuit diagram 12 | 13 | ![Circuit Diagram](https://raw.githubusercontent.com/mariusmotea/diyHue/develop/Images/Hue_Motion_sensor_circuit_prototype_v2.png) 14 | 15 | ## Prototypes 16 | 17 | ![Prototype1](https://raw.githubusercontent.com/mariusmotea/diyHue/develop/Images/Motion_Sensor_1.jpg) 18 | 19 | ![Prototype1](https://raw.githubusercontent.com/mariusmotea/diyHue/develop/Images/Motion_Sensor_2.jpg) 20 | 21 | ![Prototype1](https://raw.githubusercontent.com/mariusmotea/diyHue/develop/Images/Motion_Sensor_3.jpg) 22 | 23 | ![Prototype1](https://raw.githubusercontent.com/mariusmotea/diyHue/develop/Images/Motion_Sensor_4.jpg) 24 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.EXTREP: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------------------ 2 | Gerber File Extension Report For: LED_Controller_4Channels.GBR 17.10.2017 19:24:17 3 | ------------------------------------------------------------------------------------------ 4 | 5 | 6 | ------------------------------------------------------------------------------------------ 7 | Layer Extension Layer Description 8 | ------------------------------------------------------------------------------------------ 9 | .GTL Top Layer 10 | .GBL Bottom Layer 11 | .GTO Top Overlay 12 | .GTP Top Paste 13 | .GTS Top Solder 14 | .GBS Bottom Solder 15 | .GBP Bottom Paste 16 | .GBO Bottom Overlay 17 | .GD1 Drill Drawing 18 | .GG1 Drill Guide 19 | ------------------------------------------------------------------------------------------ 20 | -------------------------------------------------------------------------------- /Lights/Arduino/Generic_ON_OFF_device_433Mhz/readme.md: -------------------------------------------------------------------------------- 1 | # 433Mhz Power Socket - Control (Hue Bulb Emulation) 2 | This ESP-8266 Firmware controls generic 433Mhz Power Sockets. 3 | Showing up as regular Hue Bulbs with ON/OFF feature. 4 | 5 | * I used one of those cheap Transmitters. [Ebay-Link](https://www.ebay.com/itm/5pcs-433Mhz-RF-transmitter-and-receiver-kit-for-Arduino/381374427148?epid=2037463354&hash=item58cbaff00c:g:8wEAAOSw6EhUN9s-) 6 | * Controlling cheap 433mhz Power Sockets [Picture below] 7 | 8 | * Directly connected to VCC(+3,3V) GPIO4 (Data) and GND. 9 | * You need to Edit your **"House Code"** in order to control the correct Sockets! 10 | 11 | 12 |
13 | 14 |
15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 |
24 |
25 |
26 | 27 |
28 |
29 |
30 |
31 | 32 |
33 |
34 |
35 |
36 | 37 |
38 | 39 |
40 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GTP: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | G04 Layer_Color=8421504* 7 | %ADD10R,0.05512X0.04331*% 8 | %ADD11R,0.04331X0.10630*% 9 | %ADD12R,0.42126X0.36221*% 10 | %ADD13R,0.04331X0.05512*% 11 | %ADD14C,0.01200*% 12 | %ADD15C,0.07500*% 13 | %ADD16C,0.10000*% 14 | %ADD17C,0.05000*% 15 | %ADD18C,0.02000*% 16 | %ADD19C,0.02500*% 17 | %ADD20C,0.06000*% 18 | %ADD21R,0.06000X0.06000*% 19 | %ADD22R,0.05906X0.05906*% 20 | %ADD23C,0.05906*% 21 | %ADD24C,0.04724*% 22 | %ADD25C,0.05315*% 23 | %ADD26R,0.05315X0.05315*% 24 | %ADD27R,0.06299X0.06299*% 25 | %ADD28C,0.06299*% 26 | %ADD29R,0.05315X0.05315*% 27 | %ADD30C,0.05000*% 28 | %ADD31C,0.02500*% 29 | %ADD32C,0.00984*% 30 | %ADD33C,0.00787*% 31 | %ADD34C,0.00050*% 32 | %ADD35C,0.01000*% 33 | %ADD36C,0.00591*% 34 | D10* 35 | X148500Y77453D02* 36 | D03* 37 | Y71547D02* 38 | D03* 39 | X5000Y103953D02* 40 | D03* 41 | Y98047D02* 42 | D03* 43 | X114000Y103453D02* 44 | D03* 45 | Y97547D02* 46 | D03* 47 | D11* 48 | X141500Y74468D02* 49 | D03* 50 | X121500D02* 51 | D03* 52 | X121000Y101031D02* 53 | D03* 54 | X141000D02* 55 | D03* 56 | X12000D02* 57 | D03* 58 | X32000D02* 59 | D03* 60 | D12* 61 | X131500Y41327D02* 62 | D03* 63 | X131000Y134173D02* 64 | D03* 65 | X22000D02* 66 | D03* 67 | D13* 68 | X67547Y68500D02* 69 | D03* 70 | X73453D02* 71 | D03* 72 | X85953Y68500D02* 73 | D03* 74 | X80047D02* 75 | D03* 76 | X99953D02* 77 | D03* 78 | X94047D02* 79 | D03* 80 | M02* 81 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GBP: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | G04 Layer_Color=128* 7 | %ADD10R,0.05512X0.04331*% 8 | %ADD11R,0.04331X0.10630*% 9 | %ADD12R,0.42126X0.36221*% 10 | %ADD13R,0.04331X0.05512*% 11 | %ADD14C,0.01200*% 12 | %ADD15C,0.07500*% 13 | %ADD16C,0.10000*% 14 | %ADD17C,0.05000*% 15 | %ADD18C,0.02000*% 16 | %ADD19C,0.02500*% 17 | %ADD20C,0.06000*% 18 | %ADD21R,0.06000X0.06000*% 19 | %ADD22R,0.05906X0.05906*% 20 | %ADD23C,0.05906*% 21 | %ADD24C,0.04724*% 22 | %ADD25C,0.05315*% 23 | %ADD26R,0.05315X0.05315*% 24 | %ADD27R,0.06299X0.06299*% 25 | %ADD28C,0.06299*% 26 | %ADD29R,0.05315X0.05315*% 27 | %ADD30C,0.05000*% 28 | %ADD31C,0.02500*% 29 | %ADD32C,0.00984*% 30 | %ADD33C,0.00787*% 31 | %ADD34C,0.00050*% 32 | %ADD35C,0.01000*% 33 | %ADD36C,0.00591*% 34 | %ADD37R,0.06312X0.05131*% 35 | %ADD38R,0.05131X0.11430*% 36 | %ADD39R,0.42926X0.37021*% 37 | %ADD40R,0.05131X0.06312*% 38 | %ADD41C,0.06800*% 39 | %ADD42R,0.06800X0.06800*% 40 | %ADD43R,0.06706X0.06706*% 41 | %ADD44C,0.06706*% 42 | %ADD45C,0.05524*% 43 | %ADD46C,0.06115*% 44 | %ADD47R,0.06115X0.06115*% 45 | %ADD48R,0.07099X0.07099*% 46 | %ADD49C,0.07099*% 47 | %ADD50R,0.06115X0.06115*% 48 | %ADD51C,0.05800*% 49 | %ADD52C,0.03300*% 50 | D10* 51 | X39500Y103953D02* 52 | D03* 53 | Y98047D02* 54 | D03* 55 | D11* 56 | X32000Y101031D02* 57 | D03* 58 | X12000D02* 59 | D03* 60 | D12* 61 | X22000Y134173D02* 62 | D03* 63 | D13* 64 | X94047Y68500D02* 65 | D03* 66 | X99953D02* 67 | D03* 68 | M02* 69 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | language: bash 5 | env: 6 | - ARCH=amd64 7 | - ARCH=arm 8 | script: 9 | - docker run --rm --privileged multiarch/qemu-user-static:register 10 | - docker build -t diyhue/core:$ARCH -f ./.build/$ARCH.Dockerfile . 11 | # test image 12 | - docker run -d --name "diyHue" --network="host" -v '/mnt/hue-emulator/export/':'/opt/hue-emulator/export/':'rw' -e 'MAC=b8:27:eb:d4:dc:11' -e 'IP=192.168.1.123' diyhue/core:$ARCH 13 | 14 | - sleep 10 15 | - docker logs diyHue 16 | - docker kill diyHue 17 | - docker rm diyHue 18 | 19 | after_success: 20 | # Tag and push built images 21 | - > 22 | if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then 23 | docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" 24 | docker tag diyhue/core:$ARCH diyhue/core:$ARCH-$TRAVIS_COMMIT 25 | docker push diyhue/core:$ARCH 26 | docker push diyhue/core:$ARCH-$TRAVIS_COMMIT 27 | 28 | # Download manifest-tool 29 | wget https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 30 | mv manifest-tool-linux-amd64 manifest-tool 31 | chmod +x manifest-tool 32 | # Push manifest-list 33 | ./manifest-tool push from-args --platforms linux/amd64,linux/arm --template "diyhue/core:ARCH-${TRAVIS_COMMIT}" --target "diyhue/core:$TRAVIS_COMMIT" 34 | ./manifest-tool push from-args --platforms linux/amd64,linux/arm --template "diyhue/core:ARCH-${TRAVIS_COMMIT}" --target "diyhue/core:latest" 35 | fi 36 | 37 | notifications: 38 | slack: diyhue:84x97ehqLW4B6pe9ntP16SOI 39 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.build/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -n ${1+x} ]; then 4 | mac=$1 5 | echo "MAC given as '$mac'" 6 | fi 7 | 8 | echo -e "\033[33m--Setting up diyHue--\033[0m" 9 | 10 | if [ -f "/opt/hue-emulator/export/cert.pem" ]; then 11 | echo -e "\033[33m--Restoring certificate--\033[0m" 12 | cp /opt/hue-emulator/export/cert.pem /opt/hue-emulator/cert.pem 13 | echo -e "\033[33m--Certificate restored--\033[0m" 14 | else 15 | echo -e "\033[33m--Generating certificate--\033[0m" 16 | /opt/hue-emulator/genCert.sh $mac 17 | cp /opt/hue-emulator/cert.pem /opt/hue-emulator/export/cert.pem 18 | echo -e "\033[33m--Certificate created--\033[0m" 19 | fi 20 | 21 | if [ -f "/opt/hue-emulator/export/config.json" ]; then 22 | echo -e "\033[33m--Restoring config--\033[0m" 23 | cp /opt/hue-emulator/export/config.json /opt/hue-emulator/config.json 24 | echo -e "\033[33m--Config restored--\033[0m" 25 | else 26 | echo -e "\033[33m--Downloading default config--\033[0m" 27 | curl -o /opt/hue-emulator/config.json https://raw.githubusercontent.com/mariusmotea/diyHue/master/BridgeEmulator/config.json 28 | cp /opt/hue-emulator/config.json /opt/hue-emulator/export/config.json 29 | echo -e "\033[33m--Config downloaded--\033[0m" 30 | fi 31 | 32 | cd /opt/hue-emulator 33 | 34 | echo -e "\033[32m--Startup complete. Open Hue app and search for bridges--\033[0m" 35 | if [ -z $1 -a -z $2 ]; then 36 | echo "Starting without provided MAC & IP" 37 | exec python3 /opt/hue-emulator/HueEmulator3.py 38 | else 39 | echo "Starting with provided MAC & IP" 40 | exec python3 /opt/hue-emulator/HueEmulator3.py $1 $2 41 | fi 42 | -------------------------------------------------------------------------------- /.build/arm.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian:stretch 2 | WORKDIR /tmp 3 | 4 | #Install requirments 5 | RUN apt update && apt install -y python3 python3-setuptools openssl unzip curl nmap psmisc iproute2 && rm -rf /var/lib/apt/lists/* 6 | 7 | ## install astral 8 | RUN cd /tmp && pwd && curl https://codeload.github.com/sffjunkie/astral/zip/1.6.1 -o astral.zip && unzip -q -o astral.zip && cd astral-1.6.1/ && python3 setup.py install && rm -rf /tmp/* 9 | 10 | ## install python3-ws4py 11 | RUN cd /tmp && curl https://codeload.github.com/Lawouach/WebSocket-for-Python/zip/0.5.1 -o ws4py.zip && unzip -q -o ws4py.zip && cd WebSocket-for-Python-0.5.1/ && python3 setup.py install && rm -rf /tmp/* 12 | 13 | ## install python3-requests 14 | RUN cd /tmp && curl https://codeload.github.com/requests/requests/zip/v2.19.1 -o requests.zip && unzip -q -o requests.zip && cd requests-2.19.1/ && python3 setup.py install && rm -rf /tmp/* 15 | 16 | ## Install diyHue 17 | COPY ./BridgeEmulator/web-ui/ /opt/hue-emulator/web-ui/ 18 | COPY ./BridgeEmulator/functions/ /opt/hue-emulator/functions/ 19 | COPY ./BridgeEmulator/protocols/ /opt/hue-emulator/protocols/ 20 | COPY ./BridgeEmulator/HueEmulator3.py ./BridgeEmulator/config.json /opt/hue-emulator/ 21 | 22 | #armhf specific 23 | COPY ./BridgeEmulator/entertainment-arm /opt/hue-emulator/entertainment-srv 24 | COPY ./BridgeEmulator/coap-client-arm /opt/hue-emulator/coap-client-linux 25 | 26 | # Add Docker Build scripts 27 | COPY ./.build/startup.sh ./.build/genCert.sh ./.build/openssl.conf /opt/hue-emulator/ 28 | RUN chmod +x /opt/hue-emulator/startup.sh && chmod +x /opt/hue-emulator/genCert.sh && sed -i "s|docker = False|docker = True |g" /opt/hue-emulator/HueEmulator3.py 29 | 30 | ## cleanup 31 | RUN ls -la /opt/hue-emulator 32 | ENTRYPOINT /opt/hue-emulator/startup.sh $MAC $IP 33 | -------------------------------------------------------------------------------- /Lights/PlatformIO/SK6812HueStrip/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /Lights/PlatformIO/WS2812BHueStrip/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_CCT_Light/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGBW_Light/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_CCT_Light/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /Lights/PlatformIO/Generic_RGB_Light/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /.build/amd64.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:stretch-slim 2 | WORKDIR /tmp 3 | 4 | #Install requirments 5 | RUN apt update && apt install -y python3 python3-setuptools openssl unzip curl nmap psmisc iproute2 && rm -rf /var/lib/apt/lists/* 6 | 7 | ## install astral 8 | RUN cd /tmp && pwd && curl https://codeload.github.com/sffjunkie/astral/zip/1.6.1 -o astral.zip && unzip -q -o astral.zip && cd astral-1.6.1/ && python3 setup.py install && rm -rf /tmp/* 9 | 10 | ## install python3-ws4py 11 | RUN cd /tmp && curl https://codeload.github.com/Lawouach/WebSocket-for-Python/zip/0.5.1 -o ws4py.zip && unzip -q -o ws4py.zip && cd WebSocket-for-Python-0.5.1/ && python3 setup.py install && rm -rf /tmp/* 12 | 13 | ## install python3-requests 14 | RUN cd /tmp && curl https://codeload.github.com/requests/requests/zip/v2.19.1 -o requests.zip && unzip -q -o requests.zip && cd requests-2.19.1/ && python3 setup.py install && rm -rf /tmp/* 15 | 16 | ## Install diyHue 17 | COPY ./BridgeEmulator/web-ui/ /opt/hue-emulator/web-ui/ 18 | COPY ./BridgeEmulator/functions/ /opt/hue-emulator/functions/ 19 | COPY ./BridgeEmulator/protocols/ /opt/hue-emulator/protocols/ 20 | COPY ./BridgeEmulator/HueEmulator3.py ./BridgeEmulator/config.json /opt/hue-emulator/ 21 | 22 | #x86_64 specific 23 | COPY ./BridgeEmulator/entertainment-x86_64 /opt/hue-emulator/entertainment-srv 24 | COPY ./BridgeEmulator/coap-client-x86_64 /opt/hue-emulator/coap-client-linux 25 | 26 | # Add Docker Build scripts 27 | COPY ./.build/startup.sh ./.build/genCert.sh ./.build/openssl.conf /opt/hue-emulator/ 28 | RUN chmod +x /opt/hue-emulator/startup.sh && chmod +x /opt/hue-emulator/genCert.sh && sed -i "s|docker = False|docker = True |g" /opt/hue-emulator/HueEmulator3.py 29 | 30 | # Expose ports 31 | EXPOSE 80 32 | EXPOSE 443 33 | EXPOSE 1900/udp 34 | EXPOSE 2100/udp 35 | 36 | ## cleanup 37 | RUN ls -la /opt/hue-emulator 38 | ENTRYPOINT /opt/hue-emulator/startup.sh $MAC $IP 39 | -------------------------------------------------------------------------------- /Lights/Arduino/Generic_Dimmable_Light/README.md: -------------------------------------------------------------------------------- 1 | # Custom light instruction 2 | 3 | This build is for: https://github.com/mariusmotea/diyHue/tree/master/Lights/Arduino/Generic_Dimmable_Light 4 | 5 | 1. try out your parts and plan pathways 6 | 7 | 2. solder gnd/- pathway and the 1k OHM resistors in place 8 | 9 | 3. fasten wemos headers, and connect G pin to ground pathway 10 | 11 | 4. Bring a wires from GPIO pins to the paths with resistors 12 | 13 | 5. Fasten the blue cables (these go to the - of your strip(s)) (the board in the picture will have 2 individual controlable lights, you can have multiple strips on each) 14 | 15 | 7. Fasten 3 pin headers for mosfets 16 | 17 | 8. Connect the various paths to 3 pin headers 18 | 19 | 9. Done 20 | 21 | 22 | This build is very simular to the Generic RGBW light build. (didnt take picture with the mosfets and wemos inserted, but i guess this can be imagined) make sure the G pin on the wemos hits the grounded path. 23 | 24 | ![Top](https://github.com/mariusmotea/diyHue/blob/master/Lights/Arduino/Generic_Dimmable_Light/images/Over.jpg?raw=true) 25 | ![Back](https://github.com/mariusmotea/diyHue/blob/master/Lights/Arduino/Generic_Dimmable_Light/images/Under.jpg?raw=true) 26 | 27 | ## Components 28 | [IRLB8721-TO220 MOSFETS (2x)](https://www.aliexpress.com/item/10PCS-IRLB8721-TO220-IRLB8721PBF-TO-220-free-shipping/32714364118.html) 29 | 30 | [Wemos D1 mini (1x)](https://www.aliexpress.com/item/ESP8266-ESP12-ESP-12-WeMos-D1-Mini-WIFI-Dev-Kit-Development-Board-NodeMCU-Lua/32653918483.html) 31 | 32 | [1k OHM resistor (2x)](https://www.aliexpress.com/item/100pcs-1-4W-Metal-Film-Resistor-1K-ohm-1KR-1-Tolerance-Precision-RoHS-Lead-Free-In/1851964338.html) 33 | 34 | [Female Headers (2x)](https://www.aliexpress.com/item/10-10-pcs-Single-Row-Pin-Female-Header-Socket-2-54mm-Pitch-1-10p-12p-20p/32783590196.html) 35 | 36 | [Prototyping board (1x)](https://www.aliexpress.com/item/20pcs-5x7-4x6-3x7-2x8-cm-double-Side-Copper-prototype-pcb-Universal-Board-for-Arduino/1847727667.html) 37 | -------------------------------------------------------------------------------- /Lights/Arduino/fastLED_SM16726_RGBW_Bulb/README.md: -------------------------------------------------------------------------------- 1 | # FastLED RGBW Bulb 2 | 3 | This sketch utilises the [FastLED](https://github.com/FastLED/FastLED) library in order to be able to use bulbs that don't use simple RGB PWM dimming, rather use an SPI controlled interface instead. It has only been tested on one type of such [bulb](https://www.ebay.co.uk/itm/E27-8W-RGBW-Wireless-Smart-Bulb-WiFi-APP-Remote-Control-LED-Light-for-Alexa-UK-/263504802242?item=263504802242&ViewItem=&nma=true&si=x%252BdO9TdL81nrD8N1V9CZxFXF0rY%253D&orig_cvip=true&rt=nc&_trksid=p2047675.l2557), but it should work with many similar bulbs which have CW LEDs and RGB LEDs. 4 | 5 | Slight alterations have been made in comparison to other RGBW light sketches in this project these being: 6 | * FastLED implementation for RGB LEDs 7 | * PWM implementation for CW LEDs 8 | * Ability to use [FastLED Color Correction](https://github.com/FastLED/FastLED/wiki/FastLED-Color-Correction) 9 | * Experimental use of CW leds in XY conversion by getting a basic Luminance value and using that. 10 | * Use of CCT bulb algorithm for ct conversion, where cold white mainly consists of the CW LEDs and the warmer whites mainly consist of RGB leds. 11 | * Slightly different implementation of the hue conversion to also include the cold white LEDs 12 | 13 | ## Use 14 | 15 | Depending on your bulb or strip, set these variables to their appropriate values for FastLED setup: 16 | 17 | * DATA_PIN - Which pin is data for SPI being sent out 18 | * CLOCK_PIN - Pin for SPI clock 19 | * COLOR_ORDER - Order of which colors are interpreted, usually RGB 20 | * LED_TYPE - What type of LEDs are you using, list [here](https://github.com/FastLED/FastLED/wiki/Chipset-reference) 21 | * CORRECTION - Color correction setting for LEDs, list of options [here](http://fastled.io/docs/3.1/group___color_enums.html) 22 | 23 | ## Problems 24 | 25 | * There is flickering from the white LEDs when changing values in the XY color picker in the hue app. To stop this behaviour set `W_ON_XY` to false. 26 | * There is also a bit of an issue around the blue color area when using the white color leds on the color picker. 27 | * Don't think the infoLight is working. 28 | 29 | ## To Do 30 | 31 | * Think about implementing FastLEDs native dimming functions. 32 | Try to solve above problems. 33 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | diyHue 31 | 32 | 33 | 34 | 37 |
38 | 39 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Lights/Arduino/Generic_RGBW_Light/README.md: -------------------------------------------------------------------------------- 1 | # Custom light instruction 2 | 3 | ![Circuit Diagram](https://github.com/mariusmotea/diyHue/blob/master/Lights/Arduino/Generic_RGBW_Light/images/schematic.JPG) 4 | 5 | Start with placing components on your board to make sure you got room for the paths/wires without soldering yourself into trouble :) 6 | 7 | 1. Solder Wemos headers 8 | 9 | 2. Solder the resistors in correct place. Make sure to leave room for the GPIO wire that will come later 10 | 11 | 3. Solder the path for gnd/negative across the board 12 | 13 | 4. Solder path for resistor <-> ground 14 | 15 | 5. Solder/wire the G pin on Wemos to the ground strip running across the board for common ground 16 | 17 | 6. Solder wires from GPIO pins to correct places: D1 = white, D7 = green, D6 = red, D5 = blue 18 | The wires go between the resistor and the 3 pin header for the mosfets and everything connects to the left leg of the mosfet 19 | 20 | 7. Solder the 3 pin female headers 21 | 22 | 8. Solder wires with correct colors to the middle pin of the header 23 | 24 | 9. Insert Wemos and mosfets 25 | 26 | You can use any 12v RGBW or RGBWW strip that has 5 connectors for this build. I recomend the RGBWW strips from what i have experienced so far, the RGBW ones dont make proper yellow/warm light. 27 | 28 | 29 | ![Top](https://github.com/mariusmotea/diyHue/blob/master/Lights/Arduino/Generic_RGBW_Light/images/Over.jpg) 30 | ![Back](https://github.com/mariusmotea/diyHue/blob/master/Lights/Arduino/Generic_RGBW_Light/images/Under.jpg) 31 | 32 | ## Components 33 | 34 | [IRLB8721-TO220 MOSFETS (4x)](https://www.aliexpress.com/item/10PCS-IRLB8721-TO220-IRLB8721PBF-TO-220-free-shipping/32714364118.html) 35 | 36 | [Wemos D1 mini (1x)](https://www.aliexpress.com/item/ESP8266-ESP12-ESP-12-WeMos-D1-Mini-WIFI-Dev-Kit-Development-Board-NodeMCU-Lua/32653918483.html) 37 | 38 | [1k OHM resistor (4x)](https://www.aliexpress.com/item/100pcs-1-4W-Metal-Film-Resistor-1K-ohm-1KR-1-Tolerance-Precision-RoHS-Lead-Free-In/1851964338.html) 39 | 40 | [Female Headers (4x)](https://www.aliexpress.com/item/10-10-pcs-Single-Row-Pin-Female-Header-Socket-2-54mm-Pitch-1-10p-12p-20p/32783590196.html) 41 | 42 | [Prototyping board (1x)](https://www.aliexpress.com/item/20pcs-5x7-4x6-3x7-2x8-cm-double-Side-Copper-prototype-pcb-Universal-Board-for-Arduino/1847727667.html) 43 | 44 | 45 | # Feican RGBW bulb 46 | 47 | https://raw.githubusercontent.com/mariusmotea/diyHue/master/Images/Color_Dream_bulb_with_flash_replaced.jpg 48 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GBO: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | G04 Layer_Color=32896* 7 | %ADD10R,0.05512X0.04331*% 8 | %ADD11R,0.04331X0.10630*% 9 | %ADD12R,0.42126X0.36221*% 10 | %ADD13R,0.04331X0.05512*% 11 | %ADD14C,0.01200*% 12 | %ADD15C,0.07500*% 13 | %ADD16C,0.10000*% 14 | %ADD17C,0.05000*% 15 | %ADD18C,0.02000*% 16 | %ADD19C,0.02500*% 17 | %ADD20C,0.06000*% 18 | %ADD21R,0.06000X0.06000*% 19 | %ADD22R,0.05906X0.05906*% 20 | %ADD23C,0.05906*% 21 | %ADD24C,0.04724*% 22 | %ADD25C,0.05315*% 23 | %ADD26R,0.05315X0.05315*% 24 | %ADD27R,0.06299X0.06299*% 25 | %ADD28C,0.06299*% 26 | %ADD29R,0.05315X0.05315*% 27 | %ADD30C,0.05000*% 28 | %ADD31C,0.02500*% 29 | %ADD32C,0.00984*% 30 | %ADD33C,0.00787*% 31 | %ADD34C,0.00050*% 32 | %ADD35C,0.01000*% 33 | %ADD36C,0.00591*% 34 | %ADD37R,0.06312X0.05131*% 35 | %ADD38R,0.05131X0.11430*% 36 | %ADD39R,0.42926X0.37021*% 37 | %ADD40R,0.05131X0.06312*% 38 | %ADD41C,0.06800*% 39 | %ADD42R,0.06800X0.06800*% 40 | %ADD43R,0.06706X0.06706*% 41 | %ADD44C,0.06706*% 42 | %ADD45C,0.05524*% 43 | %ADD46C,0.06115*% 44 | %ADD47R,0.06115X0.06115*% 45 | %ADD48R,0.07099X0.07099*% 46 | %ADD49C,0.07099*% 47 | %ADD50R,0.06115X0.06115*% 48 | %ADD51C,0.05800*% 49 | %ADD52C,0.03300*% 50 | D32* 51 | X37492Y98500D02* 52 | G03* 53 | X37492Y98500I-492J0D01* 54 | G01* 55 | D33* 56 | X42669Y109567D02* 57 | Y114488D01* 58 | X1331Y109567D02* 59 | X42669D01* 60 | X1331D02* 61 | Y114488D01* 62 | D35* 63 | X101500Y74000D02* 64 | Y79998D01* 65 | X98501D01* 66 | X97501Y78998D01* 67 | Y76999D01* 68 | X98501Y75999D01* 69 | X101500D01* 70 | X99501D02* 71 | X97501Y74000D01* 72 | X92503D02* 73 | Y79998D01* 74 | X95502Y76999D01* 75 | X91503D01* 76 | X36500Y83000D02* 77 | X42498D01* 78 | Y85999D01* 79 | X41498Y86999D01* 80 | X39499D01* 81 | X38499Y85999D01* 82 | Y83000D01* 83 | Y84999D02* 84 | X36500Y86999D01* 85 | X42498Y92997D02* 86 | X41498Y90997D01* 87 | X39499Y88998D01* 88 | X37500D01* 89 | X36500Y89998D01* 90 | Y91997D01* 91 | X37500Y92997D01* 92 | X38499D01* 93 | X39499Y91997D01* 94 | Y88998D01* 95 | X38651Y158150D02* 96 | Y162148D01* 97 | X39651Y163148D01* 98 | X41650D01* 99 | X42650Y162148D01* 100 | Y158150D01* 101 | X41650Y157150D01* 102 | X39651D01* 103 | X40651Y159149D02* 104 | X38651Y157150D01* 105 | X39651D02* 106 | X38651Y158150D01* 107 | X36652Y156150D02* 108 | X32653D01* 109 | X26655Y162148D02* 110 | X27655Y163148D01* 111 | X29654D01* 112 | X30654Y162148D01* 113 | Y158150D01* 114 | X29654Y157150D01* 115 | X27655D01* 116 | X26655Y158150D01* 117 | Y160149D01* 118 | X28655D01* 119 | M02* 120 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GBS: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | G04 Layer_Color=16711935* 7 | %ADD10R,0.05512X0.04331*% 8 | %ADD11R,0.04331X0.10630*% 9 | %ADD12R,0.42126X0.36221*% 10 | %ADD13R,0.04331X0.05512*% 11 | %ADD14C,0.01200*% 12 | %ADD15C,0.07500*% 13 | %ADD16C,0.10000*% 14 | %ADD17C,0.05000*% 15 | %ADD18C,0.02000*% 16 | %ADD19C,0.02500*% 17 | %ADD20C,0.06000*% 18 | %ADD21R,0.06000X0.06000*% 19 | %ADD22R,0.05906X0.05906*% 20 | %ADD23C,0.05906*% 21 | %ADD24C,0.04724*% 22 | %ADD25C,0.05315*% 23 | %ADD26R,0.05315X0.05315*% 24 | %ADD27R,0.06299X0.06299*% 25 | %ADD28C,0.06299*% 26 | %ADD29R,0.05315X0.05315*% 27 | %ADD30C,0.05000*% 28 | %ADD31C,0.02500*% 29 | %ADD32C,0.00984*% 30 | %ADD33C,0.00787*% 31 | %ADD34C,0.00050*% 32 | %ADD35C,0.01000*% 33 | %ADD36C,0.00591*% 34 | %ADD37R,0.06312X0.05131*% 35 | %ADD38R,0.05131X0.11430*% 36 | %ADD39R,0.42926X0.37021*% 37 | %ADD40R,0.05131X0.06312*% 38 | %ADD41C,0.06800*% 39 | %ADD42R,0.06800X0.06800*% 40 | %ADD43R,0.06706X0.06706*% 41 | %ADD44C,0.06706*% 42 | %ADD45C,0.05524*% 43 | %ADD46C,0.06115*% 44 | %ADD47R,0.06115X0.06115*% 45 | %ADD48R,0.07099X0.07099*% 46 | %ADD49C,0.07099*% 47 | %ADD50R,0.06115X0.06115*% 48 | %ADD51C,0.05800*% 49 | %ADD52C,0.03300*% 50 | D37* 51 | X39500Y103953D02* 52 | D03* 53 | Y98047D02* 54 | D03* 55 | D38* 56 | X32000Y101031D02* 57 | D03* 58 | X12000D02* 59 | D03* 60 | D39* 61 | X22000Y134173D02* 62 | D03* 63 | D40* 64 | X94047Y68500D02* 65 | D03* 66 | X99953D02* 67 | D03* 68 | D41* 69 | X62200Y58000D02* 70 | D03* 71 | Y48100D02* 72 | D03* 73 | X72200Y58000D02* 74 | D03* 75 | X71900Y48100D02* 76 | D03* 77 | X82100Y58000D02* 78 | D03* 79 | Y48000D02* 80 | D03* 81 | X92200D02* 82 | D03* 83 | D42* 84 | X92100Y58100D02* 85 | D03* 86 | D43* 87 | X19000Y6500D02* 88 | D03* 89 | X61000Y147000D02* 90 | D03* 91 | D44* 92 | X29000Y6500D02* 93 | D03* 94 | X101000Y147000D02* 95 | D03* 96 | X91000D02* 97 | D03* 98 | X81000D02* 99 | D03* 100 | X71000D02* 101 | D03* 102 | D45* 103 | X19000Y37500D02* 104 | D03* 105 | Y67500D02* 106 | D03* 107 | D46* 108 | X45000Y26842D02* 109 | D03* 110 | X59658Y32500D02* 111 | D03* 112 | D47* 113 | X45000Y7158D02* 114 | D03* 115 | D48* 116 | X68500Y8000D02* 117 | D03* 118 | D49* 119 | X78500D02* 120 | D03* 121 | X88500D02* 122 | D03* 123 | D50* 124 | X79343Y32500D02* 125 | D03* 126 | D51* 127 | X104500Y68500D02* 128 | D03* 129 | X38500Y85000D02* 130 | D03* 131 | X121000Y48000D02* 132 | D03* 133 | X127000Y42000D02* 134 | D03* 135 | X55000Y53000D02* 136 | D03* 137 | D52* 138 | X106500Y97547D02* 139 | D03* 140 | X68000Y76000D02* 141 | D03* 142 | M02* 143 | -------------------------------------------------------------------------------- /BridgeEmulator/functions/colors.py: -------------------------------------------------------------------------------- 1 | def convert_rgb_xy(red,green,blue): 2 | red = pow((red + 0.055) / (1.0 + 0.055), 2.4) if red > 0.04045 else red / 12.92 3 | green = pow((green + 0.055) / (1.0 + 0.055), 2.4) if green > 0.04045 else green / 12.92 4 | blue = pow((blue + 0.055) / (1.0 + 0.055), 2.4) if blue > 0.04045 else blue / 12.92 5 | 6 | #Convert the RGB values to XYZ using the Wide RGB D65 conversion formula The formulas used: 7 | X = red * 0.664511 + green * 0.154324 + blue * 0.162028 8 | Y = red * 0.283881 + green * 0.668433 + blue * 0.047685 9 | Z = red * 0.000088 + green * 0.072310 + blue * 0.986039 10 | 11 | #Calculate the xy values from the XYZ values 12 | x = X / (X + Y + Z) 13 | y = Y / (X + Y + Z) 14 | return [x, y] 15 | 16 | def convert_xy(x, y, bri): #needed for milight hub that don't work with xy values 17 | X = x 18 | Y = y 19 | Z = 1.0 - x - y 20 | 21 | # sRGB D65 conversion 22 | r = X * 3.2406 - Y * 1.5372 - Z * 0.4986 23 | g = -X * 0.9689 + Y * 1.8758 + Z * 0.0415 24 | b = X * 0.0557 - Y * 0.2040 + Z * 1.0570 25 | 26 | 27 | r = 12.92 * r if r <= 0.0031308 else (1.0 + 0.055) * pow(r, (1.0 / 2.4)) - 0.055 28 | g = 12.92 * g if g <= 0.0031308 else (1.0 + 0.055) * pow(g, (1.0 / 2.4)) - 0.055 29 | b = 12.92 * b if b <= 0.0031308 else (1.0 + 0.055) * pow(b, (1.0 / 2.4)) - 0.055 30 | 31 | if r > b and r > g: 32 | # red is biggest 33 | if r > 1: 34 | g = g / r 35 | b = b / r 36 | r = 1 37 | elif g > b and g > r: 38 | # green is biggest 39 | if g > 1: 40 | r = r / g 41 | b = b / g 42 | g = 1 43 | 44 | elif b > r and b > g: 45 | # blue is biggest 46 | if b > 1: 47 | r = r / b 48 | g = g / b 49 | b = 1 50 | 51 | r = 0 if r < 0 else r 52 | g = 0 if g < 0 else g 53 | b = 0 if b < 0 else b 54 | return [int(r * bri), int(g * bri), int(b * bri)] 55 | 56 | def hsv_to_rgb(h, s, v): 57 | s = float(s / 254) 58 | v = float(v / 254) 59 | c=v*s 60 | x=c*(1-abs(((h/11850)%2)-1)) 61 | m=v-c 62 | if h>=0 and h<10992: 63 | r=c 64 | g=x 65 | b=0 66 | elif h>=10992 and h<21845: 67 | r=x 68 | g=c 69 | b=0 70 | elif h>=21845 and h<32837: 71 | r = 0 72 | g = c 73 | b = x 74 | elif h>=32837 and h<43830: 75 | r = 0 76 | g = x 77 | b = c 78 | elif h>=43830 and h<54813: 79 | r = x 80 | g = 0 81 | b = c 82 | else: 83 | r = c 84 | g = 0 85 | b = x 86 | 87 | r, g, b = int(r * 255), int(g * 255), int(b * 255) 88 | return r, g, b 89 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { render } from "react-dom"; 3 | import { injectGlobal } from "react-emotion"; 4 | import { compose, withState, lifecycle, withProps } from "recompose"; 5 | import _throttle from "lodash/fp/throttle"; 6 | import App from "./App"; 7 | import { rgbToCie } from "./color"; 8 | 9 | injectGlobal` 10 | html, body { 11 | margin: 0; 12 | } 13 | `; 14 | 15 | export function httpPutRequest(url, data) { 16 | return fetch(url, { 17 | method: "PUT", 18 | mode: "cors", 19 | body: JSON.stringify(data), 20 | headers: { 21 | "Content-Type": "application/json" 22 | } 23 | }) 24 | .then(res => { 25 | return res; 26 | }) 27 | .catch(err => console.error(err.message)); 28 | } 29 | 30 | const API_KEY = window.config.API_KEY; 31 | const THROTTLE_WAIT = 1000; // 1 second 32 | 33 | const throttle = _throttle(THROTTLE_WAIT); 34 | 35 | const enhance = compose( 36 | withState("groups", "setGroups", {}), 37 | withState("lights", "setLights", {}), 38 | // TODO: change these methods to hook the Hue Emulator API calls 39 | // entity may be a light or a room, they have an extra `id` property 40 | // the second argument is the new value selected by the user 41 | withProps({ 42 | onColorTemperatureChange: throttle((entity, temp) => 43 | httpPutRequest(`/api/${API_KEY}/lights/${entity.id}/state`, { ct: temp }) 44 | ), 45 | onColorChange: throttle((entity, color) => 46 | httpPutRequest(`/api/${API_KEY}/lights/${entity.id}/state`, { 47 | xy: rgbToCie(color["rgb"]["r"], color["rgb"]["g"], color["rgb"]["b"]) 48 | }) 49 | ), 50 | onBrightnessChange: throttle((entity, bri) => 51 | httpPutRequest(`/api/${API_KEY}/lights/${entity.id}/state`, { bri: bri }) 52 | ), 53 | onStateChange: (entity, state) => 54 | httpPutRequest( 55 | `/api/${API_KEY}/${ 56 | entity.type === "Room" 57 | ? "groups/" + entity.id + "/action" 58 | : "lights/" + entity.id + "/state" 59 | }`, 60 | { on: state } 61 | ), 62 | // this should trigger a state change on ALL the available lights 63 | onGlobalStateChange: state => 64 | httpPutRequest(`/api/${API_KEY}/groups/0/action`, { on: state }) 65 | }), 66 | lifecycle({ 67 | async componentDidMount() { 68 | setInterval(async () => { 69 | const res = await Promise.all([ 70 | fetch(`/api/${API_KEY}/groups`), 71 | fetch(`/api/${API_KEY}/lights`) 72 | ]); 73 | const json = await Promise.all([res[0].json(), res[1].json()]); 74 | 75 | this.props.setGroups(json[0]); 76 | this.props.setLights(json[1]); 77 | }, 1000); 78 | } 79 | }) 80 | ); 81 | 82 | const AppWithData = enhance(App); 83 | 84 | render(, document.getElementById("root")); 85 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/service-worker.js: -------------------------------------------------------------------------------- 1 | "use strict";var precacheConfig=[["/index.html","4ab518f68b71173728f9e994d24ceca0"],["/static/css/main.23de7225.css","fbca4e005802a54ae8f934190f1542cb"],["/static/js/main.7409e575.js","e125f4f38bf9f001529d452fdf677660"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,r){var a=new URL(e);return r&&a.pathname.match(r)||(a.search+=(a.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],r=new URL(t,self.location),a=createCacheKey(r,hashParamName,n,/\.\w{8}\./);return[r.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(r){return setOfCachedUrls(r).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return r.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),r="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,r),e=urlsToCacheKeys.has(n));var a="/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(a,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}}); -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/service-worker.js: -------------------------------------------------------------------------------- 1 | "use strict";var precacheConfig=[["/index.html","19322ff1ab94d4523074e3c0dd762404"],["/static/css/main.23de7225.css","fbca4e005802a54ae8f934190f1542cb"],["/static/js/main.8451d178.js","a22aac0a00657f990481c559876d3784"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,r){var a=new URL(e);return r&&a.pathname.match(r)||(a.search+=(a.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],r=new URL(t,self.location),a=createCacheKey(r,hashParamName,n,/\.\w{8}\./);return[r.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(r){return setOfCachedUrls(r).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return r.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),r="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,r),e=urlsToCacheKeys.has(n));var a="/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(a,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}}); -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GTS: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | G04 Layer_Color=8388736* 7 | %ADD10R,0.05512X0.04331*% 8 | %ADD11R,0.04331X0.10630*% 9 | %ADD12R,0.42126X0.36221*% 10 | %ADD13R,0.04331X0.05512*% 11 | %ADD14C,0.01200*% 12 | %ADD15C,0.07500*% 13 | %ADD16C,0.10000*% 14 | %ADD17C,0.05000*% 15 | %ADD18C,0.02000*% 16 | %ADD19C,0.02500*% 17 | %ADD20C,0.06000*% 18 | %ADD21R,0.06000X0.06000*% 19 | %ADD22R,0.05906X0.05906*% 20 | %ADD23C,0.05906*% 21 | %ADD24C,0.04724*% 22 | %ADD25C,0.05315*% 23 | %ADD26R,0.05315X0.05315*% 24 | %ADD27R,0.06299X0.06299*% 25 | %ADD28C,0.06299*% 26 | %ADD29R,0.05315X0.05315*% 27 | %ADD30C,0.05000*% 28 | %ADD31C,0.02500*% 29 | %ADD32C,0.00984*% 30 | %ADD33C,0.00787*% 31 | %ADD34C,0.00050*% 32 | %ADD35C,0.01000*% 33 | %ADD36C,0.00591*% 34 | %ADD37R,0.06312X0.05131*% 35 | %ADD38R,0.05131X0.11430*% 36 | %ADD39R,0.42926X0.37021*% 37 | %ADD40R,0.05131X0.06312*% 38 | %ADD41C,0.06800*% 39 | %ADD42R,0.06800X0.06800*% 40 | %ADD43R,0.06706X0.06706*% 41 | %ADD44C,0.06706*% 42 | %ADD45C,0.05524*% 43 | %ADD46C,0.06115*% 44 | %ADD47R,0.06115X0.06115*% 45 | %ADD48R,0.07099X0.07099*% 46 | %ADD49C,0.07099*% 47 | %ADD50R,0.06115X0.06115*% 48 | %ADD51C,0.05800*% 49 | %ADD52C,0.03300*% 50 | D37* 51 | X148500Y77453D02* 52 | D03* 53 | Y71547D02* 54 | D03* 55 | X5000Y103953D02* 56 | D03* 57 | Y98047D02* 58 | D03* 59 | X114000Y103453D02* 60 | D03* 61 | Y97547D02* 62 | D03* 63 | D38* 64 | X141500Y74468D02* 65 | D03* 66 | X121500D02* 67 | D03* 68 | X121000Y101031D02* 69 | D03* 70 | X141000D02* 71 | D03* 72 | X12000D02* 73 | D03* 74 | X32000D02* 75 | D03* 76 | D39* 77 | X131500Y41327D02* 78 | D03* 79 | X131000Y134173D02* 80 | D03* 81 | X22000D02* 82 | D03* 83 | D40* 84 | X67547Y68500D02* 85 | D03* 86 | X73453D02* 87 | D03* 88 | X85953Y68500D02* 89 | D03* 90 | X80047D02* 91 | D03* 92 | X99953D02* 93 | D03* 94 | X94047D02* 95 | D03* 96 | D41* 97 | X62200Y58000D02* 98 | D03* 99 | Y48100D02* 100 | D03* 101 | X72200Y58000D02* 102 | D03* 103 | X71900Y48100D02* 104 | D03* 105 | X82100Y58000D02* 106 | D03* 107 | Y48000D02* 108 | D03* 109 | X92200D02* 110 | D03* 111 | D42* 112 | X92100Y58100D02* 113 | D03* 114 | D43* 115 | X19000Y6500D02* 116 | D03* 117 | X61000Y147000D02* 118 | D03* 119 | D44* 120 | X29000Y6500D02* 121 | D03* 122 | X101000Y147000D02* 123 | D03* 124 | X91000D02* 125 | D03* 126 | X81000D02* 127 | D03* 128 | X71000D02* 129 | D03* 130 | D45* 131 | X19000Y37500D02* 132 | D03* 133 | Y67500D02* 134 | D03* 135 | D46* 136 | X45000Y26842D02* 137 | D03* 138 | X59658Y32500D02* 139 | D03* 140 | D47* 141 | X45000Y7158D02* 142 | D03* 143 | D48* 144 | X68500Y8000D02* 145 | D03* 146 | D49* 147 | X78500D02* 148 | D03* 149 | X88500D02* 150 | D03* 151 | D50* 152 | X79343Y32500D02* 153 | D03* 154 | D51* 155 | X104500Y68500D02* 156 | D03* 157 | X38500Y85000D02* 158 | D03* 159 | X121000Y48000D02* 160 | D03* 161 | X127000Y42000D02* 162 | D03* 163 | X55000Y53000D02* 164 | D03* 165 | D52* 166 | X106500Y97547D02* 167 | D03* 168 | X68000Y76000D02* 169 | D03* 170 | M02* 171 | -------------------------------------------------------------------------------- /BridgeEmulator/debug/clip.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | API Debug tool 5 | 41 | 42 | 43 | 44 |
45 |

CLIP API Debugger

46 |

URL:

47 | 48 |
49 | 50 | 51 | 52 | 53 |
54 |

Message Body:

55 | 56 |

Command Response:

57 | 58 |
59 | 60 | 61 | 62 | 90 | -------------------------------------------------------------------------------- /BridgeEmulator/functions/ssdp.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import random 3 | import socket 4 | import struct 5 | from time import sleep 6 | 7 | 8 | def ssdpSearch(ip, mac): 9 | SSDP_ADDR = '239.255.255.250' 10 | SSDP_PORT = 1900 11 | multicast_group_c = SSDP_ADDR 12 | multicast_group_s = (SSDP_ADDR, SSDP_PORT) 13 | server_address = ('', SSDP_PORT) 14 | Response_message = 'HTTP/1.1 200 OK\r\nHOST: 239.255.255.250:1900\r\nEXT:\r\nCACHE-CONTROL: max-age=100\r\nLOCATION: http://' + ip + ':80/description.xml\r\nSERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.20.0\r\nhue-bridgeid: ' + (mac[:6] + 'FFFE' + mac[6:]).upper() + '\r\n' 15 | custom_response_message = {0: {"st": "upnp:rootdevice", "usn": "uuid:2f402f80-da50-11e1-9b23-" + mac + "::upnp:rootdevice"}, 1: {"st": "uuid:2f402f80-da50-11e1-9b23-" + mac, "usn": "uuid:2f402f80-da50-11e1-9b23-" + mac}, 2: {"st": "urn:schemas-upnp-org:device:basic:1", "usn": "uuid:2f402f80-da50-11e1-9b23-" + mac}} 16 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 17 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 18 | sock.bind(server_address) 19 | 20 | group = socket.inet_aton(multicast_group_c) 21 | mreq = struct.pack('4sL', group, socket.INADDR_ANY) 22 | sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) 23 | 24 | logging.debug("starting ssdp...") 25 | 26 | while True: 27 | data, address = sock.recvfrom(1024) 28 | data = data.decode('utf-8') 29 | if data[0:19]== 'M-SEARCH * HTTP/1.1': 30 | if data.find("ssdp:discover") != -1: 31 | sleep(random.randrange(1, 10)/10) 32 | logging.debug("Sending M-Search response to " + address[0]) 33 | for x in range(3): 34 | sock.sendto(bytes(Response_message + "ST: " + custom_response_message[x]["st"] + "\r\nUSN: " + custom_response_message[x]["usn"] + "\r\n\r\n", "utf8"), address) 35 | sleep(1) 36 | 37 | def ssdpBroadcast(ip, mac): 38 | logging.debug("start ssdp broadcast") 39 | SSDP_ADDR = '239.255.255.250' 40 | SSDP_PORT = 1900 41 | MSEARCH_Interval = 2 42 | multicast_group_s = (SSDP_ADDR, SSDP_PORT) 43 | message = 'NOTIFY * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nCACHE-CONTROL: max-age=100\r\nLOCATION: http://' + ip + ':80/description.xml\r\nSERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.20.0\r\nNTS: ssdp:alive\r\nhue-bridgeid: ' + (mac[:6] + 'FFFE' + mac[6:]).upper() + '\r\n' 44 | custom_message = {0: {"nt": "upnp:rootdevice", "usn": "uuid:2f402f80-da50-11e1-9b23-" + mac + "::upnp:rootdevice"}, 1: {"nt": "uuid:2f402f80-da50-11e1-9b23-" + mac, "usn": "uuid:2f402f80-da50-11e1-9b23-" + mac}, 2: {"nt": "urn:schemas-upnp-org:device:basic:1", "usn": "uuid:2f402f80-da50-11e1-9b23-" + mac}} 45 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 46 | sock.settimeout(MSEARCH_Interval+0.5) 47 | ttl = struct.pack('b', 1) 48 | sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl) 49 | while True: 50 | for x in range(3): 51 | sock.sendto(bytes(message + "NT: " + custom_message[x]["nt"] + "\r\nUSN: " + custom_message[x]["usn"] + "\r\n\r\n", "utf8"),multicast_group_s) 52 | sock.sendto(bytes(message + "NT: " + custom_message[x]["nt"] + "\r\nUSN: " + custom_message[x]["usn"] + "\r\n\r\n", "utf8"),multicast_group_s) 53 | sleep(60) 54 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.apr: -------------------------------------------------------------------------------- 1 | D10 RECTANGULAR 55.118 43.307 0.000 FLASH 0.000 2 | D11 RECTANGULAR 43.307 106.299 0.000 FLASH 0.000 3 | D12 RECTANGULAR 421.260 362.205 0.000 FLASH 0.000 4 | D13 RECTANGULAR 55.118 43.307 0.000 FLASH 90.000 5 | D14 ROUNDED 12.000 12.000 0.000 LINE 0.000 6 | D15 ROUNDED 75.000 75.000 0.000 LINE 0.000 7 | D16 ROUNDED 100.000 100.000 0.000 LINE 0.000 8 | D17 ROUNDED 50.000 50.000 0.000 LINE 0.000 9 | D18 ROUNDED 20.000 20.000 0.000 LINE 0.000 10 | D19 ROUNDED 25.000 25.000 0.000 LINE 0.000 11 | D20 ROUNDED 60.000 60.000 0.000 FLASH 0.000 12 | D21 RECTANGULAR 60.000 60.000 0.000 FLASH 180.000 13 | D22 RECTANGULAR 59.055 59.055 0.000 FLASH 0.000 14 | D23 ROUNDED 59.055 59.055 0.000 FLASH 0.000 15 | D24 ROUNDED 47.244 47.244 0.000 FLASH 0.000 16 | D25 ROUNDED 53.150 53.150 0.000 FLASH 0.000 17 | D26 RECTANGULAR 53.150 53.150 0.000 FLASH 90.000 18 | D27 RECTANGULAR 62.992 62.992 0.000 FLASH 0.000 19 | D28 ROUNDED 62.992 62.992 0.000 FLASH 0.000 20 | D29 RECTANGULAR 53.150 53.150 0.000 FLASH 180.000 21 | D30 ROUNDED 50.000 50.000 0.000 FLASH 0.000 22 | D31 ROUNDED 25.000 25.000 0.000 FLASH 0.000 23 | D32 ROUNDED 9.842 9.842 0.000 LINE 0.000 24 | D33 ROUNDED 7.874 7.874 0.000 LINE 0.000 25 | D34 ROUNDED 0.500 0.500 0.000 LINE 0.000 26 | D35 ROUNDED 10.000 10.000 0.000 LINE 0.000 27 | D36 ROUNDED 5.905 5.905 0.000 LINE 0.000 28 | D37 RECTANGULAR 63.118 51.307 0.000 FLASH 0.000 29 | D38 RECTANGULAR 51.307 114.299 0.000 FLASH 0.000 30 | D39 RECTANGULAR 429.260 370.205 0.000 FLASH 0.000 31 | D40 RECTANGULAR 63.118 51.307 0.000 FLASH 90.000 32 | D41 ROUNDED 68.000 68.000 0.000 FLASH 0.000 33 | D42 RECTANGULAR 68.000 68.000 0.000 FLASH 180.000 34 | D43 RECTANGULAR 67.055 67.055 0.000 FLASH 0.000 35 | D44 ROUNDED 67.055 67.055 0.000 FLASH 0.000 36 | D45 ROUNDED 55.244 55.244 0.000 FLASH 0.000 37 | D46 ROUNDED 61.150 61.150 0.000 FLASH 0.000 38 | D47 RECTANGULAR 61.150 61.150 0.000 FLASH 90.000 39 | D48 RECTANGULAR 70.992 70.992 0.000 FLASH 0.000 40 | D49 ROUNDED 70.992 70.992 0.000 FLASH 0.000 41 | D50 RECTANGULAR 61.150 61.150 0.000 FLASH 180.000 42 | D51 ROUNDED 58.000 58.000 0.000 FLASH 0.000 43 | D52 ROUNDED 33.000 33.000 0.000 FLASH 0.000 44 | D53 ROUNDED 5.000 5.000 0.000 LINE 0.000 45 | D54 ROUNDED 6.667 6.667 0.000 LINE 0.000 46 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GG1: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | %ADD10R,0.05512X0.04331*% 7 | %ADD11R,0.04331X0.10630*% 8 | %ADD12R,0.42126X0.36221*% 9 | %ADD13R,0.04331X0.05512*% 10 | %ADD14C,0.01200*% 11 | %ADD15C,0.07500*% 12 | %ADD16C,0.10000*% 13 | %ADD17C,0.05000*% 14 | %ADD18C,0.02000*% 15 | %ADD19C,0.02500*% 16 | %ADD20C,0.06000*% 17 | %ADD21R,0.06000X0.06000*% 18 | %ADD22R,0.05906X0.05906*% 19 | %ADD23C,0.05906*% 20 | %ADD24C,0.04724*% 21 | %ADD25C,0.05315*% 22 | %ADD26R,0.05315X0.05315*% 23 | %ADD27R,0.06299X0.06299*% 24 | %ADD28C,0.06299*% 25 | %ADD29R,0.05315X0.05315*% 26 | %ADD30C,0.05000*% 27 | %ADD31C,0.02500*% 28 | %ADD32C,0.00984*% 29 | %ADD33C,0.00787*% 30 | %ADD34C,0.00050*% 31 | %ADD35C,0.01000*% 32 | %ADD36C,0.00591*% 33 | %ADD37R,0.06312X0.05131*% 34 | %ADD38R,0.05131X0.11430*% 35 | %ADD39R,0.42926X0.37021*% 36 | %ADD40R,0.05131X0.06312*% 37 | %ADD41C,0.06800*% 38 | %ADD42R,0.06800X0.06800*% 39 | %ADD43R,0.06706X0.06706*% 40 | %ADD44C,0.06706*% 41 | %ADD45C,0.05524*% 42 | %ADD46C,0.06115*% 43 | %ADD47R,0.06115X0.06115*% 44 | %ADD48R,0.07099X0.07099*% 45 | %ADD49C,0.07099*% 46 | %ADD50R,0.06115X0.06115*% 47 | %ADD51C,0.05800*% 48 | %ADD52C,0.03300*% 49 | %ADD53C,0.00500*% 50 | %ADD54C,0.00667*% 51 | D53* 52 | X60700Y58000D02* 53 | X63700D01* 54 | X62200Y56500D02* 55 | Y59500D01* 56 | X60700Y48100D02* 57 | X63700D01* 58 | X62200Y46600D02* 59 | Y49600D01* 60 | X70700Y58000D02* 61 | X73700D01* 62 | X72200Y56500D02* 63 | Y59500D01* 64 | X70400Y48100D02* 65 | X73400D01* 66 | X71900Y46600D02* 67 | Y49600D01* 68 | X80600Y58000D02* 69 | X83600D01* 70 | X82100Y56500D02* 71 | Y59500D01* 72 | X80600Y48000D02* 73 | X83600D01* 74 | X82100Y46500D02* 75 | Y49500D01* 76 | X90600Y58100D02* 77 | X93600D01* 78 | X92100Y56600D02* 79 | Y59600D01* 80 | X90700Y48000D02* 81 | X93700D01* 82 | X92200Y46500D02* 83 | Y49500D01* 84 | X17228Y6500D02* 85 | X20772D01* 86 | X19000Y4728D02* 87 | Y8272D01* 88 | X27228Y6500D02* 89 | X30772D01* 90 | X29000Y4728D02* 91 | Y8272D01* 92 | X17622Y37500D02* 93 | X20378D01* 94 | X19000Y36122D02* 95 | Y38878D01* 96 | X17622Y67500D02* 97 | X20378D01* 98 | X19000Y66122D02* 99 | Y68878D01* 100 | X43425Y26842D02* 101 | X46575D01* 102 | X45000Y25268D02* 103 | Y28417D01* 104 | X43425Y7158D02* 105 | X46575D01* 106 | X45000Y5583D02* 107 | Y8732D01* 108 | X66531Y8000D02* 109 | X70468D01* 110 | X68500Y6032D02* 111 | Y9968D01* 112 | X76531Y8000D02* 113 | X80468D01* 114 | X78500Y6032D02* 115 | Y9968D01* 116 | X86532Y8000D02* 117 | X90469D01* 118 | X88500Y6032D02* 119 | Y9968D01* 120 | X58083Y32500D02* 121 | X61232D01* 122 | X59658Y30925D02* 123 | Y34075D01* 124 | X77768Y32500D02* 125 | X80917D01* 126 | X79343Y30925D02* 127 | Y34075D01* 128 | X99228Y147000D02* 129 | X102772D01* 130 | X101000Y145228D02* 131 | Y148772D01* 132 | X89228Y147000D02* 133 | X92772D01* 134 | X91000Y145228D02* 135 | Y148772D01* 136 | X79228Y147000D02* 137 | X82772D01* 138 | X81000Y145228D02* 139 | Y148772D01* 140 | X69228Y147000D02* 141 | X72772D01* 142 | X71000Y145228D02* 143 | Y148772D01* 144 | X59228Y147000D02* 145 | X62772D01* 146 | X61000Y145228D02* 147 | Y148772D01* 148 | X103100Y68500D02* 149 | X105900D01* 150 | X104500Y67100D02* 151 | Y69900D01* 152 | X37100Y85000D02* 153 | X39900D01* 154 | X38500Y83600D02* 155 | Y86400D01* 156 | X105800Y97547D02* 157 | X107200D01* 158 | X106500Y96847D02* 159 | Y98247D01* 160 | X67300Y76000D02* 161 | X68700D01* 162 | X68000Y75300D02* 163 | Y76700D01* 164 | X119600Y48000D02* 165 | X122400D01* 166 | X121000Y46600D02* 167 | Y49400D01* 168 | X125600Y42000D02* 169 | X128400D01* 170 | X127000Y40600D02* 171 | Y43400D01* 172 | X53600Y53000D02* 173 | X56400D01* 174 | X55000Y51600D02* 175 | Y54400D01* 176 | M02* 177 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/src/color.js: -------------------------------------------------------------------------------- 1 | export function cieToRgb(x, y, brightness) { 2 | //Set to maximum brightness if no custom value was given (Not the slick ECMAScript 6 way for compatibility reasons) 3 | if (brightness === undefined) { 4 | brightness = 254; 5 | } 6 | 7 | var z = 1.0 - x - y; 8 | var Y = (brightness / 254).toFixed(2); 9 | var X = Y / y * x; 10 | var Z = Y / y * z; 11 | 12 | //Convert to RGB using Wide RGB D65 conversion 13 | var red = X * 1.656492 - Y * 0.354851 - Z * 0.255038; 14 | var green = -X * 0.707196 + Y * 1.655397 + Z * 0.036152; 15 | var blue = X * 0.051713 - Y * 0.121364 + Z * 1.01153; 16 | 17 | //If red, green or blue is larger than 1.0 set it back to the maximum of 1.0 18 | if (red > blue && red > green && red > 1.0) { 19 | green = green / red; 20 | blue = blue / red; 21 | red = 1.0; 22 | } else if (green > blue && green > red && green > 1.0) { 23 | red = red / green; 24 | blue = blue / green; 25 | green = 1.0; 26 | } else if (blue > red && blue > green && blue > 1.0) { 27 | red = red / blue; 28 | green = green / blue; 29 | blue = 1.0; 30 | } 31 | 32 | //Reverse gamma correction 33 | red = 34 | red <= 0.0031308 35 | ? 12.92 * red 36 | : (1.0 + 0.055) * Math.pow(red, 1.0 / 2.4) - 0.055; 37 | green = 38 | green <= 0.0031308 39 | ? 12.92 * green 40 | : (1.0 + 0.055) * Math.pow(green, 1.0 / 2.4) - 0.055; 41 | blue = 42 | blue <= 0.0031308 43 | ? 12.92 * blue 44 | : (1.0 + 0.055) * Math.pow(blue, 1.0 / 2.4) - 0.055; 45 | 46 | //Convert normalized decimal to decimal 47 | red = Math.round(red * 255); 48 | green = Math.round(green * 255); 49 | blue = Math.round(blue * 255); 50 | 51 | if (isNaN(red)) red = 0; 52 | 53 | if (isNaN(green)) green = 0; 54 | 55 | if (isNaN(blue)) blue = 0; 56 | 57 | var decColor = 0x1000000 + blue + 0x100 * green + 0x10000 * red; 58 | return "#" + decColor.toString(16).substr(1); 59 | } 60 | 61 | export function colorTemperatureToRgb(mireds) { 62 | var hectemp = 20000.0 / mireds; 63 | 64 | var red, green, blue; 65 | 66 | if (hectemp <= 66) { 67 | red = 255; 68 | green = 99.4708025861 * Math.log(hectemp) - 161.1195681661; 69 | blue = 70 | hectemp <= 19 71 | ? 0 72 | : 138.5177312231 * Math.log(hectemp - 10) - 305.0447927307; 73 | } else { 74 | red = 329.698727446 * Math.pow(hectemp - 60, -0.1332047592); 75 | green = 288.1221695283 * Math.pow(hectemp - 60, -0.0755148492); 76 | blue = 255; 77 | } 78 | 79 | red = red > 255 ? 255 : red; 80 | green = green > 255 ? 255 : green; 81 | blue = blue > 255 ? 255 : blue; 82 | 83 | var decColor = 84 | 0x1000000 + 85 | parseInt(blue, 10) + 86 | 0x100 * parseInt(green, 10) + 87 | 0x10000 * parseInt(red, 10); 88 | return "#" + decColor.toString(16).substr(1); 89 | } 90 | 91 | export function rgbToCie(red, green, blue) { 92 | //Apply a gamma correction to the RGB values, which makes the color more vivid and more the like the color displayed on the screen of your device 93 | red = 94 | red > 0.04045 ? Math.pow((red + 0.055) / (1.0 + 0.055), 2.4) : red / 12.92; 95 | green = 96 | green > 0.04045 97 | ? Math.pow((green + 0.055) / (1.0 + 0.055), 2.4) 98 | : green / 12.92; 99 | blue = 100 | blue > 0.04045 101 | ? Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4) 102 | : blue / 12.92; 103 | 104 | //RGB values to XYZ using the Wide RGB D65 conversion formula 105 | var X = red * 0.664511 + green * 0.154324 + blue * 0.162028; 106 | var Y = red * 0.283881 + green * 0.668433 + blue * 0.047685; 107 | var Z = red * 0.000088 + green * 0.07231 + blue * 0.986039; 108 | 109 | //Calculate the xy values from the XYZ values 110 | var x = (X / (X + Y + Z)).toFixed(4); 111 | var y = (Y / (X + Y + Z)).toFixed(4); 112 | 113 | if (isNaN(x)) x = 0; 114 | 115 | if (isNaN(y)) y = 0; 116 | 117 | return [parseFloat(x), parseFloat(y)]; 118 | } 119 | 120 | export default { 121 | ct: light => colorTemperatureToRgb(light.state.ct), 122 | xy: ({ state: { xy = [0, 0], bri = 0 } }) => cieToRgb(xy[0], xy[1], bri) 123 | }; 124 | -------------------------------------------------------------------------------- /Lights/Arduino/MY92XX_RGBW_Light/my92xx.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MY92XX LED Driver Arduino library 3.0.0 4 | 5 | Copyright (c) 2016 - 2026 MaiKe Labs 6 | Copyright (C) 2017 - Xose Pérez 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | 21 | */ 22 | 23 | #ifndef _my92xx_h 24 | #define _my92xx_h 25 | 26 | #include 27 | 28 | #ifdef DEBUG_MY92XX 29 | #if ARDUINO_ARCH_ESP8266 30 | #define DEBUG_MSG_MY92XX(...) DEBUG_MY92XX.printf( __VA_ARGS__ ) 31 | #elif ARDUINO_ARCH_AVR 32 | #define DEBUG_MSG_MY92XX(...) { char buffer[80]; snprintf(buffer, sizeof(buffer), __VA_ARGS__ ); DEBUG_MY92XX.print(buffer); } 33 | #endif 34 | #else 35 | #define DEBUG_MSG_MY92XX(...) 36 | #endif 37 | 38 | typedef enum my92xx_model_t { 39 | MY92XX_MODEL_MY9291 = 0X00, 40 | MY92XX_MODEL_MY9231 = 0X01, 41 | } my92xx_model_t; 42 | 43 | typedef enum my92xx_cmd_one_shot_t { 44 | MY92XX_CMD_ONE_SHOT_DISABLE = 0X00, 45 | MY92XX_CMD_ONE_SHOT_ENFORCE = 0X01, 46 | } my92xx_cmd_one_shot_t; 47 | 48 | typedef enum my92xx_cmd_reaction_t { 49 | MY92XX_CMD_REACTION_FAST = 0X00, 50 | MY92XX_CMD_REACTION_SLOW = 0X01, 51 | } my92xx_cmd_reaction_t; 52 | 53 | typedef enum my92xx_cmd_bit_width_t { 54 | MY92XX_CMD_BIT_WIDTH_16 = 0X00, 55 | MY92XX_CMD_BIT_WIDTH_14 = 0X01, 56 | MY92XX_CMD_BIT_WIDTH_12 = 0X02, 57 | MY92XX_CMD_BIT_WIDTH_8 = 0X03, 58 | } my92xx_cmd_bit_width_t; 59 | 60 | typedef enum my92xx_cmd_frequency_t { 61 | MY92XX_CMD_FREQUENCY_DIVIDE_1 = 0X00, 62 | MY92XX_CMD_FREQUENCY_DIVIDE_4 = 0X01, 63 | MY92XX_CMD_FREQUENCY_DIVIDE_16 = 0X02, 64 | MY92XX_CMD_FREQUENCY_DIVIDE_64 = 0X03, 65 | } my92xx_cmd_frequency_t; 66 | 67 | typedef enum my92xx_cmd_scatter_t { 68 | MY92XX_CMD_SCATTER_APDM = 0X00, 69 | MY92XX_CMD_SCATTER_PWM = 0X01, 70 | } my92xx_cmd_scatter_t; 71 | 72 | typedef struct { 73 | my92xx_cmd_scatter_t scatter:1; 74 | my92xx_cmd_frequency_t frequency:2; 75 | my92xx_cmd_bit_width_t bit_width:2; 76 | my92xx_cmd_reaction_t reaction:1; 77 | my92xx_cmd_one_shot_t one_shot:1; 78 | unsigned char resv:1; 79 | } __attribute__ ((aligned(1), packed)) my92xx_cmd_t; 80 | 81 | #define MY92XX_COMMAND_DEFAULT { \ 82 | .scatter = MY92XX_CMD_SCATTER_APDM, \ 83 | .frequency = MY92XX_CMD_FREQUENCY_DIVIDE_1, \ 84 | .bit_width = MY92XX_CMD_BIT_WIDTH_8, \ 85 | .reaction = MY92XX_CMD_REACTION_FAST, \ 86 | .one_shot = MY92XX_CMD_ONE_SHOT_DISABLE, \ 87 | .resv = 0 \ 88 | } 89 | 90 | class my92xx { 91 | 92 | public: 93 | 94 | my92xx(my92xx_model_t model, unsigned char chips, unsigned char di, unsigned char dcki, my92xx_cmd_t command); 95 | unsigned char getChannels(); 96 | void setChannel(unsigned char channel, unsigned int value); 97 | unsigned int getChannel(unsigned char channel); 98 | void setState(bool state); 99 | bool getState(); 100 | void update(); 101 | 102 | private: 103 | 104 | void _di_pulse(unsigned int times); 105 | void _dcki_pulse(unsigned int times); 106 | void _set_cmd(my92xx_cmd_t command); 107 | void _send(); 108 | void _write(unsigned int data, unsigned char bit_length); 109 | 110 | my92xx_cmd_t _command; 111 | my92xx_model_t _model = MY92XX_MODEL_MY9291; 112 | unsigned char _chips = 1; 113 | unsigned char _channels; 114 | uint16_t * _value; 115 | bool _state = false; 116 | unsigned char _pin_di; 117 | unsigned char _pin_dcki; 118 | 119 | 120 | }; 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /Sensors/HueMotionSensor/HueMotionSensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include "user_interface.h" 7 | } 8 | 9 | ADC_MODE(ADC_VCC); 10 | 11 | /// BEGIN SETUP SENSOR PARAMETERS /// 12 | 13 | const char* ssid = "WiFi name"; 14 | const char* password = "WiFi password"; 15 | 16 | //Set bridge ip 17 | const char* bridgeIp = "192.168.xxx.xxx"; 18 | 19 | // depending on photoresistor you need to setup this value to trigger dark state when light level in room become low enough 20 | #define lightmultiplier 30 21 | // depending on device, increase or decrease the value if the device don't enter in powersave mode when battery voltage is ~3.2v 22 | #define shutdown_voltage 2.9 23 | 24 | // set the sensor ip address on the network (mandatory) 25 | IPAddress strip_ip ( 192, 168, 0, 97); 26 | IPAddress gateway_ip ( 192, 168, 0, 1); 27 | IPAddress subnet_mask(255, 255, 255, 0); 28 | 29 | /// END SETUP SENSOR PARAMETERS //// 30 | 31 | uint32_t rtcData; 32 | byte mac[6]; 33 | 34 | 35 | void goingToSleep(bool rfMode = true) { 36 | yield(); 37 | delay(100); 38 | if (rfMode) { 39 | ESP.deepSleep(0, WAKE_RF_DEFAULT); //30 seconds until next alert 40 | } else { 41 | ESP.deepSleep(0, WAKE_RF_DISABLED); //20 minutes 42 | } 43 | yield(); 44 | delay(100); 45 | } 46 | 47 | void blinkLed(uint8_t count) { 48 | for (uint8_t i = 0; i <= count; i++) { 49 | digitalWrite(2, LOW); 50 | delay(100); 51 | digitalWrite(2, HIGH); 52 | delay(100); 53 | } 54 | } 55 | 56 | void batteryMonitor() { 57 | if (ESP.getVcc() / 1024 <= shutdown_voltage) { 58 | rtcData = 1; 59 | blinkLed(3); 60 | ESP.rtcUserMemoryWrite(0, &rtcData, sizeof(rtcData)); 61 | goingToSleep(false); 62 | } else { 63 | rtcData = 0; 64 | ESP.rtcUserMemoryWrite(0, &rtcData, sizeof(rtcData)); 65 | goingToSleep(); 66 | } 67 | } 68 | 69 | String macToStr(const uint8_t* mac) { 70 | String result; 71 | for (int i = 0; i < 6; ++i) { 72 | result += String(mac[i], 16); 73 | if (i < 5) 74 | result += ':'; 75 | } 76 | return result; 77 | } 78 | 79 | void sendRequest(int lightlevel) { 80 | String url = "/switch?mac=" + macToStr(mac); 81 | url += "&presence=true"; 82 | url += "&lightlevel=" + String(lightlevel); 83 | if (lightlevel < 16000) { 84 | url += "&dark=true"; 85 | } else { 86 | url += "&dark=false"; 87 | } 88 | if (lightlevel > 23000) { 89 | url += "&daylight=true"; 90 | } else { 91 | url += "&daylight=false"; 92 | } 93 | 94 | WiFiClient client; 95 | 96 | client.connect(bridgeIp, 80); 97 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 98 | "Host: " + bridgeIp + "\r\n" + 99 | "Connection: close\r\n\r\n"); 100 | } 101 | 102 | 103 | void setup() { 104 | pinMode(2, OUTPUT); 105 | digitalWrite(2, HIGH); 106 | ESP.rtcUserMemoryRead(0, &rtcData, sizeof(rtcData)); 107 | if (rtcData == 1) { 108 | batteryMonitor(); 109 | } 110 | pinMode(A0, INPUT); 111 | pinMode(4, INPUT); 112 | pinMode(5, OUTPUT); 113 | digitalWrite(5, HIGH); 114 | 115 | WiFi.mode(WIFI_STA); 116 | WiFi.begin(ssid, password); 117 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 118 | WiFi.macAddress(mac); 119 | 120 | while (WiFi.status() != WL_CONNECTED) { 121 | delay(20); 122 | } 123 | 124 | if (digitalRead(4) == HIGH) { 125 | ArduinoOTA.begin(); 126 | blinkLed(5); 127 | } else { 128 | 129 | rst_info *rinfo; 130 | rinfo = ESP.getResetInfoPtr(); 131 | 132 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 133 | 134 | WiFiClient client; 135 | client.connect(bridgeIp, 80); 136 | 137 | //register device 138 | String url = "/switch"; 139 | url += "?devicetype=ZLLPresence"; 140 | url += "&mac=" + macToStr(mac); 141 | 142 | //###Registering device 143 | client.connect(bridgeIp, 80); 144 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 145 | "Host: " + bridgeIp + "\r\n" + 146 | "Connection: close\r\n\r\n"); 147 | } else { 148 | sendRequest(analogRead(A0) * lightmultiplier); 149 | } 150 | batteryMonitor(); 151 | } 152 | } 153 | 154 | void loop() { 155 | ArduinoOTA.handle(); 156 | } 157 | -------------------------------------------------------------------------------- /Sensors/HueTapSwitch/HueTapSwitch.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include "user_interface.h" 7 | } 8 | 9 | ADC_MODE(ADC_VCC); 10 | 11 | #define button1_pin 4 12 | #define button2_pin 3 13 | #define button3_pin 13 14 | #define button4_pin 14 15 | 16 | #define shutdown_voltage 2.9 //depending on device, increase or decrease the value if the device don't enter in powersave mode when battery voltage is ~3.2v 17 | 18 | const char* ssid = "WiFi name"; // replace with your wifi name 19 | const char* password = "WiFi password"; // replace with your wifi password 20 | const char* bridgeIp = "192.168.xxx.xxx"; //replace with the hue emulator device ip 21 | 22 | //static ip configuration is necessary to minimize bootup time from deep sleep 23 | IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress 24 | IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP 25 | IPAddress subnet_mask(255, 255, 255, 0); 26 | 27 | // Existing firmware can be updated Over the Air (OTA) by enabling Arduino ota with ON and OFF buttons placed in same time (led will flash 5 times) 28 | 29 | /// END USER CONFIG 30 | const char* switchType = "ZGPSwitch"; 31 | bool otaEnabled = false; 32 | uint32_t rtcData; 33 | 34 | 35 | 36 | byte mac[6]; 37 | uint8_t button; 38 | 39 | void goingToSleep(bool rfMode = true) { 40 | yield(); 41 | delay(100); 42 | if (rfMode) { 43 | ESP.deepSleep(0, WAKE_RF_DEFAULT); 44 | } else { 45 | ESP.deepSleep(0, WAKE_RF_DISABLED); 46 | } 47 | yield(); 48 | delay(100); 49 | } 50 | 51 | void batteryMonitor() { 52 | if (ESP.getVcc() / 1024 <= shutdown_voltage) { 53 | rtcData = 1; 54 | blinkLed(3); 55 | ESP.rtcUserMemoryWrite(0, &rtcData, sizeof(rtcData)); 56 | goingToSleep(false); 57 | } else { 58 | rtcData = 0; 59 | ESP.rtcUserMemoryWrite(0, &rtcData, sizeof(rtcData)); 60 | goingToSleep(); 61 | } 62 | } 63 | 64 | String macToStr(const uint8_t* mac) { 65 | String result; 66 | for (int i = 0; i < 6; ++i) { 67 | result += String(mac[i], 16); 68 | if (i < 5) 69 | result += ':'; 70 | } 71 | return result; 72 | } 73 | 74 | void sendHttpRequest(int button) { 75 | WiFiClient client; 76 | String url = "/switch?mac=" + macToStr(mac) + "&button=" + button; 77 | client.connect(bridgeIp, 80); 78 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 79 | "Host: " + bridgeIp + "\r\n" + 80 | "Connection: close\r\n\r\n"); 81 | } 82 | 83 | 84 | void readButtons() { 85 | if (digitalRead(button1_pin) == HIGH) { 86 | button = 1; 87 | } else if (digitalRead(button2_pin) == HIGH) { 88 | button = 2; 89 | } else if (digitalRead(button3_pin) == HIGH) { 90 | button = 3; 91 | } else if (digitalRead(button4_pin) == HIGH) { 92 | button = 4; 93 | } 94 | } 95 | 96 | 97 | void blinkLed(uint8_t count) { 98 | for (uint8_t i = 0; i <= count; i++) { 99 | digitalWrite(2, LOW); 100 | delay(100); 101 | digitalWrite(2, HIGH); 102 | delay(100); 103 | } 104 | } 105 | 106 | void setup() { 107 | pinMode(2, OUTPUT); 108 | digitalWrite(2, HIGH); 109 | ESP.rtcUserMemoryRead(0, &rtcData, sizeof(rtcData)); 110 | if (rtcData == 1) { 111 | batteryMonitor(); 112 | } 113 | pinMode(button1_pin, INPUT); 114 | pinMode(button2_pin, INPUT); 115 | pinMode(button3_pin, INPUT); 116 | pinMode(button4_pin, INPUT); 117 | 118 | 119 | readButtons(); 120 | 121 | 122 | WiFi.mode(WIFI_STA); 123 | WiFi.begin(ssid, password); 124 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 125 | WiFi.macAddress(mac); 126 | 127 | while (WiFi.status() != WL_CONNECTED) { 128 | delay(50); 129 | } 130 | 131 | rst_info *rinfo; 132 | rinfo = ESP.getResetInfoPtr(); 133 | 134 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 135 | 136 | WiFiClient client; 137 | client.connect(bridgeIp, 80); 138 | 139 | //register device 140 | String url = "/switch"; 141 | url += "?devicetype=" + (String)switchType; 142 | url += "&mac=" + macToStr(mac); 143 | 144 | //###Registering device 145 | client.connect(bridgeIp, 80); 146 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 147 | "Host: " + bridgeIp + "\r\n" + 148 | "Connection: close\r\n\r\n"); 149 | } 150 | 151 | } 152 | 153 | void loop() { 154 | 155 | if (button == 1) { 156 | if (digitalRead(button4_pin) == HIGH) { 157 | ArduinoOTA.begin(); 158 | blinkLed(5); 159 | otaEnabled = true; 160 | button = 5; 161 | } else { 162 | sendHttpRequest(34); 163 | } 164 | } 165 | else if (button == 2) { 166 | sendHttpRequest(16); 167 | } 168 | else if (button == 3) { 169 | sendHttpRequest(17); 170 | } 171 | else if (button == 4) { 172 | sendHttpRequest(18); 173 | } 174 | if (!otaEnabled || button != 5) { 175 | batteryMonitor(); 176 | } 177 | readButtons(); 178 | ArduinoOTA.handle(); 179 | } 180 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.REP: -------------------------------------------------------------------------------- 1 | ************************************************************* 2 | FileName = LED_Controller_4Channels.GBR 3 | AutoAperture = True 4 | ************************************************************* 5 | Generating : Top Layer 6 | File : LED_Controller_4Channels.GTL 7 | 8 | Adding Layer : Top Layer 9 | 10 | Adding Layer : Multi-Layer 11 | 12 | 13 | Used DCodes : 14 | D10 15 | D11 16 | D12 17 | D13 18 | D14 19 | D15 20 | D16 21 | D17 22 | D18 23 | D19 24 | D20 25 | D21 26 | D22 27 | D23 28 | D24 29 | D25 30 | D26 31 | D27 32 | D28 33 | D29 34 | D30 35 | D31 36 | ************************************************************* 37 | 38 | ************************************************************* 39 | Generating : Bottom Layer 40 | File : LED_Controller_4Channels.GBL 41 | 42 | Adding Layer : Bottom Layer 43 | 44 | Adding Layer : Multi-Layer 45 | 46 | 47 | Used DCodes : 48 | D10 49 | D11 50 | D12 51 | D13 52 | D14 53 | D15 54 | D16 55 | D17 56 | D19 57 | D20 58 | D21 59 | D22 60 | D23 61 | D24 62 | D25 63 | D26 64 | D27 65 | D28 66 | D29 67 | D30 68 | D31 69 | ************************************************************* 70 | 71 | ************************************************************* 72 | Generating : Top Overlay 73 | File : LED_Controller_4Channels.GTO 74 | 75 | Adding Layer : Top Overlay 76 | 77 | 78 | Used DCodes : 79 | D32 80 | D33 81 | D34 82 | D35 83 | D36 84 | ************************************************************* 85 | 86 | ************************************************************* 87 | Generating : Top Paste 88 | File : LED_Controller_4Channels.GTP 89 | 90 | Adding Layer : Top Paste 91 | 92 | Adding Layer : Top Layer 93 | 94 | Adding Layer : Multi-Layer 95 | 96 | 97 | Used DCodes : 98 | D10 99 | D11 100 | D12 101 | D13 102 | ************************************************************* 103 | 104 | ************************************************************* 105 | Generating : Top Solder 106 | File : LED_Controller_4Channels.GTS 107 | 108 | Adding Layer : Top Solder 109 | 110 | Adding Layer : Top Layer 111 | 112 | Adding Layer : Multi-Layer 113 | 114 | 115 | Used DCodes : 116 | D37 117 | D38 118 | D39 119 | D40 120 | D41 121 | D42 122 | D43 123 | D44 124 | D45 125 | D46 126 | D47 127 | D48 128 | D49 129 | D50 130 | D51 131 | D52 132 | ************************************************************* 133 | 134 | ************************************************************* 135 | Generating : Bottom Solder 136 | File : LED_Controller_4Channels.GBS 137 | 138 | Adding Layer : Bottom Solder 139 | 140 | Adding Layer : Bottom Layer 141 | 142 | Adding Layer : Multi-Layer 143 | 144 | 145 | Used DCodes : 146 | D37 147 | D38 148 | D39 149 | D40 150 | D41 151 | D42 152 | D43 153 | D44 154 | D45 155 | D46 156 | D47 157 | D48 158 | D49 159 | D50 160 | D51 161 | D52 162 | ************************************************************* 163 | 164 | ************************************************************* 165 | Generating : Bottom Paste 166 | File : LED_Controller_4Channels.GBP 167 | 168 | Adding Layer : Bottom Paste 169 | 170 | Adding Layer : Bottom Layer 171 | 172 | Adding Layer : Multi-Layer 173 | 174 | 175 | Used DCodes : 176 | D10 177 | D11 178 | D12 179 | D13 180 | ************************************************************* 181 | 182 | ************************************************************* 183 | Generating : Bottom Overlay 184 | File : LED_Controller_4Channels.GBO 185 | 186 | Adding Layer : Bottom Overlay 187 | 188 | 189 | Used DCodes : 190 | D32 191 | D33 192 | D35 193 | ************************************************************* 194 | 195 | ************************************************************* 196 | Generating : Drill Drawing 197 | File : LED_Controller_4Channels.GD1 198 | 199 | Adding Drill Pair : Bottom Layer-Top Layer 200 | 201 | Adding Layer : Drill Drawing 202 | 203 | 204 | Used DCodes : 205 | D53 206 | D54 207 | ************************************************************* 208 | 209 | ************************************************************* 210 | Generating : Drill Guide 211 | File : LED_Controller_4Channels.GG1 212 | 213 | Adding Drill Pair : Bottom Layer-Top Layer 214 | 215 | Adding Layer : Drill Guide 216 | 217 | 218 | Used DCodes : 219 | D53 220 | ************************************************************* 221 | 222 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/__Previews/LED_Controller_4Channels.PcbDocPreview: -------------------------------------------------------------------------------- 1 | [Preview] 2 | LargeImageOriginalSize=272000 3 | LargeImageWidth=500 4 | LargeImageHeight=136 5 | LargeImage=78DAEDDC316A1B411480E13D8A4B1DC207D049740EBB37489D1A432055AA7486409A0537C6A40AA432AAD40443CAD4EB4565B0792F663C9E1D7F63FE56D66877DFB7D50CC3340C924E5D24FEA669AAD6906852B5DFBAC57ADDDB47BF66AFBA87CD7089E7E2B97DF15CE239CF79CE3DFBE2B9C4739EF39C7B3CE7B9C473F19CE73C37C3259EAB733FC47389E73C17CFC57389E73CE7B9C47389E73CE7B978CE7389E7E2B9782EF19CE7E2B9782EF19CE73C97782EF19CE73C17CF792EF15C3C17CF259E3FFF577565E683D5D6E295DE2B335CE2B9C573F15CE239CF2D9E8BE712CF79CE7389E712CF2D9E4B66B8C4738BE7E2B9C4739E5B3C17CF259EF39CE712CF259E5B3C975EF07C95E8F23A6E3DC4653E67B58ADB5CE6CACCF4EB4DA29BB852DF47AD795EF13B792757A59CFFD7C1F9853CE7B9782E9EF390E73CE739CF792E9E8BE73C17CF792E9E8BE73C17CF259E8BE73C17CF251EF29CE73CE739CFC573F19CE7E608CF792E9E8BE73C17CF5D37F15C6681F4DF9E577DDFE3B9982F9E4B3C9778CE7389E73C9778CE7389E73C17CFC57389E73C17CFC57389E712CF792EF19CE712CF792EF19CE7E2B9782EF19CE7E2B93AF33C735EDD7A93CB3329E7C3496F59BCD8CB739E8BE73C17CFC5739E8BE712CF79CE73F19CE712CF79CE73F19CE7E239CF79CE73F19CE7E2B978CE73F15CE239CF792E9EF35CE239CF792E9EF35C3CE7B9F3E1A4563CAFFA7C2632C71AABBA9ECC17CF259E8BE73CE7B9C4739E8BE73CE7B9C4739EF39CE73CE7B9C4739EF39CE7E2B9C473F19CE73C9778CE73F19CE73C9778CE739EF39CE73C9778CE739EF35C3C977AF15C929C1529F15C12CF259EF35C12CF259EF35C12CF259E4B12CF259E4BE2B9C4739E4BE2B9C4739E4BE2B9C47349E2B9D4BEE75D9F652589E712CF792E89E712CF792EF15CE2B9782EF15CE2B9CC5E89E712CF792E89E712CF792EF15CE2B9782EF15CE2B9CC5E89E712CF792E89E752239E7FF4D9E39DA650159F905E9FFB6EDE91CD7089E73CE739CF792EF19CE73CE739CF792EF19CE7E239CF792EF19CE73CE739CFCD7089E73CE739CF792EF19CE73CE739CF792EF19CE7E239CF792EF19CE73CE739CF792E391FEE0D3A4BB4FD1DB73FC47D39FC0DDBFFBC0FFB747C8CFBF12BECCFBCB74C99FD7F4E546AFFFB797F510F170F6199753E3F6B51DBBBB8ABDBB862BFCFDCF63885659E8F52F7C7BF99E112CF79CE739EF35CE2B978CE739EF35CE239CF79CE739EF35CE239CF79CE739E9BDF12CF79CE739EF35CE2B978CE739EF35CE239CF79CE739EF35CE239CF79CE739EF35C6ADBF3A59EEB56EA73C6715C5C25AF7FE67E5CE2FE732B7E5E7BBFFECE879378CE739EF39CE712CF79CE739EF39CE712CF79CE739EF39CE712CF79CE739EF39CE712CF79CE739EF35CE239CF79CE739EF35CE239CF79CE739EF35CE239CF79CE739EF35C5A8EE7A5CC6BB19A9E6FBF0E6135E779F65E2BF55B7F9BFF67D4EEFB2E6C899EA5F67EB70B1BC7FB643C9778CE739EF39CE73C9778CE739EF39CE73C9778CE739EF39CE712CF79CE739EF39CE712CF79CE739EF39CE712CF79CE739EF39CE712CF79CE739EF35CE239CF79CE739EF35CE2795F9ED73C676E89E7C395BC1F4B5DB3CCF76EED6CC49A7B5FC2D96F3C9778CE739EF39CE712CF79CE739EF39CE712CF79CE739EF39CE712CF79CE739EF39CE712CF79CE739EF35CE239CF79CE739EF35CE239CF79CE739EF35CE239CF79CE739EF35C6ADBF39ECF751B24D5CF0C9778CE7389E712CF79CE7389E712CF792E89E712CF792EC90C9778CE7389E712CF79CE7389E712CF792E89E712CF792E89E712CF792EF15CE239CF792EF15CE239CF25F15CE239CF259D7A02A9863076 6 | MediumImageOriginalSize=68000 7 | MediumImageWidth=250 8 | MediumImageHeight=68 9 | MediumImage=78DAEDDDBF4AC34000C0E13C8A631FC207E893F439EC2EB45B1741707272130497804B1127C1499C5C4470748E4511BC3F483C9AD8A45FE4B769AF4DEEEB705C62553555A57FEF28F3D334CD9FAB323503A8EAB07D19EBD7F3CB18E79C732ECE39E75C9C0FCCFD58E29C73CE39E79C73CE3917E79C73AE7E9C171DB939319683EDF218E39C73CEC539E79C8B73CE3917E79CEF94F349D4FC246D5A85E57E6732099BCDD37273FD64167599D6E675C6E3BCE0B57C9717D534E38E73CEC539E79C73CE39E79C733E2CE7DA2DE745DF7B9C73CF39E7E25C9C8B7371CE39E7E29CF3BD711EAFDB4F6769E692F5F6E1156FCFE39C73CE39E7DC9CE19C73CE39E79C73EB709E1B35EEE746652BD6D98FFB5DB6CF18E79C732ECE39E75C9C73CEB938E79C7375EF5C628C73712ECEC5B93817E7EAD7B9FF8326CE39E79C7371CE39E7E29C73CEC5B938D7F69DFFF7FC19EB3EBAB13DA38A31CE39E75C9C73CEB938E79C7371CE39E71ACE7AFB41A6C54BD8EA29EDFCE93D68757F9B74FAFC1A76F790F4B6192F2E1EFF2C539BF1579B317FF678F498141F879BEB16B758871DDFA4B5793F8BE72629BE1E6DCEC7778C71CE39E7E29C73CEC539E79C6BB8F7A5963C93AAAEEBCE6AF3F973E7B1ABF1F347785DFBFEFCD6E138E79C7371CE39E7E29C73CEC539E79CAB9FFD707DDF83DAC6F9E2A20A2A9DE7A57BC9AE367FFBB3E5F532A92B67F1D89FE3AF9741757D9B8973CE39E79C73CE39E79C73CE39E75C9CB75FD3EB731D6E5BF77EE55EBBCFBD885DAFB971CE39E79C8B73CE3917E79C732ECE39E75CBB7B5F6AE97E38797EBB3817E7E25C9C73CEB938E79C7371CE39E7FAEA037B8F749D 10 | SmallImageOriginalSize=24600 11 | SmallImageWidth=150 12 | SmallImageHeight=41 13 | SmallImage=78DAEDDCBF4AC3401CC0F17B14C73C840FD027C973B4BB906C590A8293939B20B8045C4A71129C4AA72E22383A9F69E2DDFDA2A9A7F963FE7D23DFA5A4479A7CC4EB25A894566A262DC58FD6FAC79448779CAA59D331DA3E86D278B8C215AE26E9AA8DEBDB57B8C215AE7085AB71BAF26EF2FCF5B58DD0993B67B8C25577AE02D16A5DB4502EF3DAB120280A572E79FDD6A1E8B6E8D4BEFDB9F2EC3FD2DF3DAD8711AE70852B5C8DCDD5DCE6575EFB139883E20A57B8C215AEBA7165E6618BD035BE758669CEAF4E27972F70852B5CE10A57DC1F1CE6FDC1525E29CD8CE10A57B89A9E2BE2BE33AE70852B5CCDCDD5DC9ECFC315AE70852B5CE1EA3F9EFB1EC73A44F3FB8BB8C215AE86FF77F0ECB3E8C595EC5DD7FB775BF2B4CDBB3CBCBA1E9F6D6FD9382633D695A86AAC241BC3B45BEE6C723BCFCEC5B168E3BA78707D1B332B3A689BFCBC5F8FCF842B5CE10A57B89ACFBA68D5FBE46B699AD6AAEAB8E467A83B9678B2C1D6F4B8985FE10A57B8C2D5B4D6199AAE879E7215DD289BEFFAF9BEF3DF65FB98E2FB38AFAE85D2589B382F4DB7225CE10A57B8C215AE7E3F176B637EF5973570F39E36D652EACEA970852B5C0D735DB4EDFFD3C9F30CB8C215AE70852B5C4DA70FE0858115 14 | 15 | -------------------------------------------------------------------------------- /Sensors/HueDimmerSwitch/HueDimmerSwitch.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include "user_interface.h" 7 | } 8 | 9 | ADC_MODE(ADC_VCC); 10 | 11 | #define button1_pin 4 12 | #define button2_pin 3 13 | #define button3_pin 13 14 | #define button4_pin 14 15 | 16 | #define shutdown_voltage 2.9 //depending on device, increase or decrease the value if the device don't enter in powersave mode when battery voltage is ~3.2v 17 | 18 | const char* ssid = "WiFi name"; // replace with your wifi name 19 | const char* password = "WiFi password"; // replace with your wifi password 20 | const char* bridgeIp = "192.168.xxx.xxx"; //replace with the hue emulator device ip 21 | 22 | //static ip configuration is necessary to minimize bootup time from deep sleep 23 | IPAddress strip_ip ( 192, 168, 10, 95); // choose an unique IP Adress 24 | IPAddress gateway_ip ( 192, 168, 10, 1); // Router IP 25 | IPAddress subnet_mask(255, 255, 255, 0); 26 | 27 | // Existing firmware can be updated Over the Air (OTA) by enabling Arduino ota with ON and OFF buttons placed in same time (led will flash 5 times) 28 | 29 | /// END USER CONFIG 30 | const char* switchType = "ZLLSwitch"; 31 | bool otaEnabled = false; 32 | uint32_t rtcData; 33 | 34 | 35 | 36 | byte mac[6]; 37 | uint8_t button; 38 | 39 | void goingToSleep(bool rfMode = true) { 40 | yield(); 41 | delay(100); 42 | if (rfMode) { 43 | ESP.deepSleep(0, WAKE_RF_DEFAULT); 44 | } else { 45 | ESP.deepSleep(0, WAKE_RF_DISABLED); 46 | } 47 | yield(); 48 | delay(100); 49 | } 50 | 51 | void batteryMonitor() { 52 | if (ESP.getVcc() / 1024 <= shutdown_voltage) { 53 | rtcData = 1; 54 | blinkLed(3); 55 | ESP.rtcUserMemoryWrite(0, &rtcData, sizeof(rtcData)); 56 | goingToSleep(false); 57 | } else { 58 | rtcData = 0; 59 | ESP.rtcUserMemoryWrite(0, &rtcData, sizeof(rtcData)); 60 | goingToSleep(); 61 | } 62 | } 63 | 64 | String macToStr(const uint8_t* mac) { 65 | String result; 66 | for (int i = 0; i < 6; ++i) { 67 | result += String(mac[i], 16); 68 | if (i < 5) 69 | result += ':'; 70 | } 71 | return result; 72 | } 73 | 74 | void sendHttpRequest(int button) { 75 | WiFiClient client; 76 | String url = "/switch?mac=" + macToStr(mac) + "&button=" + button; 77 | client.connect(bridgeIp, 80); 78 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 79 | "Host: " + bridgeIp + "\r\n" + 80 | "Connection: close\r\n\r\n"); 81 | } 82 | 83 | 84 | void readButtons() { 85 | if (digitalRead(button1_pin) == HIGH) { 86 | button = 1; 87 | } else if (digitalRead(button2_pin) == HIGH) { 88 | button = 2; 89 | } else if (digitalRead(button3_pin) == HIGH) { 90 | button = 3; 91 | } else if (digitalRead(button4_pin) == HIGH) { 92 | button = 4; 93 | } 94 | } 95 | 96 | 97 | void blinkLed(uint8_t count) { 98 | for (uint8_t i = 0; i <= count; i++) { 99 | digitalWrite(2, LOW); 100 | delay(100); 101 | digitalWrite(2, HIGH); 102 | delay(100); 103 | } 104 | } 105 | 106 | void setup() { 107 | pinMode(2, OUTPUT); 108 | digitalWrite(2, HIGH); 109 | ESP.rtcUserMemoryRead(0, &rtcData, sizeof(rtcData)); 110 | if (rtcData == 1) { 111 | batteryMonitor(); 112 | } 113 | pinMode(button1_pin, INPUT); 114 | pinMode(button2_pin, INPUT); 115 | pinMode(button3_pin, INPUT); 116 | pinMode(button4_pin, INPUT); 117 | 118 | 119 | readButtons(); 120 | 121 | 122 | WiFi.mode(WIFI_STA); 123 | WiFi.begin(ssid, password); 124 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 125 | WiFi.macAddress(mac); 126 | 127 | while (WiFi.status() != WL_CONNECTED) { 128 | delay(50); 129 | } 130 | 131 | rst_info *rinfo; 132 | rinfo = ESP.getResetInfoPtr(); 133 | 134 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 135 | 136 | WiFiClient client; 137 | client.connect(bridgeIp, 80); 138 | 139 | //register device 140 | String url = "/switch"; 141 | url += "?devicetype=" + (String)switchType; 142 | url += "&mac=" + macToStr(mac); 143 | 144 | //###Registering device 145 | client.connect(bridgeIp, 80); 146 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 147 | "Host: " + bridgeIp + "\r\n" + 148 | "Connection: close\r\n\r\n"); 149 | } 150 | 151 | } 152 | 153 | void loop() { 154 | 155 | if (button == 1) { 156 | if (digitalRead(button4_pin) == HIGH) { 157 | ArduinoOTA.begin(); 158 | blinkLed(5); 159 | otaEnabled = true; 160 | button = 5; 161 | } else { 162 | sendHttpRequest(1000); 163 | } 164 | } 165 | else if (button == 2) { 166 | sendHttpRequest(2000); 167 | delay(300); 168 | while (digitalRead(button2_pin) == HIGH) { 169 | delay(900); 170 | sendHttpRequest(2001); 171 | } 172 | } 173 | else if (button == 3) { 174 | sendHttpRequest(3000); 175 | delay(300); 176 | while (digitalRead(button3_pin) == HIGH) { 177 | delay(900); 178 | sendHttpRequest(3001); 179 | } 180 | } 181 | else if (button == 4) { 182 | sendHttpRequest(4000); 183 | } 184 | if (!otaEnabled || button != 5) { 185 | batteryMonitor(); 186 | } 187 | readButtons(); 188 | ArduinoOTA.handle(); 189 | } 190 | -------------------------------------------------------------------------------- /BridgeEmulator/easy_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mac=`cat /sys/class/net/$(ip route get 8.8.8.8 | sed -n 's/.* dev \([^ ]*\).*/\1/p')/address` 3 | arch=`uname -m` 4 | 5 | cd /tmp 6 | 7 | ### installing dependencies 8 | echo -e "\033[36m Installing dependencies.\033[0m" 9 | apt install -y unzip nmap python3 python3-requests python3-ws4py python3-setuptools 10 | 11 | ### installing astral library for sunrise/sunset routines 12 | echo -e "\033[36m Installing Python Astral.\033[0m" 13 | wget -q https://github.com/sffjunkie/astral/archive/master.zip -O astral.zip 14 | unzip -q -o astral.zip 15 | cd astral-master/ 16 | python3 setup.py install 17 | cd ../ 18 | rm -rf astral.zip astral-master/ 19 | 20 | ### installing hue emulator 21 | echo -e "\033[36m Installing Hue Emulator.\033[0m" 22 | wget -q https://github.com/mariusmotea/diyHue/archive/master.zip -O diyHue.zip 23 | unzip -q -o diyHue.zip 24 | cd diyHue-master/BridgeEmulator/ 25 | 26 | if [ -d "/opt/hue-emulator" ]; then 27 | if [ -f "/opt/hue-emulator/public.crt" ]; then 28 | echo -e "\033[31m WARNING!! Nginx is not necessary anymore, it will be stopped.\033[0m" 29 | systemctl stop nginx 30 | systemctl disable nginx 31 | cp /opt/hue-emulator/private.key /tmp/cert.pem 32 | cat /opt/hue-emulator/public.crt >> /tmp/cert.pem 33 | elif [ -f "/opt/hue-emulator/cert.pem" ]; then 34 | cp /opt/hue-emulator/cert.pem /tmp/cert.pem 35 | else 36 | curl https://raw.githubusercontent.com/mariusmotea/diyHue/9ceed19b4211aa85a90fac9ea6d45cfeb746c9dd/BridgeEmulator/openssl.conf -o openssl.conf 37 | serial="${mac:0:2}${mac:3:2}${mac:6:2}fffe${mac:9:2}${mac:12:2}${mac:15:2}" 38 | dec_serial=`python3 -c "print(int(\"$serial\", 16))"` 39 | openssl req -new -config openssl.conf -nodes -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -subj "/C=NL/O=Philips Hue/CN=$serial" -keyout private.key -out public.crt -set_serial $dec_serial 40 | if [ $? -ne 0 ] ; then 41 | echo -e "\033[31m ERROR!! Local certificate generation failed! Attempting remote server generation\033[0m" 42 | ### test is server for certificate generation is reachable 43 | if ! nc -z mariusmotea.go.ro 9002 2>/dev/null; then 44 | echo -e "\033[31m ERROR!! Certificate generation service is down. Please try again later.\033[0m" 45 | exit 1 46 | fi 47 | curl "http://mariusmotea.go.ro:9002/gencert?mac=$mac" > /tmp/cert.pem 48 | else 49 | touch /tmp/cert.pem 50 | cat private.key > /tmp/cert.pem 51 | cat public.crt >> /tmp/cert.pem 52 | rm private.key public.crt 53 | fi 54 | fi 55 | 56 | systemctl stop hue-emulator.service 57 | echo -e "\033[33m Existing installation found, performing upgrade.\033[0m" 58 | cp /opt/hue-emulator/config.json /tmp 59 | rm -rf /opt/hue-emulator 60 | mkdir /opt/hue-emulator 61 | mv /tmp/config.json /opt/hue-emulator 62 | mv /tmp/cert.pem /opt/hue-emulator 63 | 64 | else 65 | if nc -z 127.0.0.1 80 2>/dev/null; then 66 | echo -e "\033[31m ERROR!! Port 80 already in use. Close the application that use this port and try again.\033[0m" 67 | exit 1 68 | fi 69 | if nc -z 127.0.0.1 443 2>/dev/null; then 70 | echo -e "\033[31m ERROR!! Port 443 already in use. Close the application that use this port and try again.\033[0m" 71 | exit 1 72 | fi 73 | mkdir /opt/hue-emulator 74 | cp config.json /opt/hue-emulator/ 75 | 76 | curl https://raw.githubusercontent.com/mariusmotea/diyHue/9ceed19b4211aa85a90fac9ea6d45cfeb746c9dd/BridgeEmulator/openssl.conf -o openssl.conf 77 | serial="${mac:0:2}${mac:3:2}${mac:6:2}fffe${mac:9:2}${mac:12:2}${mac:15:2}" 78 | dec_serial=`python3 -c "print(int(\"$serial\", 16))"` 79 | openssl req -new -config openssl.conf -nodes -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -subj "/C=NL/O=Philips Hue/CN=$serial" -keyout private.key -out public.crt -set_serial $dec_serial 80 | if [ $? -ne 0 ] ; then 81 | echo -e "\033[31m ERROR!! Local certificate generation failed! Attempting remote server generation\033[0m" 82 | ### test is server for certificate generation is reachable 83 | if ! nc -z mariusmotea.go.ro 9002 2>/dev/null; then 84 | echo -e "\033[31m ERROR!! Certificate generation service is down. Please try again later.\033[0m" 85 | exit 1 86 | fi 87 | curl "http://mariusmotea.go.ro:9002/gencert?mac=$mac" > /opt/hue-emulator/cert.pem 88 | else 89 | touch /opt/hue-emulator/cert.pem 90 | cat private.key > /opt/hue-emulator/cert.pem 91 | cat public.crt >> /opt/hue-emulator/cert.pem 92 | rm private.key public.crt 93 | fi 94 | fi 95 | cp -r web-ui functions protocols HueEmulator3.py /opt/hue-emulator/ 96 | if [ $(uname -m) = "x86_64" ]; then 97 | cp entertainment-x86_64 /opt/hue-emulator/entertainment-srv 98 | cp coap-client-x86_64 /opt/hue-emulator/coap-client-linux 99 | else 100 | cp entertainment-arm /opt/hue-emulator/entertainment-srv 101 | cp coap-client-arm /opt/hue-emulator/coap-client-linux 102 | fi 103 | cp hue-emulator.service /lib/systemd/system/ 104 | cd ../../ 105 | rm -rf diyHue.zip diyHue-master 106 | chmod 644 /lib/systemd/system/hue-emulator.service 107 | systemctl daemon-reload 108 | systemctl enable hue-emulator.service 109 | systemctl start hue-emulator.service 110 | 111 | echo -e "\033[32m Installation completed. Open Hue app and search for bridges.\033[0m" 112 | -------------------------------------------------------------------------------- /BridgeEmulator/web-ui/static/css/main.23de7225.css: -------------------------------------------------------------------------------- 1 | .rc-slider{position:relative;height:14px;padding:5px 0;width:100%;border-radius:6px;-ms-touch-action:none;touch-action:none}.rc-slider,.rc-slider *{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-rail{width:100%;background-color:#e9e9e9}.rc-slider-rail,.rc-slider-track{position:absolute;height:4px;border-radius:6px}.rc-slider-track{left:0;background-color:#abe2fb}.rc-slider-handle{position:absolute;margin-left:-7px;margin-top:-5px;width:14px;height:14px;cursor:pointer;cursor:-webkit-grab;cursor:grab;border-radius:50%;border:2px solid #96dbfa;background-color:#fff;-ms-touch-action:pan-x;touch-action:pan-x}.rc-slider-handle:hover{border-color:#57c5f7}.rc-slider-handle:active{border-color:#57c5f7;-webkit-box-shadow:0 0 5px #57c5f7;box-shadow:0 0 5px #57c5f7;cursor:-webkit-grabbing;cursor:grabbing}.rc-slider-handle:focus{border-color:#57c5f7;-webkit-box-shadow:0 0 0 5px #96dbfa;box-shadow:0 0 0 5px #96dbfa;outline:none}.rc-slider-mark{position:absolute;top:18px;left:0;width:100%;font-size:12px}.rc-slider-mark-text{position:absolute;display:inline-block;vertical-align:middle;text-align:center;cursor:pointer;color:#999}.rc-slider-mark-text-active{color:#666}.rc-slider-step{position:absolute;width:100%;height:4px;background:transparent}.rc-slider-dot{position:absolute;bottom:-2px;margin-left:-4px;width:8px;height:8px;border:2px solid #e9e9e9;background-color:#fff;cursor:pointer;border-radius:50%;vertical-align:middle}.rc-slider-dot-active{border-color:#96dbfa}.rc-slider-disabled{background-color:#e9e9e9}.rc-slider-disabled .rc-slider-track{background-color:#ccc}.rc-slider-disabled .rc-slider-dot,.rc-slider-disabled .rc-slider-handle{border-color:#ccc;-webkit-box-shadow:none;box-shadow:none;background-color:#fff;cursor:not-allowed}.rc-slider-disabled .rc-slider-dot,.rc-slider-disabled .rc-slider-mark-text{cursor:not-allowed!important}.rc-slider-vertical{width:14px;height:100%;padding:0 5px}.rc-slider-vertical .rc-slider-rail{height:100%;width:4px}.rc-slider-vertical .rc-slider-track{left:5px;bottom:0;width:4px}.rc-slider-vertical .rc-slider-handle{margin-left:-5px;margin-bottom:-7px;-ms-touch-action:pan-y;touch-action:pan-y}.rc-slider-vertical .rc-slider-mark{top:0;left:18px;height:100%}.rc-slider-vertical .rc-slider-step{height:100%;width:4px}.rc-slider-vertical .rc-slider-dot{left:2px;margin-bottom:-4px}.rc-slider-vertical .rc-slider-dot:first-child,.rc-slider-vertical .rc-slider-dot:last-child{margin-bottom:-4px}.rc-slider-tooltip-zoom-down-appear,.rc-slider-tooltip-zoom-down-enter,.rc-slider-tooltip-zoom-down-leave{-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;display:block!important;-webkit-animation-play-state:paused;animation-play-state:paused}.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active,.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active{-webkit-animation-name:rcSliderTooltipZoomDownIn;animation-name:rcSliderTooltipZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active{-webkit-animation-name:rcSliderTooltipZoomDownOut;animation-name:rcSliderTooltipZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running}.rc-slider-tooltip-zoom-down-appear,.rc-slider-tooltip-zoom-down-enter{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation-timing-function:cubic-bezier(.23,1,.32,1);animation-timing-function:cubic-bezier(.23,1,.32,1)}.rc-slider-tooltip-zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(.755,.05,.855,.06);animation-timing-function:cubic-bezier(.755,.05,.855,.06)}@-webkit-keyframes rcSliderTooltipZoomDownIn{0%{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}}@keyframes rcSliderTooltipZoomDownIn{0%{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes rcSliderTooltipZoomDownOut{0%{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}}@keyframes rcSliderTooltipZoomDownOut{0%{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}}.rc-slider-tooltip{position:absolute;left:-9999px;top:-9999px;visibility:visible}.rc-slider-tooltip,.rc-slider-tooltip *{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-tooltip-hidden{display:none}.rc-slider-tooltip-placement-top{padding:4px 0 8px}.rc-slider-tooltip-inner{padding:6px 2px;min-width:24px;height:24px;font-size:12px;line-height:1;color:#fff;text-align:center;text-decoration:none;background-color:#6c6c6c;border-radius:6px;-webkit-box-shadow:0 0 4px #d9d9d9;box-shadow:0 0 4px #d9d9d9}.rc-slider-tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow{bottom:4px;left:50%;margin-left:-4px;border-width:4px 4px 0;border-top-color:#6c6c6c} 2 | /*# sourceMappingURL=main.23de7225.css.map*/ -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/build/static/css/main.23de7225.css: -------------------------------------------------------------------------------- 1 | .rc-slider{position:relative;height:14px;padding:5px 0;width:100%;border-radius:6px;-ms-touch-action:none;touch-action:none}.rc-slider,.rc-slider *{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-rail{width:100%;background-color:#e9e9e9}.rc-slider-rail,.rc-slider-track{position:absolute;height:4px;border-radius:6px}.rc-slider-track{left:0;background-color:#abe2fb}.rc-slider-handle{position:absolute;margin-left:-7px;margin-top:-5px;width:14px;height:14px;cursor:pointer;cursor:-webkit-grab;cursor:grab;border-radius:50%;border:2px solid #96dbfa;background-color:#fff;-ms-touch-action:pan-x;touch-action:pan-x}.rc-slider-handle:hover{border-color:#57c5f7}.rc-slider-handle:active{border-color:#57c5f7;-webkit-box-shadow:0 0 5px #57c5f7;box-shadow:0 0 5px #57c5f7;cursor:-webkit-grabbing;cursor:grabbing}.rc-slider-handle:focus{border-color:#57c5f7;-webkit-box-shadow:0 0 0 5px #96dbfa;box-shadow:0 0 0 5px #96dbfa;outline:none}.rc-slider-mark{position:absolute;top:18px;left:0;width:100%;font-size:12px}.rc-slider-mark-text{position:absolute;display:inline-block;vertical-align:middle;text-align:center;cursor:pointer;color:#999}.rc-slider-mark-text-active{color:#666}.rc-slider-step{position:absolute;width:100%;height:4px;background:transparent}.rc-slider-dot{position:absolute;bottom:-2px;margin-left:-4px;width:8px;height:8px;border:2px solid #e9e9e9;background-color:#fff;cursor:pointer;border-radius:50%;vertical-align:middle}.rc-slider-dot-active{border-color:#96dbfa}.rc-slider-disabled{background-color:#e9e9e9}.rc-slider-disabled .rc-slider-track{background-color:#ccc}.rc-slider-disabled .rc-slider-dot,.rc-slider-disabled .rc-slider-handle{border-color:#ccc;-webkit-box-shadow:none;box-shadow:none;background-color:#fff;cursor:not-allowed}.rc-slider-disabled .rc-slider-dot,.rc-slider-disabled .rc-slider-mark-text{cursor:not-allowed!important}.rc-slider-vertical{width:14px;height:100%;padding:0 5px}.rc-slider-vertical .rc-slider-rail{height:100%;width:4px}.rc-slider-vertical .rc-slider-track{left:5px;bottom:0;width:4px}.rc-slider-vertical .rc-slider-handle{margin-left:-5px;margin-bottom:-7px;-ms-touch-action:pan-y;touch-action:pan-y}.rc-slider-vertical .rc-slider-mark{top:0;left:18px;height:100%}.rc-slider-vertical .rc-slider-step{height:100%;width:4px}.rc-slider-vertical .rc-slider-dot{left:2px;margin-bottom:-4px}.rc-slider-vertical .rc-slider-dot:first-child,.rc-slider-vertical .rc-slider-dot:last-child{margin-bottom:-4px}.rc-slider-tooltip-zoom-down-appear,.rc-slider-tooltip-zoom-down-enter,.rc-slider-tooltip-zoom-down-leave{-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;display:block!important;-webkit-animation-play-state:paused;animation-play-state:paused}.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active,.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active{-webkit-animation-name:rcSliderTooltipZoomDownIn;animation-name:rcSliderTooltipZoomDownIn;-webkit-animation-play-state:running;animation-play-state:running}.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active{-webkit-animation-name:rcSliderTooltipZoomDownOut;animation-name:rcSliderTooltipZoomDownOut;-webkit-animation-play-state:running;animation-play-state:running}.rc-slider-tooltip-zoom-down-appear,.rc-slider-tooltip-zoom-down-enter{-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation-timing-function:cubic-bezier(.23,1,.32,1);animation-timing-function:cubic-bezier(.23,1,.32,1)}.rc-slider-tooltip-zoom-down-leave{-webkit-animation-timing-function:cubic-bezier(.755,.05,.855,.06);animation-timing-function:cubic-bezier(.755,.05,.855,.06)}@-webkit-keyframes rcSliderTooltipZoomDownIn{0%{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}}@keyframes rcSliderTooltipZoomDownIn{0%{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes rcSliderTooltipZoomDownOut{0%{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}}@keyframes rcSliderTooltipZoomDownOut{0%{-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:scale(0);transform:scale(0)}}.rc-slider-tooltip{position:absolute;left:-9999px;top:-9999px;visibility:visible}.rc-slider-tooltip,.rc-slider-tooltip *{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.rc-slider-tooltip-hidden{display:none}.rc-slider-tooltip-placement-top{padding:4px 0 8px}.rc-slider-tooltip-inner{padding:6px 2px;min-width:24px;height:24px;font-size:12px;line-height:1;color:#fff;text-align:center;text-decoration:none;background-color:#6c6c6c;border-radius:6px;-webkit-box-shadow:0 0 4px #d9d9d9;box-shadow:0 0 4px #d9d9d9}.rc-slider-tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow{bottom:4px;left:50%;margin-left:-4px;border-width:4px 4px 0;border-top-color:#6c6c6c} 2 | /*# sourceMappingURL=main.23de7225.css.map*/ -------------------------------------------------------------------------------- /BridgeEmulator/web-ui-src/src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { css } from "react-emotion"; 3 | import { withStyles } from "@material-ui/core/styles"; 4 | import AppBar from "@material-ui/core/AppBar"; 5 | import Toolbar from "@material-ui/core/Toolbar"; 6 | import Typography from "@material-ui/core/Typography"; 7 | import Switch from "@material-ui/core/Switch"; 8 | import Drawer from "@material-ui/core/Drawer"; 9 | import FormControlLabel from "@material-ui/core/FormControlLabel"; 10 | import List from "@material-ui/core/List"; 11 | import ListItem from "@material-ui/core/ListItem"; 12 | import ListItemIcon from "@material-ui/core/ListItemIcon"; 13 | import ListItemText from "@material-ui/core/ListItemText"; 14 | import IconButton from "@material-ui/core/IconButton"; 15 | import Hidden from "@material-ui/core/Hidden"; 16 | import LightbulbOnIcon from "mdi-react/LightbulbOnIcon"; 17 | import LinkIcon from "mdi-react/LinkVariantIcon"; 18 | import ImportIcon from "mdi-react/ImportIcon"; 19 | import MenuIcon from "mdi-react/MenuIcon"; 20 | import { State } from "react-powerplug"; 21 | import Room from "./Room"; 22 | 23 | const flex = css` 24 | flex: 1; 25 | `; 26 | 27 | const drawerWidth = 240; 28 | 29 | const styles = theme => ({ 30 | root: { 31 | flexGrow: 1, 32 | height: "100vh", 33 | zIndex: 1, 34 | overflow: "hidden", 35 | position: "relative", 36 | display: "flex" 37 | }, 38 | appBar: { 39 | zIndex: theme.zIndex.drawer + 1, 40 | marginLeft: drawerWidth, 41 | [theme.breakpoints.up("md")]: { 42 | width: `calc(100% - ${drawerWidth}px)` 43 | } 44 | }, 45 | navIconHide: { 46 | [theme.breakpoints.up("md")]: { 47 | display: "none" 48 | } 49 | }, 50 | toolbar: theme.mixins.toolbar, 51 | drawerPaper: { 52 | width: drawerWidth, 53 | [theme.breakpoints.up("md")]: { 54 | position: "relative" 55 | } 56 | }, 57 | content: { 58 | flexGrow: 1, 59 | overflow: "auto", 60 | backgroundColor: theme.palette.background.default, 61 | padding: theme.spacing.unit * 3, 62 | minWidth: 0 // So the Typography noWrap works 63 | } 64 | }); 65 | 66 | const anyLightOn = groups => 67 | Object.values(groups).some(group => group.state.any_on); 68 | 69 | const navigation = ( 70 | 71 | 72 | 73 | 74 | 75 | Lights control 76 | 77 | 78 | 79 | 80 | 81 | 82 | Import from bridge 83 | 84 | 85 | 86 | 87 | 88 | 89 | Link device 90 | 91 | 92 | ); 93 | 94 | const App = ({ 95 | classes, 96 | groups, 97 | lights, 98 | onColorTemperatureChange, 99 | onColorChange, 100 | onBrightnessChange, 101 | onStateChange, 102 | onGlobalStateChange 103 | }) => ( 104 | 105 | {({ state, setState }) => ( 106 |
107 | 108 | 109 | setState({ drawer: true })} 111 | className={classes.navIconHide} 112 | > 113 | 114 | 115 | 116 | Hue Emulator 117 | 118 | onGlobalStateChange(!anyLightOn(groups))} 123 | /> 124 | } 125 | label={ 126 | 127 | Turn all {anyLightOn(groups) ? "off" : "on"} 128 | 129 | } 130 | /> 131 | 132 | 133 | 134 | setState({ drawer: false })} 138 | classes={{ 139 | paper: classes.drawerPaper 140 | }} 141 | ModalProps={{ 142 | keepMounted: true // Better open performance on mobile. 143 | }} 144 | > 145 |
146 | {navigation} 147 | 148 | 149 | 150 | setState({ drawer: false })} 154 | classes={{ 155 | paper: classes.drawerPaper 156 | }} 157 | > 158 |
159 | {navigation} 160 | 161 | 162 |
163 |
164 | {Object.keys(groups) 165 | .map(id => ({ ...groups[id], id })) 166 | .map(group => ( 167 | 176 | ))} 177 |
178 |
179 | )} 180 | 181 | ); 182 | 183 | export default withStyles(styles)(App); 184 | -------------------------------------------------------------------------------- /Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels.GD1: -------------------------------------------------------------------------------- 1 | %FSLAX25Y25*% 2 | %MOIN*% 3 | G70* 4 | G01* 5 | G75* 6 | G04 Layer_Color=2752767* 7 | %ADD10R,0.05512X0.04331*% 8 | %ADD11R,0.04331X0.10630*% 9 | %ADD12R,0.42126X0.36221*% 10 | %ADD13R,0.04331X0.05512*% 11 | %ADD14C,0.01200*% 12 | %ADD15C,0.07500*% 13 | %ADD16C,0.10000*% 14 | %ADD17C,0.05000*% 15 | %ADD18C,0.02000*% 16 | %ADD19C,0.02500*% 17 | %ADD20C,0.06000*% 18 | %ADD21R,0.06000X0.06000*% 19 | %ADD22R,0.05906X0.05906*% 20 | %ADD23C,0.05906*% 21 | %ADD24C,0.04724*% 22 | %ADD25C,0.05315*% 23 | %ADD26R,0.05315X0.05315*% 24 | %ADD27R,0.06299X0.06299*% 25 | %ADD28C,0.06299*% 26 | %ADD29R,0.05315X0.05315*% 27 | %ADD30C,0.05000*% 28 | %ADD31C,0.02500*% 29 | %ADD32C,0.00984*% 30 | %ADD33C,0.00787*% 31 | %ADD34C,0.00050*% 32 | %ADD35C,0.01000*% 33 | %ADD36C,0.00591*% 34 | %ADD37R,0.06312X0.05131*% 35 | %ADD38R,0.05131X0.11430*% 36 | %ADD39R,0.42926X0.37021*% 37 | %ADD40R,0.05131X0.06312*% 38 | %ADD41C,0.06800*% 39 | %ADD42R,0.06800X0.06800*% 40 | %ADD43R,0.06706X0.06706*% 41 | %ADD44C,0.06706*% 42 | %ADD45C,0.05524*% 43 | %ADD46C,0.06115*% 44 | %ADD47R,0.06115X0.06115*% 45 | %ADD48R,0.07099X0.07099*% 46 | %ADD49C,0.07099*% 47 | %ADD50R,0.06115X0.06115*% 48 | %ADD51C,0.05800*% 49 | %ADD52C,0.03300*% 50 | %ADD53C,0.00500*% 51 | %ADD54C,0.00667*% 52 | D53* 53 | X60200Y56000D02* 54 | Y60000D01* 55 | X64200D01* 56 | Y56000D01* 57 | X60200D01* 58 | Y46100D02* 59 | Y50100D01* 60 | X64200D01* 61 | Y46100D01* 62 | X60200D01* 63 | X70200Y56000D02* 64 | Y60000D01* 65 | X74200D01* 66 | Y56000D01* 67 | X70200D01* 68 | X69900Y46100D02* 69 | Y50100D01* 70 | X73900D01* 71 | Y46100D01* 72 | X69900D01* 73 | X80100Y56000D02* 74 | Y60000D01* 75 | X84100D01* 76 | Y56000D01* 77 | X80100D01* 78 | Y46000D02* 79 | Y50000D01* 80 | X84100D01* 81 | Y46000D01* 82 | X80100D01* 83 | X90100Y56100D02* 84 | Y60100D01* 85 | X94100D01* 86 | Y56100D01* 87 | X90100D01* 88 | X90200Y46000D02* 89 | Y50000D01* 90 | X94200D01* 91 | Y46000D01* 92 | X90200D01* 93 | X19000Y35500D02* 94 | X17000Y39500D01* 95 | X21000D01* 96 | X19000Y35500D01* 97 | Y65500D02* 98 | X17000Y69500D01* 99 | X21000D01* 100 | X19000Y65500D01* 101 | X45000Y24843D02* 102 | X46000Y25842D01* 103 | X47000D01* 104 | X46000Y26842D01* 105 | X47000Y27843D01* 106 | X46000D01* 107 | X45000Y28842D01* 108 | X44000Y27843D01* 109 | X43000D01* 110 | X44000Y26842D01* 111 | X43000Y25842D01* 112 | X44000D01* 113 | X45000Y24843D01* 114 | X45000Y5158D02* 115 | X46000Y6157D01* 116 | X47000D01* 117 | X46000Y7158D01* 118 | X47000Y8157D01* 119 | X46000D01* 120 | X45000Y9157D01* 121 | X44000Y8157D01* 122 | X43000D01* 123 | X44000Y7158D01* 124 | X43000Y6157D01* 125 | X44000D01* 126 | X45000Y5158D01* 127 | X66500Y6000D02* 128 | X67500Y8000D01* 129 | X66500Y10000D01* 130 | X68500Y9000D01* 131 | X70500Y10000D01* 132 | X69500Y8000D01* 133 | X70500Y6000D01* 134 | X68500Y7000D01* 135 | X66500Y6000D01* 136 | X76500D02* 137 | X77500Y8000D01* 138 | X76500Y10000D01* 139 | X78500Y9000D01* 140 | X80500Y10000D01* 141 | X79500Y8000D01* 142 | X80500Y6000D01* 143 | X78500Y7000D01* 144 | X76500Y6000D01* 145 | X86500D02* 146 | X87500Y8000D01* 147 | X86500Y10000D01* 148 | X88500Y9000D01* 149 | X90500Y10000D01* 150 | X89500Y8000D01* 151 | X90500Y6000D01* 152 | X88500Y7000D01* 153 | X86500Y6000D01* 154 | X59658Y30500D02* 155 | X60658Y31500D01* 156 | X61658D01* 157 | X60658Y32500D01* 158 | X61658Y33500D01* 159 | X60658D01* 160 | X59658Y34500D01* 161 | X58657Y33500D01* 162 | X57657D01* 163 | X58657Y32500D01* 164 | X57657Y31500D01* 165 | X58657D01* 166 | X59658Y30500D01* 167 | X79343Y30500D02* 168 | X80343Y31500D01* 169 | X81343D01* 170 | X80343Y32500D01* 171 | X81343Y33500D01* 172 | X80343D01* 173 | X79343Y34500D01* 174 | X78342Y33500D01* 175 | X77342D01* 176 | X78342Y32500D01* 177 | X77342Y31500D01* 178 | X78342D01* 179 | X79343Y30500D01* 180 | X103500Y67500D02* 181 | Y66500D01* 182 | X105500D01* 183 | Y67500D01* 184 | X106500D01* 185 | Y69500D01* 186 | X105500D01* 187 | Y70500D01* 188 | X103500D01* 189 | Y69500D01* 190 | X102500D01* 191 | Y67500D01* 192 | X103500D01* 193 | X37500Y84000D02* 194 | Y83000D01* 195 | X39500D01* 196 | Y84000D01* 197 | X40500D01* 198 | Y86000D01* 199 | X39500D01* 200 | Y87000D01* 201 | X37500D01* 202 | Y86000D01* 203 | X36500D01* 204 | Y84000D01* 205 | X37500D01* 206 | X104500Y95547D02* 207 | X105500D01* 208 | X106500Y96547D01* 209 | X107500Y95547D01* 210 | X108500D01* 211 | Y96547D01* 212 | X107500Y97547D01* 213 | X108500Y98547D01* 214 | Y99547D01* 215 | X107500D01* 216 | X106500Y98547D01* 217 | X105500Y99547D01* 218 | X104500D01* 219 | Y98547D01* 220 | X105500Y97547D01* 221 | X104500Y96547D01* 222 | Y95547D01* 223 | X66000Y74000D02* 224 | X67000D01* 225 | X68000Y75000D01* 226 | X69000Y74000D01* 227 | X70000D01* 228 | Y75000D01* 229 | X69000Y76000D01* 230 | X70000Y77000D01* 231 | Y78000D01* 232 | X69000D01* 233 | X68000Y77000D01* 234 | X67000Y78000D01* 235 | X66000D01* 236 | Y77000D01* 237 | X67000Y76000D01* 238 | X66000Y75000D01* 239 | Y74000D01* 240 | X120000Y47000D02* 241 | Y46000D01* 242 | X122000D01* 243 | Y47000D01* 244 | X123000D01* 245 | Y49000D01* 246 | X122000D01* 247 | Y50000D01* 248 | X120000D01* 249 | Y49000D01* 250 | X119000D01* 251 | Y47000D01* 252 | X120000D01* 253 | X126000Y41000D02* 254 | Y40000D01* 255 | X128000D01* 256 | Y41000D01* 257 | X129000D01* 258 | Y43000D01* 259 | X128000D01* 260 | Y44000D01* 261 | X126000D01* 262 | Y43000D01* 263 | X125000D01* 264 | Y41000D01* 265 | X126000D01* 266 | X54000Y52000D02* 267 | Y51000D01* 268 | X56000D01* 269 | Y52000D01* 270 | X57000D01* 271 | Y54000D01* 272 | X56000D01* 273 | Y55000D01* 274 | X54000D01* 275 | Y54000D01* 276 | X53000D01* 277 | Y52000D01* 278 | X54000D01* 279 | D54* 280 | X21000Y6500D02* 281 | G03* 282 | X21000Y6500I-2000J0D01* 283 | G01* 284 | X31000D02* 285 | G03* 286 | X31000Y6500I-2000J0D01* 287 | G01* 288 | X103000Y147000D02* 289 | G03* 290 | X103000Y147000I-2000J0D01* 291 | G01* 292 | X93000D02* 293 | G03* 294 | X93000Y147000I-2000J0D01* 295 | G01* 296 | X83000D02* 297 | G03* 298 | X83000Y147000I-2000J0D01* 299 | G01* 300 | X73000D02* 301 | G03* 302 | X73000Y147000I-2000J0D01* 303 | G01* 304 | X63000D02* 305 | G03* 306 | X63000Y147000I-2000J0D01* 307 | G01* 308 | M02* 309 | -------------------------------------------------------------------------------- /Lights/Arduino/MY92XX_RGBW_Light/my92xx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MY92XX LED Driver Arduino library 3.0.0 4 | Based on the C driver by MaiKe Labs 5 | 6 | Copyright (c) 2016 - 2026 MaiKe Labs 7 | Copyright (c) 2017 - Xose Pérez (for the library) 8 | 9 | This program is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program. If not, see . 21 | 22 | */ 23 | 24 | #include "my92xx.h" 25 | 26 | #if ARDUINO_ARCH_ESP8266 27 | 28 | extern "C" { 29 | void os_delay_us(unsigned int); 30 | } 31 | 32 | #elif ARDUINO_ARCH_AVR 33 | 34 | #define os_delay_us delayMicroseconds 35 | 36 | #endif 37 | 38 | void my92xx::_di_pulse(unsigned int times) { 39 | for (unsigned int i = 0; i < times; i++) { 40 | digitalWrite(_pin_di, HIGH); 41 | digitalWrite(_pin_di, LOW); 42 | } 43 | } 44 | 45 | void my92xx::_dcki_pulse(unsigned int times) { 46 | for (unsigned int i = 0; i < times; i++) { 47 | digitalWrite(_pin_dcki, HIGH); 48 | digitalWrite(_pin_dcki, LOW); 49 | } 50 | } 51 | 52 | void my92xx::_write(unsigned int data, unsigned char bit_length) { 53 | 54 | unsigned int mask = (0x01 << (bit_length - 1)); 55 | 56 | for (unsigned int i = 0; i < bit_length / 2; i++) { 57 | digitalWrite(_pin_dcki, LOW); 58 | digitalWrite(_pin_di, (data & mask)); 59 | digitalWrite(_pin_dcki, HIGH); 60 | data = data << 1; 61 | digitalWrite(_pin_di, (data & mask)); 62 | digitalWrite(_pin_dcki, LOW); 63 | digitalWrite(_pin_di, LOW); 64 | data = data << 1; 65 | } 66 | 67 | } 68 | 69 | void my92xx::_set_cmd(my92xx_cmd_t command) { 70 | 71 | // ets_intr_lock(); 72 | 73 | // TStop > 12us. 74 | os_delay_us(12); 75 | 76 | // Send 12 DI pulse, after 6 pulse's falling edge store duty data, and 12 77 | // pulse's rising edge convert to command mode. 78 | _di_pulse(12); 79 | 80 | // Delay >12us, begin send CMD data 81 | os_delay_us(12); 82 | 83 | // Send CMD data 84 | unsigned char command_data = *(unsigned char *) (&command); 85 | for (unsigned char i=0; i<_chips; i++) { 86 | _write(command_data, 8); 87 | } 88 | 89 | // TStart > 12us. Delay 12 us. 90 | os_delay_us(12); 91 | 92 | // Send 16 DI pulse,at 14 pulse's falling edge store CMD data, and 93 | // at 16 pulse's falling edge convert to duty mode. 94 | _di_pulse(16); 95 | 96 | // TStop > 12us. 97 | os_delay_us(12); 98 | 99 | // ets_intr_unlock(); 100 | 101 | } 102 | 103 | void my92xx::_send() { 104 | 105 | #ifdef DEBUG_MY92XX 106 | DEBUG_MSG_MY92XX("[MY92XX] Refresh: %s (", _state ? "ON" : "OFF"); 107 | for (unsigned char channel = 0; channel < _channels; channel++) { 108 | DEBUG_MSG_MY92XX(" %d", _value[channel]); 109 | } 110 | DEBUG_MSG_MY92XX(" )\n"); 111 | #endif 112 | 113 | unsigned char bit_length = 8; 114 | switch (_command.bit_width) { 115 | case MY92XX_CMD_BIT_WIDTH_16: 116 | bit_length = 16; 117 | break; 118 | case MY92XX_CMD_BIT_WIDTH_14: 119 | bit_length = 14; 120 | break; 121 | case MY92XX_CMD_BIT_WIDTH_12: 122 | bit_length = 12; 123 | break; 124 | case MY92XX_CMD_BIT_WIDTH_8: 125 | bit_length = 8; 126 | break; 127 | default: 128 | bit_length = 8; 129 | break; 130 | } 131 | 132 | // ets_intr_lock(); 133 | 134 | // TStop > 12us. 135 | os_delay_us(12); 136 | 137 | // Send color data 138 | for (unsigned char channel = 0; channel < _channels; channel++) { 139 | _write(_state ? _value[channel] : 0, bit_length); 140 | } 141 | 142 | // TStart > 12us. Ready for send DI pulse. 143 | os_delay_us(12); 144 | 145 | // Send 8 DI pulse. After 8 pulse falling edge, store old data. 146 | _di_pulse(8); 147 | 148 | // TStop > 12us. 149 | os_delay_us(12); 150 | 151 | // ets_intr_unlock(); 152 | 153 | } 154 | 155 | // ----------------------------------------------------------------------------- 156 | 157 | unsigned char my92xx::getChannels() { 158 | return _channels; 159 | } 160 | 161 | void my92xx::setChannel(unsigned char channel, unsigned int value) { 162 | if (0 <= channel && channel < _channels) { 163 | _value[channel] = value; 164 | } 165 | } 166 | 167 | unsigned int my92xx::getChannel(unsigned char channel) { 168 | if (0 <= channel && channel < _channels) { 169 | return _value[channel]; 170 | } 171 | return 0; 172 | } 173 | 174 | bool my92xx::getState() { 175 | return _state; 176 | } 177 | 178 | void my92xx::setState(bool state) { 179 | _state = state; 180 | } 181 | 182 | void my92xx::update() { 183 | _send(); 184 | } 185 | 186 | // ----------------------------------------------------------------------------- 187 | 188 | my92xx::my92xx(my92xx_model_t model, unsigned char chips, unsigned char di, unsigned char dcki, my92xx_cmd_t command) { 189 | 190 | _model = model; 191 | _chips = chips; 192 | _pin_di = di; 193 | _pin_dcki = dcki; 194 | _command = command; 195 | 196 | // Init channels 197 | if (_model == MY92XX_MODEL_MY9291) { 198 | _channels = 4 * _chips; 199 | } else if (_model == MY92XX_MODEL_MY9231) { 200 | _channels = 3 * _chips; 201 | } 202 | _value = new uint16_t(_channels); 203 | for (unsigned char i=0; i<_channels; i++) { 204 | _value[i] = 0; 205 | } 206 | 207 | // Init GPIO 208 | pinMode(_pin_di, OUTPUT); 209 | pinMode(_pin_dcki, OUTPUT); 210 | digitalWrite(_pin_di, LOW); 211 | digitalWrite(_pin_dcki, LOW); 212 | 213 | // Clear all duty register 214 | _dcki_pulse(32 * _chips); 215 | 216 | // Send init command 217 | _set_cmd(command); 218 | 219 | DEBUG_MSG_MY92XX("[MY92XX] Initialized\n"); 220 | 221 | } 222 | -------------------------------------------------------------------------------- /Sensors/HueSensorStandardLightSwitch/Arduino/HueSensorStandardLightSwitchV2/HueSensorStandardLightSwitchV2.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include "gpio.h" 7 | #include "user_interface.h" 8 | } 9 | 10 | const char* ssid = "__SSID__"; 11 | const char* password = "__PASSWORD__"; 12 | 13 | 14 | //connect one Button to GPIO2 and one button to RX-Pin (GPIO3) 15 | #define button1_pin 2 16 | #define button2_pin 3 17 | 18 | bool btn1_trig = false; 19 | bool btn1_state = HIGH; 20 | bool btn2_trig = false; 21 | bool btn2_state = HIGH; 22 | 23 | 24 | const char* switchType = "ZGPSwitch"; 25 | 26 | const char* bridgeIp = "192.168.178.45"; 27 | 28 | //Static adresses are no longer needed, because we use a Powersupply! 29 | //DHCP FTW :) 30 | 31 | //#define USE_STATIC_IP //! uncomment to enable Static IP Adress 32 | #ifdef USE_STATIC_IP 33 | IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress 34 | IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP 35 | IPAddress subnet_mask(255, 255, 255, 0); 36 | #endif 37 | 38 | int counter; 39 | byte mac[6]; 40 | 41 | void goingToSleep() { 42 | /*yield(); 43 | delay(100); 44 | ESP.deepSleep(0); 45 | yield();*/ 46 | } 47 | 48 | String macToStr(const uint8_t* mac) { 49 | String result; 50 | for (int i = 0; i < 6; ++i) { 51 | result += String(mac[i], 16); 52 | if (i < 5) 53 | result += ':'; 54 | } 55 | return result; 56 | } 57 | 58 | void sendHttpRequest(int button) { 59 | WiFiClient client; 60 | String url = "/switch?mac=" + macToStr(mac) + "&button=" + button; 61 | client.connect(bridgeIp, 80); 62 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 63 | "Host: " + bridgeIp + "\r\n" + 64 | "Connection: close\r\n\r\n"); 65 | 66 | Serial.println(String("GET ") + url + " HTTP/1.1\r\n" + 67 | "Host: " + bridgeIp + "\r\n" + 68 | "Connection: close\r\n\r\n"); 69 | } 70 | 71 | 72 | void ISR_S1() { 73 | for (int i = 0; i < 5000; i++) 74 | { 75 | _NOP(); 76 | } 77 | 78 | btn1_trig = true; 79 | if (digitalRead(button1_pin) == HIGH) 80 | { 81 | //Serial.println("S1_Rising!"); 82 | btn1_state = HIGH; 83 | } 84 | else 85 | { 86 | //Serial.println("S1_Falling!"); 87 | btn1_state = LOW; 88 | } 89 | } 90 | 91 | 92 | 93 | void ISR_S2() { 94 | 95 | for (int i = 0; i < 5000; i++) 96 | { 97 | _NOP(); 98 | } 99 | 100 | btn2_trig = true; 101 | 102 | if (digitalRead(button2_pin) == HIGH) 103 | { 104 | //Serial.println("S2_Rising!"); 105 | btn2_state = HIGH; 106 | } 107 | else 108 | { 109 | //Serial.println("S2_Falling!"); 110 | btn2_state = LOW; 111 | } 112 | 113 | } 114 | 115 | 116 | void setup() { 117 | 118 | Serial.begin(250000); 119 | Serial.println(); 120 | Serial.println("Setup!"); 121 | 122 | pinMode(0, OUTPUT); 123 | digitalWrite(0, LOW); 124 | 125 | pinMode(16, OUTPUT); 126 | pinMode(button1_pin, INPUT); 127 | pinMode(button2_pin, INPUT); 128 | //pinMode(button3_pin, INPUT); 129 | //pinMode(button4_pin, INPUT); 130 | 131 | 132 | attachInterrupt(digitalPinToInterrupt(button1_pin), ISR_S1, CHANGE); 133 | attachInterrupt(digitalPinToInterrupt(button2_pin), ISR_S2, CHANGE); 134 | 135 | 136 | 137 | digitalWrite(16, LOW); 138 | 139 | WiFi.mode(WIFI_STA); 140 | WiFi.begin(ssid, password); 141 | 142 | #ifdef USE_STATIC_IP 143 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 144 | #endif 145 | 146 | WiFi.macAddress(mac); 147 | 148 | while (WiFi.status() != WL_CONNECTED) { 149 | delay(50); 150 | } 151 | Serial.println("Connected"); 152 | 153 | ArduinoOTA.begin(); 154 | 155 | rst_info *rinfo; 156 | rinfo = ESP.getResetInfoPtr(); 157 | 158 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 159 | 160 | WiFiClient client; 161 | client.connect(bridgeIp, 80); 162 | 163 | //register device 164 | String url = "/switch"; 165 | url += "?devicetype=" + (String)switchType; 166 | url += "&mac=" + macToStr(mac); 167 | 168 | //###Registering device 169 | client.connect(bridgeIp, 80); 170 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 171 | "Host: " + bridgeIp + "\r\n" + 172 | "Connection: close\r\n\r\n"); 173 | } 174 | 175 | if (digitalRead(button1_pin) == LOW) 176 | btn1_state = LOW; 177 | 178 | if (digitalRead(button2_pin) == LOW) 179 | btn2_state = LOW; 180 | 181 | } 182 | 183 | void loop() { 184 | ArduinoOTA.handle(); 185 | delay(1); 186 | 187 | //Serial.println("read..."); 188 | delay(10); 189 | 190 | 191 | if (btn1_trig == true) 192 | { 193 | btn1_trig = false; 194 | if (btn1_state == HIGH) 195 | sendHttpRequest(34); 196 | else 197 | sendHttpRequest(16); 198 | } 199 | 200 | 201 | if (btn2_trig == true) 202 | { 203 | btn2_trig = false; 204 | if (btn2_state == HIGH) 205 | sendHttpRequest(17); 206 | else 207 | sendHttpRequest(18); 208 | } 209 | 210 | /*if (digitalRead(button1_pin) == HIGH && button1_high == false) { 211 | sendHttpRequest(34); 212 | button1_high = true; 213 | } 214 | 215 | if (digitalRead(button1_pin) == LOW && button1_high == true) { 216 | sendHttpRequest(16); 217 | button1_high = false; 218 | } 219 | 220 | if (digitalRead(button2_pin) == HIGH && button2_high == false) { 221 | sendHttpRequest(17); 222 | button2_high = true; 223 | } 224 | 225 | if (digitalRead(button2_pin) == LOW && button2_high == true) { 226 | sendHttpRequest(18); 227 | button2_high = false; 228 | }*/ 229 | 230 | /*if (digitalRead(button2_pin) == HIGH) { 231 | sendHttpRequest(18); 232 | counter = 0; 233 | int i = 0; 234 | while (digitalRead(button2_pin) == HIGH && i < 20) { 235 | delay(20); 236 | i++; 237 | } 238 | } 239 | if (digitalRead(button3_pin) == HIGH) { 240 | sendHttpRequest(17); 241 | counter = 0; 242 | int i = 0; 243 | while (digitalRead(button3_pin) == HIGH && i < 20) { 244 | delay(20); 245 | i++; 246 | } 247 | } 248 | if (digitalRead(button4_pin) == HIGH) { 249 | sendHttpRequest(18); 250 | counter = 0; 251 | int i = 0; 252 | while (digitalRead(button4_pin) == HIGH && i < 20) { 253 | delay(20); 254 | i++; 255 | } 256 | }*/ 257 | /*if (counter == 5000) { 258 | goingToSleep(); 259 | } else { 260 | counter++; 261 | }*/ 262 | 263 | delay(500); 264 | } 265 | -------------------------------------------------------------------------------- /Lights/Arduino/Generic_ON_OFF_device/Generic_ON_OFF_device.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define devicesCount 4 10 | 11 | uint8_t devicesPins[devicesCount] = {12, 13, 14, 5}; 12 | 13 | 14 | //#define USE_STATIC_IP //! uncomment to enable Static IP Adress 15 | #ifdef USE_STATIC_IP 16 | IPAddress strip_ip ( 192, 168, 0, 95); // choose an unique IP Adress 17 | IPAddress gateway_ip ( 192, 168, 0, 1); // Router IP 18 | IPAddress subnet_mask(255, 255, 255, 0); 19 | #endif 20 | 21 | bool device_state[devicesCount]; 22 | byte mac[6]; 23 | 24 | ESP8266WebServer server(80); 25 | 26 | void handleNotFound() { 27 | String message = "File Not Found\n\n"; 28 | message += "URI: "; 29 | message += server.uri(); 30 | message += "\nMethod: "; 31 | message += (server.method() == HTTP_GET) ? "GET" : "POST"; 32 | message += "\nArguments: "; 33 | message += server.args(); 34 | message += "\n"; 35 | for (uint8_t i = 0; i < server.args(); i++) { 36 | message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 37 | } 38 | server.send(404, "text/plain", message); 39 | } 40 | 41 | 42 | void setup() { 43 | EEPROM.begin(512); 44 | 45 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 46 | pinMode(devicesPins[ch], OUTPUT); 47 | } 48 | 49 | #ifdef USE_STATIC_IP 50 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 51 | #endif 52 | 53 | 54 | if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) { 55 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 56 | digitalWrite(devicesPins[ch], OUTPUT); 57 | } 58 | 59 | } 60 | 61 | WiFiManager wifiManager; 62 | wifiManager.autoConnect("New Hue Device"); 63 | 64 | WiFi.macAddress(mac); 65 | 66 | // Port defaults to 8266 67 | // ArduinoOTA.setPort(8266); 68 | 69 | // Hostname defaults to esp8266-[ChipID] 70 | // ArduinoOTA.setHostname("myesp8266"); 71 | 72 | // No authentication by default 73 | // ArduinoOTA.setPassword((const char *)"123"); 74 | 75 | ArduinoOTA.begin(); 76 | 77 | 78 | server.on("/set", []() { 79 | uint8_t device; 80 | 81 | for (uint8_t i = 0; i < server.args(); i++) { 82 | if (server.argName(i) == "light") { 83 | device = server.arg(i).toInt() - 1; 84 | } 85 | else if (server.argName(i) == "on") { 86 | if (server.arg(i) == "True" || server.arg(i) == "true") { 87 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 88 | EEPROM.write(0, 1); 89 | EEPROM.commit(); 90 | } 91 | device_state[device] = true; 92 | digitalWrite(devicesPins[device], HIGH); 93 | } 94 | else { 95 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 96 | EEPROM.write(0, 0); 97 | EEPROM.commit(); 98 | } 99 | device_state[device] = false; 100 | digitalWrite(devicesPins[device], LOW); 101 | } 102 | } 103 | } 104 | server.send(200, "text/plain", "OK, state:" + device_state[device]); 105 | }); 106 | 107 | server.on("/get", []() { 108 | uint8_t light; 109 | if (server.hasArg("light")) 110 | light = server.arg("light").toInt() - 1; 111 | String power_status; 112 | power_status = device_state[light] ? "true" : "false"; 113 | server.send(200, "text/plain", "{\"on\": " + power_status + "}"); 114 | }); 115 | 116 | server.on("/detect", []() { 117 | server.send(200, "text/plain", "{\"hue\": \"bulb\",\"lights\": " + String(devicesCount) + ",\"modelid\": \"Plug 01\",\"mac\": \"" + String(mac[5], HEX) + ":" + String(mac[4], HEX) + ":" + String(mac[3], HEX) + ":" + String(mac[2], HEX) + ":" + String(mac[1], HEX) + ":" + String(mac[0], HEX) + "\"}"); 118 | }); 119 | 120 | server.on("/", []() { 121 | float transitiontime = 100; 122 | if (server.hasArg("startup")) { 123 | if ( EEPROM.read(1) != server.arg("startup").toInt()) { 124 | EEPROM.write(1, server.arg("startup").toInt()); 125 | EEPROM.commit(); 126 | } 127 | } 128 | 129 | for (uint8_t device = 0; device < devicesCount; device++) { 130 | 131 | if (server.hasArg("on")) { 132 | if (server.arg("on") == "true") { 133 | device_state[device] = true; 134 | digitalWrite(devicesPins[device], HIGH); 135 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 136 | EEPROM.write(0, 1); 137 | EEPROM.commit(); 138 | } 139 | } else { 140 | device_state[device] = false; 141 | digitalWrite(devicesPins[device], LOW); 142 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 143 | EEPROM.write(0, 0); 144 | EEPROM.commit(); 145 | } 146 | } 147 | } 148 | } 149 | if (server.hasArg("reset")) { 150 | ESP.reset(); 151 | } 152 | 153 | 154 | String http_content = ""; 155 | http_content += ""; 156 | http_content += ""; 157 | http_content += ""; 158 | http_content += ""; 159 | http_content += "Light Setup"; 160 | http_content += ""; 161 | http_content += ""; 162 | http_content += ""; 163 | http_content += "
"; 164 | http_content += "

Light Setup

"; 165 | http_content += "
"; 166 | http_content += "
"; 167 | http_content += ""; 168 | http_content += "ON"; 169 | http_content += "OFF"; 170 | http_content += "
"; 171 | http_content += "
"; 172 | http_content += ""; 173 | http_content += ""; 174 | http_content += ""; 175 | 176 | server.send(200, "text/html", http_content); 177 | 178 | }); 179 | 180 | 181 | server.onNotFound(handleNotFound); 182 | 183 | server.begin(); 184 | } 185 | 186 | void loop() { 187 | ArduinoOTA.handle(); 188 | server.handleClient(); 189 | } 190 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![license](https://img.shields.io/badge/license-GPLv3%2FApache%202.0%2FCC%20BY--SA%204.0-blue.svg)](https://github.com/mariusmotea/diyHue/blob/master/LICENSE.md) 2 | [![CommitActivity](https://img.shields.io/github/commit-activity/y/mariusmotea/diyhue.svg)](https://github.com/mariusmotea/diyHue/commits/master) 3 | [![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.com) 4 | 5 | [![JoinSlack](https://img.shields.io/badge/Join%20us-on%20Slack-green.svg)](https://slackinvite.squishedmooo.com/) [![SlackStatus](https://slackinvite.squishedmooo.com/badge.svg?colorB=8ebc06)](https://slackinvite.squishedmooo.com/) 6 | 7 | [![TravisCI](https://api.travis-ci.com/mariusmotea/diyHue.svg?branch=master)](https://travis-ci.com/mariusmotea/diyHue) 8 | [![DockerPulls](https://img.shields.io/docker/pulls/diyhue/core.svg)](https://hub.docker.com/r/diyhue/core/) 9 | 10 | [![](https://images.microbadger.com/badges/version/diyhue/core:arm.svg)](https://microbadger.com/images/diyhue/core:arm "Get your own version badge on microbadger.com") 11 | [![](https://images.microbadger.com/badges/image/diyhue/core:arm.svg)](https://microbadger.com/images/diyhue/core:arm "Get your own image badge on microbadger.com") 12 | 13 | [![](https://images.microbadger.com/badges/version/diyhue/core:amd64.svg)](https://microbadger.com/images/diyhue/core:amd64 "Get your own version badge on microbadger.com") 14 | [![](https://images.microbadger.com/badges/image/diyhue/core:amd64.svg)](https://microbadger.com/images/diyhue/core:amd64 "Get your own image badge on microbadger.com") 15 | 16 | This project emulates a Philips Hue Bridge that is able to control ZigBee lights (using Raspbee module, original Hue Bridge or IKEA Tradfri Gateway), Mi-Light bulbs (using MiLight Hub), Neopixel strips (WS2812B and SK6812) and any cheap ESP8266 based bulb by replacing the firmware with a custom one. It is written in python and will run on all small devices such as the RaspberryPi. Arduino sketches are provided for the 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 also be applied to the bridge emulator. 17 | 18 | ![diyHue ecosystem](https://raw.githubusercontent.com/mariusmotea/diyHue/develop/Images/hue-map.png) 19 | 20 | 21 | ### Requirements: 22 | - python 3 23 | - nmap package for esp8266 lights autodiscover ```sudo apt install nmap``` 24 | - python ws4py package only if zigbee module is used ```sudo pip install ws4py``` 25 | 26 | 27 | ## To Do 28 | - ~~Working directly with ZigBee lights, switches and sensors with RaspBee module~~ 29 | - ~~control IKEA Trådfri lights from HUE applications~~ 30 | - ~~Create ESP8266 bridge device to add MI Lights to Hue Bridge emulator.~~ 31 | - ~~On/Off control for other home devices using virtual lights~~ 32 | - Alarm (~~email notification~~ + eps8266 horn) 33 | - ~~Hue Entertainment support~~ 34 | 35 | ## Working HUE futures: 36 | - Control lights (all functions) 37 | - Control groups (all functions) 38 | - Scenes (all functions) 39 | - Routines 40 | - Wake up 41 | - Go to sleep 42 | - Switches (custom esp8266 switches) 43 | - Autodiscover lights 44 | - Hue entertainment 45 | 46 | ## Working devices and applications: 47 | - Amazon Alexa (control only the lights) 48 | - Logitech Harmony 49 | - Tradfri Gateway 50 | - Hue Bridge (original + other emulators) 51 | - Home Assistant 52 | - Domoticz 53 | - Openhab 54 | - Philips Ambilight TV's 55 | - Kodi Hue Ambilight 56 | - Jeedom 57 | - Hue Sync for PC 58 | 59 | ## Working smartphone applications: 60 | - Hue (official application) 61 | - hueManic 62 | - OnSwitch 63 | - HueSwitcher 64 | - LampShade 65 | 66 | ## Not working: 67 | - Home & Away future from Hue app (require remote api) 68 | - Google Home (require remote api) 69 | - Eneco Toon (very likely it use cloud service detection) 70 | 71 | ## Supported lights: 72 | - WS2812B and SK6812 smart led strips 73 | - MiLight 74 | - Yeelight 75 | - LYT8266 76 | - Phillips Hue 77 | - Ikea Tradfri 78 | - Pwm RGB-CCT 79 | - Pwm RGBW 80 | - Pwm RGB 81 | - Pwm CCT 82 | - Pwm Dimming (up to 6 lights for every esp8266) 83 | - On/Off plugs/lights (up to 6 lights for every esp8266) 84 | - On/Off 433Mhz devices (multiple devices for every esp8266) 85 | 86 | ## Stability: 87 | All the lights in my house are controlled by this solution so the stability is very important to me as there is no turning back to classic illumination (all switches were replaces with Ikea Tradfri Remotes and holes covered). However I don't use all the functions, so i'm unable to perform full tests on every change. What I do currently use is Deconz with all Tradfri devices (lights + sensors), Xiaomi Motion Sensor, native ESP8266 bulbs, ESP8266 + WS2812B strips and Xiaomi YeeLight color bulb. 88 | 89 | Please submit [ in this issue](https://github.com/mariusmotea/diyHue/issues/27) or on our [slack team](https://slackinvite.squishedmooo.com/) any other device/application that is working with this emulator. 90 | 91 | Check the [Wiki page](https://github.com/mariusmotea/diyHue/wiki) for more details 92 | 93 | [![Youtube Demo](https://img.youtube.com/vi/c6MsG3oIehY/0.jpg)](https://www.youtube.com/watch?v=c6MsG3oIehY) 94 | 95 | I push updates fast so if you want to be notified, just watch this repo 96 | 97 | Contributions are welcome 98 | 99 | Hue living color light project for 3D printing: https://www.thingiverse.com/thing:2773413 100 | 101 | ## qtHue 102 | You may want to see also my new project [qtHue](https://github.com/mariusmotea/qtHue) that provide a simple user interface for controlling the lights. 103 | ![qtHue](https://github.com/mariusmotea/qtHue/blob/master/Screenshot.png?raw=true) 104 | 105 | Credits: 106 | - [@avinashraja98](https://github.com/avinashraja98) - Hue Entertainment server 107 | - Federico Zivolo ([@FezVrasta](https://github.com/FezVrasta)) Internal WebGUI 108 | - [@J3n50m4t](https://github.com/J3n50m4t) - Yeelight integration 109 | - Martin Černý ([@mcer12](https://github.com/mcer12)) - Yeelight color bulb 110 | - probonopd https://github.com/probonopd/ESP8266HueEmulator 111 | - sidoh https://github.com/sidoh/esp8266_milight_hub 112 | - StefanBruens https://github.com/StefanBruens/ESP8266_new_pwm 113 | - Cédric @ticed35 for linkbutton implementation 114 | - [@cheesemarathon](https://github.com/cheesemarathon) - Help with Docker images 115 | - [@Mevel](https://github.com/Mevel) - 433Mhz devices 116 | - [@Nikfinn99](https://github.com/Nikfinn99) - PCB designs 117 | --------------------------------------------------------------------------------