├── source ├── _static │ └── 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 ├── Devices │ ├── Lights │ │ ├── PlatformIO │ │ │ ├── SK6812HueStrip │ │ │ │ ├── .gitignore │ │ │ │ ├── lib │ │ │ │ │ └── readme.txt │ │ │ │ ├── platformio.ini │ │ │ │ └── .travis.yml │ │ │ ├── WS2812BHueStrip │ │ │ │ ├── .gitignore │ │ │ │ ├── platformio.ini │ │ │ │ ├── lib │ │ │ │ │ └── readme.txt │ │ │ │ └── .travis.yml │ │ │ ├── Generic_CCT_Light │ │ │ │ ├── .gitignore │ │ │ │ ├── lib │ │ │ │ │ └── readme.txt │ │ │ │ ├── platformio.ini │ │ │ │ └── .travis.yml │ │ │ ├── Generic_RGBW_Light │ │ │ │ ├── .gitignore │ │ │ │ ├── lib │ │ │ │ │ └── readme.txt │ │ │ │ ├── platformio.ini │ │ │ │ └── .travis.yml │ │ │ ├── Generic_RGB_Light │ │ │ │ ├── .gitignore │ │ │ │ ├── lib │ │ │ │ │ └── readme.txt │ │ │ │ ├── platformio.ini │ │ │ │ └── .travis.yml │ │ │ └── Generic_RGB_CCT_Light │ │ │ │ ├── .gitignore │ │ │ │ ├── lib │ │ │ │ └── readme.txt │ │ │ │ ├── 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 │ │ │ ├── Sonoff_S20 │ │ │ ├── images │ │ │ │ ├── SONOFF.jpg │ │ │ │ └── sonoff_s20.jpg │ │ │ └── Sonoff_S20.ino │ │ │ ├── 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 │ │ │ └── Generic_ON_OFF_device_433Mhz.ino │ │ │ ├── fastLED_SM16726_RGBW_Bulb │ │ │ └── README.md │ │ │ ├── MY92XX_RGBW_Light │ │ │ ├── my92xx.h │ │ │ └── my92xx.cpp │ │ │ └── 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 │ │ ├── HueMotionSensor │ │ ├── README.md │ │ └── HueMotionSensor.ino │ │ ├── HueTapSwitch │ │ └── HueTapSwitch.ino │ │ └── HueDimmerSwitch │ │ └── HueDimmerSwitch.ino ├── lights │ ├── index.rst │ ├── yeelight.rst │ ├── hue.rst │ ├── milight.rst │ ├── ikea.rst │ ├── raspbee.rst │ ├── mqtt.rst │ ├── diylights.rst │ └── esphome.rst ├── AddFuncts │ ├── index.rst │ ├── alarm.rst │ ├── entertainment.rst │ ├── domoticz.rst │ ├── CMDArgs.rst │ ├── sensors.rst │ ├── homekit.rst │ └── debug.rst ├── index.rst ├── uninstall.rst ├── configuration.rst ├── faq.rst ├── development.rst ├── conf.py └── getting_started.rst ├── .gitignore ├── .github ├── pull_request_template.md └── stale.yml ├── Makefile ├── README.md └── make.bat /source/_static/images/Hue_Tap: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | /source/.doctrees 3 | _build 4 | -------------------------------------------------------------------------------- /source/Devices/Lights/PlatformIO/SK6812HueStrip/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /source/Devices/Lights/PlatformIO/WS2812BHueStrip/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /source/Devices/Lights/PlatformIO/Generic_CCT_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /source/Devices/Lights/PlatformIO/Generic_RGBW_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /source/Devices/Lights/PlatformIO/Generic_RGB_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /source/_static/images/2_Lamps.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/2_Lamps.jpeg -------------------------------------------------------------------------------- /source/_static/images/Switch1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Switch1.jpg -------------------------------------------------------------------------------- /source/_static/images/Switch2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Switch2.jpg -------------------------------------------------------------------------------- /source/_static/images/hue-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/hue-map.png -------------------------------------------------------------------------------- /source/_static/images/lightGUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/lightGUI.png -------------------------------------------------------------------------------- /source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/Project Outputs for LED_Controller_4Channels/LED_Controller_4Channels-macro.APR_LIB: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/Devices/Lights/PlatformIO/Generic_RGB_CCT_Light/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /source/_static/images/test_room.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/test_room.jpg -------------------------------------------------------------------------------- /source/_static/images/Motion_Sensor_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Motion_Sensor_1.jpg -------------------------------------------------------------------------------- /source/_static/images/Motion_Sensor_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Motion_Sensor_2.jpg -------------------------------------------------------------------------------- /source/_static/images/Motion_Sensor_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Motion_Sensor_3.jpg -------------------------------------------------------------------------------- /source/_static/images/Motion_Sensor_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Motion_Sensor_4.jpg -------------------------------------------------------------------------------- /source/_static/images/Ring_Lamp_Inner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Ring_Lamp_Inner.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.PrjPcbStructure: -------------------------------------------------------------------------------- 1 | Record=TopLevelDocument|FileName=LED_Controller_4Channels.SchDoc 2 | -------------------------------------------------------------------------------- /source/_static/images/3-Boxes_Lamp_Controller.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/3-Boxes_Lamp_Controller.jpeg -------------------------------------------------------------------------------- /source/_static/images/3-Boxes_Lamp_Controller2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/3-Boxes_Lamp_Controller2.jpeg -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | labels: PR 3 | --- 4 | 5 | * Description of changes 6 | Please write a short description of the changes or addtions you have made. 7 | -------------------------------------------------------------------------------- /source/_static/images/sensor_power_consumption_alive.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/sensor_power_consumption_alive.jpg -------------------------------------------------------------------------------- /source/_static/images/strip_wiring_to_wemos_d1_mini.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/strip_wiring_to_wemos_d1_mini.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Sonoff_S20/images/SONOFF.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Sonoff_S20/images/SONOFF.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Sonoff_S20/images/sonoff_s20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Sonoff_S20/images/sonoff_s20.jpg -------------------------------------------------------------------------------- /source/Devices/Sensors/HueSensorStandardLightSwitch/InApp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Sensors/HueSensorStandardLightSwitch/InApp.png -------------------------------------------------------------------------------- /source/_static/images/Color_Dream_bulb_with_flash_replaced.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Color_Dream_bulb_with_flash_replaced.jpg -------------------------------------------------------------------------------- /source/_static/images/MiLight_RGB_CCT_converted_to_ESP-12S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/MiLight_RGB_CCT_converted_to_ESP-12S.jpg -------------------------------------------------------------------------------- /source/_static/images/sensor_power_consumption_deep_sleep.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/sensor_power_consumption_deep_sleep.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_RGBW_Light/images/Over.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_RGBW_Light/images/Over.jpg -------------------------------------------------------------------------------- /source/Devices/Sensors/HueSensorStandardLightSwitch/Wiring_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Sensors/HueSensorStandardLightSwitch/Wiring_1.jpg -------------------------------------------------------------------------------- /source/Devices/Sensors/HueSensorStandardLightSwitch/Wiring_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Sensors/HueSensorStandardLightSwitch/Wiring_2.jpg -------------------------------------------------------------------------------- /source/_static/images/Hue_Motion_sensor_circuit_prototype_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Hue_Motion_sensor_circuit_prototype_v2.png -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_RGBW_Light/images/Under.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_RGBW_Light/images/Under.jpg -------------------------------------------------------------------------------- /source/_static/images/Hue_Tap-Dimmer_switch_circuit_prototype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/_static/images/Hue_Tap-Dimmer_switch_circuit_prototype.png -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_Dimmable_Light/images/Over.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_Dimmable_Light/images/Over.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_Dimmable_Light/images/Under.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_Dimmable_Light/images/Under.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_RGBW_Light/images/schematic.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_RGBW_Light/images/schematic.JPG -------------------------------------------------------------------------------- /source/Devices/Sensors/HueSensorStandardLightSwitch/Placed_in_a_wall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Sensors/HueSensorStandardLightSwitch/Placed_in_a_wall.jpg -------------------------------------------------------------------------------- /source/Devices/Sensors/HueSensorStandardLightSwitch/Wiring_schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Sensors/HueSensorStandardLightSwitch/Wiring_schematic.png -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB1.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/PCB2.jpg -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Fritzing.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Fritzing.JPG -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Schematic.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/images/Schematic.JPG -------------------------------------------------------------------------------- /source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.cam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.cam -------------------------------------------------------------------------------- /source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.PcbDoc -------------------------------------------------------------------------------- /source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shivasiddharth/ReadTheDocs/master/source/Devices/Lights/PCB_Files/ESP8266-01_4Channels/LED_Controller_4Channels.SchDoc -------------------------------------------------------------------------------- /source/lights/index.rst: -------------------------------------------------------------------------------- 1 | Lights 2 | ====== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: Contents: 7 | 8 | diylights 9 | ikea 10 | milight 11 | hue 12 | esphome 13 | yeelight 14 | raspbee 15 | mqtt 16 | -------------------------------------------------------------------------------- /source/AddFuncts/index.rst: -------------------------------------------------------------------------------- 1 | Additional Functions 2 | ==================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: Contents: 7 | 8 | alarm 9 | sensors 10 | entertainment 11 | debug 12 | homekit 13 | domoticz 14 | CMDArgs -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/lights/yeelight.rst: -------------------------------------------------------------------------------- 1 | YeeLight 2 | ======== 3 | 4 | Yeelight bulbs are automatically discovered and added to hue emulator on light search performed from Hue app. 5 | The light must be first connected to the local WiFi network and LAN control must be enabled from the YeeLight app. 6 | This can be done from the eject icon located in bottom right corner of the app. 7 | If light IP address changes, you need to perform a new light search in order to update the IP address for all the lights. To avoid this, you can give each light a static IP address in your routers settings. 8 | -------------------------------------------------------------------------------- /source/lights/hue.rst: -------------------------------------------------------------------------------- 1 | Hue Bridge Lights 2 | ================= 3 | 4 | To import the lights from your genuine Phillips Hue bridge, first open ``http://{bridgeIP}/hue`` and enter the IP of your genuine bridge. 5 | You can find the IP of your genuine bridge in the Hue app. 6 | Before clicking "Save" press the link button on your genuine Hue Bridge. 7 | The total number of lights copied to Bridge Emulator will be displayed. 8 | These lights will now be available in the app to add to a room. 9 | Note: Room configuration is not imported from the genuine Hue Bridge, only the lights. 10 | -------------------------------------------------------------------------------- /source/AddFuncts/alarm.rst: -------------------------------------------------------------------------------- 1 | Alarm 2 | ===== 3 | 4 | It is possible to receive email notifications when a motion sensor is triggered while the alarm is active. At this moment the alarm can be configured manually by editing the file /opt/hue-emulator/config.json while the service is stopped. You need to set just your email address and to switch the "on" value between true or false to enable / disable the alarm. 5 | 6 | ``` 7 | "emulator": { 8 | "alarm": { 9 | "email": "example@gmail.com", 10 | "lasttriggered": 1585935069, 11 | "on": false 12 | } 13 | } 14 | ``` 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = HueBridgeEmulator 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /source/index.rst: -------------------------------------------------------------------------------- 1 | .. diyHue documentation master file, created by 2 | sphinx-quickstart on Fri Jun 29 17:15:41 2018. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to diyHue's documentation! 7 | ============================================= 8 | 9 | .. toctree:: 10 | :maxdepth: 3 11 | :caption: Contents: 12 | 13 | getting_started 14 | configuration 15 | lights/index 16 | AddFuncts/index 17 | uninstall 18 | faq 19 | development 20 | .. refs/modules 21 | 22 | 23 | Indices and tables 24 | ================== 25 | 26 | * :ref:`genindex` 27 | * :ref:`modindex` 28 | * :ref:`search` 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # diyHue Read The Docs 2 | 3 | [![Build Status](https://readthedocs.org/projects/diyhue/badge/?version=latest)](https://readthedocs.org/projects/diyhue/) 4 | 5 | Documentation for diyHue 6 | 7 | All documentation and instructions can be found over at [diyhue.readthedocs.io](https://diyhue.readthedocs.io/) 8 | 9 | For the main repo please see [here](https://github.com/diyhue/diyHue) 10 | 11 | Please feel free to contribute with PR's 12 | 13 | ## Changing the docs 14 | 15 | Run this command to start a live refresh server of the docs on `http://localhost:8000` for easier checking your changes. 16 | 17 | `docker run -it -v "$(pwd)"/source:/web -u $(id -u):$(id -g) -p 8000:8000 dldl/sphinx-server` 18 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 7 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 2 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | - in progress 10 | - enhancement 11 | # Label to use when marking an issue as stale 12 | staleLabel: stale 13 | # Comment to post when marking an issue as stale. Set to `false` to disable 14 | markComment: > 15 | This issue has been automatically marked as stale because it has not had 16 | recent activity. It will be closed in 2 days if no further activity occurs. Thank you 17 | for your contributions. 18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: > 20 | This issue has been automatically closed as it has not had any recent activity. 21 | Thank you for your contributions. 22 | -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | set SPHINXPROJ=HueBridgeEmulator 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /source/AddFuncts/entertainment.rst: -------------------------------------------------------------------------------- 1 | Hue Entertainment 2 | ================= 3 | 4 | The DTLS server used by Hue Entertainment is a 3rd party service build in C. Precompiled binaries are provided for x86_64, i686 (x86), aarch64, arm64 (e.g. Rock Pi) and arm (e.g. Raspberry Pi) architectures. For any other architecture the service must be compiled from source. It would be good if the compiled executable could be uploaded with a pull request for other architectures. 5 | 6 | Compilation Commands 7 | -------------------- 8 | 9 | :: 10 | 11 | wget https://github.com/ARMmbed/mbedtls/archive/1ab9b5714852c6810c0a0bfd8c3b5c60a9a15482.zip 12 | unzip 1ab9b5714852c6810c0a0bfd8c3b5c60a9a15482.zip 13 | cd mbedtls-1ab9b5714852c6810c0a0bfd8c3b5c60a9a15482/ 14 | wget https://raw.githubusercontent.com/diyhue/diyHue/master/BridgeEmulator/ssl_server2_diyhue.c 15 | make no_test 16 | gcc -I./include ssl_server2_diyhue.c -o ssl_server2_diyhue -L./library -lmbedtls -lmbedx509 -lmbedcrypto 17 | 18 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/uninstall.rst: -------------------------------------------------------------------------------- 1 | Uninstall 2 | ========= 3 | 4 | Why on earth would you want to uninstall diyHue! All joking aside, uninstall is super easy if you need a fresh install, your moving over to new hardware or maybe diyHue just isnt for you. 5 | 6 | Docker Uninstall 7 | ---------------- 8 | 9 | You can easily remove the diyHue docker container and image with one command:: 10 | 11 | sudo docker rm diyHue && sudo docker rmi diyhue/core 12 | 13 | Host Uninstall 14 | -------------- 15 | 16 | Automatic Uninstall 17 | ~~~~~~~~~~~~~~~~~~~ 18 | 19 | If you used the automatic install method, just run the following command to uninstall:: 20 | 21 | curl -s https://raw.githubusercontent.com/diyhue/diyHue/master/BridgeEmulator/easy_uninstall.sh | sudo bash /dev/stdin 22 | 23 | 24 | This will stop diyHue, remove the astral python library, remove the diyHue files and remove the diyHue service. 25 | It will leave the packages installed by diyHue in case they are used by other services. These packages are: 26 | 27 | * unzip 28 | * nmap 29 | * python3 30 | * python3-requests 31 | * python3-ws4py 32 | * python3-setuptools 33 | 34 | Remove these at your own discression. 35 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/lights/milight.rst: -------------------------------------------------------------------------------- 1 | MiLight Hub 2 | =========== 3 | 4 | With the circuit from `here `_ you will be able to control MiLight bulbs that work using a proprietary 2.4 GHz protocol. 5 | The linked project provides a REST API that was integrated into diyHue. 6 | 7 | Import MiLight lights 8 | --------------------- 9 | 10 | Open ``http://{bridgeIP}/milight``, complete the form and click Save. You need to repeat this step for every light as there is no way to retrieve the list of lights from the MiLight hub. 11 | 12 | Convert MiLight bulbs to Wi-Fi 13 | ------------------------------ 14 | 15 | It is also possible to convert MiLight bulbs to WiFi using any ESP8266 module. 16 | I have successfully converted one RGB-CCT bulb with an ESP-12S module (picture available) in less than 30 minutes. 17 | From original circuit board you will just need the 3.3V regulator (not recommended because of low power), the led drivers (NPN transistors for colored leds, MOSFET for white leds) and any nearby resistors that are connected to the transistors base/gate, other components can be disconnected/removed. 18 | You must remove the IC that controls the LED's or it will conflict with the ESP8266 module. 19 | I connected GPIO12/13/14 to the resistors that point to the base of RGB transistors and GPIO4/5 directly to the MOSFET gates (not through the resistors because these are connected to ground). 20 | For stability an extra capacitor is required on the power line. -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/lights/ikea.rst: -------------------------------------------------------------------------------- 1 | IKEA Tradfri 2 | ============ 3 | 4 | There are two ways to interact with IKEA Tradfri devices, one method is to use the Tradfri Gateway and you will be able to control just the lights. 5 | The second method is to use the Raspbee module that offers the flowing advantages: 6 | 7 | * The ability to setup multiple sensors and switched in same room, while the Tradfri application only gives the possibility to configure just one switch or sensor per group (room). 8 | * Add custom rules for sensors and switches 9 | * Tradfri Motion Sensors are emulated as Hue Motion Sensor giving the possibility to choose different scenes based on the time (ex: max brightness between 08:00 - 23:00 and Nightlight scene between 23:00 and 08:00) Also the light will be dimmed for 30 seconds before being turned off and you can configure from Hue application how much time the light will stay on after motion was triggered. 10 | * The Tradfri Remote can be emulated as a Hue Dimmer Switch or Hue Tap Switch that can apply color scenes. 11 | 12 | Import Trafri Gateway Lights 13 | ---------------------------- 14 | 15 | Open ``http://{bridgeIP}/tradfri`` Type in the Ikea bridge IP and security key and click "Save". 16 | You should then see all the lights paired with Tradfri bridge in Hue application. 17 | Important: You must make sure you are using the correct coap-client-linux binary for your system architecture or this will fail. 18 | 19 | Raspbee Module Setup 20 | -------------------- 21 | 22 | For instructions on controlling Ikea Tradfri lights with the Raspbee module, see the :ref:`raspbee` module page. 23 | -------------------------------------------------------------------------------- /source/AddFuncts/domoticz.rst: -------------------------------------------------------------------------------- 1 | Domoticz 2 | ======== 3 | 4 | diy-hue includes native support for Domoticz lights/switches. 5 | As there is no discover process provided by domotics, they must be added manually into ''config.json''. 6 | 7 | Add a new light(s) 8 | ------------------- 9 | 1. Stop the hue-emulator service 10 | 11 | ``sudo systemctl stop hue-emulator`` 12 | 13 | 2. Save ''config.json'' 14 | 15 | ``sudo cp /opt/hue-emulator/config.json /opt/hue-emulator/config.json.bak`` 16 | 17 | 3. Edit config.json 18 | 19 | ``sudo nano /opt/hue-emulator/config.json`` 20 | 21 | - Add light adress 22 | 23 | .. code-block:: JSON 24 | 25 | { 26 | "lights_address": { 27 | "3": { 28 | "ip": "192.168.1.100:8080", 29 | "light_id": "281", 30 | "protocol": "domoticz" 31 | }, 32 | }, 33 | } 34 | 35 | ``ip`` is the Domoticz host 36 | 37 | ``light_id`` is the light/switch IDX 38 | 39 | ``"protocol": "domoticz"`` allow diyhue to format the correct request 40 | 41 | - Add light details for hue app 42 | 43 | .. code-block:: JSON 44 | 45 | { 46 | "lights": { 47 | "3": { 48 | "manufacturername": "domoticz", 49 | "name": "Eettafel", 50 | "state": { 51 | "alert": "none", 52 | "on": true, 53 | "reachable": true 54 | }, 55 | "swversion": "V1.04.12", 56 | "type": "On/Off plug-in unit", 57 | "uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx" 58 | }, 59 | } 60 | } 61 | 62 | 4. Restart the hue-emulator service 63 | 64 | ``sudo systemctl start hue-emulator`` 65 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/configuration.rst: -------------------------------------------------------------------------------- 1 | .. _config: 2 | 3 | Configuration 4 | ============= 5 | 6 | Most configuration can be done either in the Hue app or in the diyHue web UI. 7 | 8 | Pairing diyHue with the Hue app 9 | ------------------------------- 10 | 11 | To pair a new device to diyHue, first head to ``http://{IP_ADDRESS}/hue/linkbutton``. The default username is `Hue` with a password of `Hue` also. At this point you should open the Hue app on your phone and start searching for hubs. To speed this up you can click the `Help` button and then enter the IP address of your diyHue device. Once the bridge has been detected, click the green `Set up` button. At this point, the app will prompt you to press the link button on your Hue bridge. To do so, click the `Activate` button on the web page you loaded at the start. The Hue app should now prompt you through the rest of the setup. For specific details on how to setup specific lights, browse the lights section in the navigation bar to the left. 12 | 13 | Configuration File 14 | ------------------ 15 | 16 | The entire configuration is saved in the ``config.json`` file. Changes to the bridge are saved in real time or every hour automatically. In case of state change of lights or sensors the configuration is not saved to avoid extensive writes to the SD card on Raspberry Pi's. If you want to save the configuration manually, you can do so by accessing ``http://{emualtor ip}/save``. If you want to manually edit the configuration file to change any kind of resource, I recommend backing up the file first. In case the configuration file is corrupted, you can look for backups that are done automatically every Sunday night. 17 | 18 | Adding lights 19 | ------------- 20 | 21 | Depending on which lights you plan to use, the setup method will vary. For detailed setup instructions, please chose the correct type of light you wish to setup from the menu on the left. 22 | 23 | 24 | Reset Linkbutton Password 25 | ------------- 26 | 27 | If you forgot the changed Password, edit the ``linkbutton_auth`` Field in ``config.json`` to the default Hash ``SHVlOkh1ZQ==``. 28 | This will reset the Password to ``Hue:Hue`` 29 | 30 | 31 | -------------------------------------------------------------------------------- /source/AddFuncts/CMDArgs.rst: -------------------------------------------------------------------------------- 1 | Command Line Arguments 2 | ====================== 3 | 4 | diyHue has several options that can be passed in at run time. These options allow easy, and more complex configuration of diyHue. 5 | 6 | IP 7 | -- 8 | The IP argument can be used to provide the IP address of the host machine running diyHue. If you use this argument, you must also provide a value for the MAC argument. This argument is typically only used with docker. 9 | If you are running diyHue directly on the host (easy install), then use the following format:: 10 | 11 | --ip XX.XX.XX.XX 12 | 13 | If you are running diyHue with our docker image, then add the following environment variable to your docker run command:: 14 | 15 | -e "IP=XX.XX.XX.XX" 16 | 17 | MAC 18 | --- 19 | The MAC argument can be used to provide the MAC address of the host machine running diyHue. If you use this argument, you must also provide a value for the IP argument. This argument is typically only used with docker. 20 | If you are running diyHue directly on the host (easy install), then use the following format:: 21 | 22 | --mac XX:XX:XX:XX 23 | 24 | If you are running diyHue with our docker image, then add the following environment variable to your docker run command:: 25 | 26 | -e "MAC=XX:XX:XX:XX" 27 | 28 | IP Range 29 | -------- 30 | The IP Range argument can be used to set the IP range for light discovery. The default range is 0 to 255. 31 | If you are running diyHue directly on the host (easy install), then use the following format:: 32 | 33 | --ip_range , 34 | 35 | If you are running diyHue with our docker image, then add the following environment variable to your docker run command:: 36 | 37 | -e "IP_RANGE=," 38 | 39 | Deconz 40 | ------ 41 | The Deconz argument can be used to provide the IP address of your Deconz instance if it is not hosted on the same device as diyHue. 42 | If you are running diyHue directly on the host (easy install), then use the following format:: 43 | 44 | --deconz XX:XX:XX:XX 45 | 46 | If you are running diyHue with our docker image, then add the following environment variable to your docker run command:: 47 | 48 | -e "DECONZ=XX:XX:XX:XX" 49 | 50 | Debug 51 | ----- 52 | For instructions on the debug argument please see :ref:`debug` -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/AddFuncts/sensors.rst: -------------------------------------------------------------------------------- 1 | Sensors 2 | ======= 3 | 4 | For ZigBee sensors and switches check :ref:`raspbee` module 5 | 6 | Switches 7 | -------- 8 | 9 | The Dimmer Switch and Tap Switch are almost identical, the only difference is that dimmer switch can control the lights without the bridge (for this reason bridgeIp is declared as an array to setup more IP's), and the button codes are different. 10 | 11 | Circuit diagram 12 | ~~~~~~~~~~~~~~~ 13 | 14 | .. figure:: /_static/images/Hue_Tap-Dimmer_switch_circuit_prototype.png 15 | 16 | 17 | Device Prototype 18 | ~~~~~~~~~~~~~~~~ 19 | 20 | .. figure:: /_static/images/Switch1.jpg 21 | 22 | How it works 23 | ~~~~~~~~~~~~ 24 | 25 | When the switch powers on, a GET request will be sent to the bridge , ex: ``http://{bridgeIP}/switch?mac=xx:xx:xx:xx:xx:xx&devicetype=ZLLSwitch`` 26 | The bridge will then check based on MAC address if the switch is already registered or not. 27 | If not, it will register making it available for configuration in the Hue application. 28 | After 3-5 seconds the ESP8266 will enter deep sleep mode and will consume less than 20uA. 29 | On every button press there will be a short negative pulse on ESP8266 RST pin that will wake up the device. 30 | It will then read the input pins to check what button was pressed and send a request like this: ``http://{bridgeIP}/switch?mac=xx:xx:xx:xx:xx:xx&button=1000`` 31 | The bridge will then process all rules and perform the action configured for this button. 32 | 33 | Motion Sensor 34 | ------------- 35 | 36 | Circuit diagram 37 | ~~~~~~~~~~~~~~~ 38 | 39 | .. figure:: /_static/images/Hue_Motion_sensor_circuit_prototype_v2.png 40 | 41 | Device prototype 42 | ~~~~~~~~~~~~~~~~ 43 | 44 | .. figure:: /_static/images/Motion_Sensor_1.jpg 45 | 46 | How is working 47 | ~~~~~~~~~~~~~~ 48 | 49 | Exactly like the switches, the sensor will be registered on power on with a GET request: ``http://{bridgeIP}/switch?mac=xx:xx:xx:xx:xx:xx&devicetype=ZLLPresence`` and configuration can then be done from the Hue application. 50 | The ESP8266 will wake up from deep sleep on every PIR positive signal on the GPIO5 pin and every 20 minutes to send the light sensor data. 51 | Request example: ``http://{bridgeIP}/switch?mac=xx:xx:xx:xx:xx:xx&lightlevel=46900&dark=false&daylight=true&presence=true`` 52 | It is important to choose a low power PIR that can run on batteries for many months. 53 | The PIR used in my example is an HC-SR501, that is very common in DIY projects. 54 | To increase the battery life I removed the 3.3V voltage regulator as this is not needed with batteries. 55 | GPIO4 will output +3V only when the light level is measured in order to lower the power consumption. 56 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/AddFuncts/homekit.rst: -------------------------------------------------------------------------------- 1 | Home Kit 2 | ======== 3 | Follow the below instuctions to setup diyHue to work with Home Kit 4 | 5 | 6 | 1. Install homebridge 7 | 2. Install homebridge-hue 8 | 3. Prepare config.json for homebridge with an intial homebridge-hue plugin setup (need to be modified after the first run, see next step):: 9 | 10 | config.json initial: 11 | { 12 | "bridge": { 13 | "name": "HB_Diy_Hue", 14 | "username": "mac-address homebridge", 15 | "port": 51838, 16 | "pin": "whatyouwant" 17 | }, 18 | "accessories": [], 19 | "platforms": [ 20 | { 21 | "platform": "Hue", 22 | "users": { 23 | "": "" 24 | }, 25 | "hosts": "put_here_the_ip_diyhue_bridge", 26 | "sensors": false, 27 | "nativeHomeKitSensors": true, 28 | "nativeHomeKitLights": false, 29 | "excludeSensorTypes": ["Daylight", "CLIP", "Geofence"], 30 | "lights": true 31 | } 32 | ] 33 | } 34 | 35 | 4. Run home bridge for the first time (not via service). Run ``sudo homebridge -U /`` (showed before), in my example:: 36 | 37 | sudo homebridge -U /home/pi/.homediyhue 38 | 39 | [2/3/2019, 9:24:33 AM] [Hue] RpiHue: HA-Bridge v1810251352, api v1.24.0 40 | [2/3/2019, 9:24:33 AM] [Hue] RpiHue: bridge request 2: post / {"devicetype":"homebridge-hue#raspberrypi"} 41 | [2/3/2019, 9:24:33 AM] [Hue] RpiHue: bridge error 101: link button not pressed 42 | [2/3/2019, 9:24:33 AM] [Hue] RpiHue: press link button on the bridge to create a user 43 | 44 | 5. Go to diyhue webpage and simulate the link button pressed (http://{IP_ADDRESS}/hue/linkbutton):: 45 | 46 | [2/3/2019, 9:24:48 AM] [Hue] RpiHue: created user - please edit config.json and restart homebridge 47 | "platforms": [ 48 | { 49 | "platform": "Hue", 50 | "users": { 51 | "B827EBFFFE959284": "470a0c52e89555f73b11904c84af6192" 52 | } 53 | } 54 | ] 55 | 56 | 6. Stop homebridge 57 | 7. Edit config.json with this user 58 | 8. Start homebridge (via service or manually):: 59 | 60 | [2/3/2019, 9:24:48 AM] [Hue] RpiHue: 5 accessories 61 | [2/3/2019, 9:24:48 AM] [Hue] masked debug info dumped to /home/pi/.homediyhue/homebridge-hue.json.gz 62 | [2/3/2019, 9:24:48 AM] [Hue] Initializing platform accessory 'RpiHue'... 63 | [2/3/2019, 9:24:48 AM] [Hue] RpiHue: 2 services 64 | [2/3/2019, 9:24:48 AM] [Hue] Initializing platform accessory 'Hue bulb Plug 01'... 65 | [2/3/2019, 9:24:48 AM] [Hue] Initializing platform accessory 'Hue bulb Plug 01 2'... 66 | [2/3/2019, 9:24:48 AM] [Hue] Initializing platform accessory 'Hue bulb Plug 01 3'... 67 | [2/3/2019, 9:24:48 AM] [Hue] Initializing platform accessory 'Hue bulb Plug 01 4'... -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/faq.rst: -------------------------------------------------------------------------------- 1 | FAQ 2 | === 3 | 4 | What lights can I use with this project? 5 | ---------------------------------------- 6 | 7 | * MiLight 8 | * Yeelight 9 | * LYT8266 10 | * Phillips Hue 11 | * Ikea Tradfri 12 | 13 | The following can be controlled with an ESP8266 or ESP32: 14 | 15 | * WS2812B and SK6812 smart led strips 16 | * Pwm RGB-CCT LEDs 17 | * Pwm RGBW LEDs 18 | * Pwm RGB LEDs 19 | * Pwm CCT LEDs 20 | * Pwm Dimming (up to 6 lights for every esp8266) 21 | * On/Off plugs/lights (up to 6 lights for every esp8266) 22 | * On/Off 433Mhz devices (multiple devices for every esp8266) 23 | 24 | Do I need a Phillips Hue Bridge to control genuine Phillips Hue bulbs with diyHue? 25 | ---------------------------------------------------------------------------------- 26 | 27 | Hue bulbs use the zigbee radios to comunicate so you either need a genuine Phillips Hue Bridge or a raspbee module. 28 | 29 | Unable to Connect - diyHue Bridge is detected but i can´t pair! 30 | --------------------------------------------------------------- 31 | 32 | In order to connect with diyHue, you need to pair the APP with the Bridge Emulator. 33 | Press Activate Button of diyHue found here `http://{IP_ADDRESS}/hue/linkbutton` with default credentials `Hue:Hue` 34 | 35 | If Hue Essentials app (or other 3rd party hue apps) can pair with the bridge emulator but official Hue app not most likely you have a [bad https certificate](https://diyhue.readthedocs.io/en/latest/AddFuncts/debug.html#https-certificate-check) 36 | 37 | For further Info see the :ref:`config` page 38 | 39 | My Phillips TV detects diyHue Bridge but I am unable establish a connection 40 | --------------------------------------------------------------------------- 41 | 42 | Follow the instructions for pairing. In addition it can help to disconnect your `Internet` for a short period to make sure the TV performs a local Network search instead of using remote API of Phillips. 43 | 44 | What do I need to use IKEA Tradfri devices? 45 | ------------------------------------------- 46 | 47 | IKEA Tradfri bulbs can be controlled when paired with an IKEA hub. If you wish to use IKEA switches then you must use the Raspbee module. This will enable you to control both the IKEA lights and switches without an IKEA hub. 48 | 49 | App XYZ doesn't work! 50 | --------------------- 51 | 52 | Not all apps for Phillips Hue work out of the box with diyHue. If you are unable to pair the app with diyHue automatically, try looking for a manual pair option in the app. If that fails then open an issue here on GitHub. We will try our best to to get your app to work but due to the lack of support for the remote API with diyHue, some apps will never work. 53 | 54 | My Google Home / Google Assistant doesn't find diyHue! 55 | ------------------------------------------------------ 56 | 57 | Google Assistant uses the remote API to find your Hue bridge. The remote API is not supported by diyHue. At the moment it looks like it never will. However, don't despair. There is an option to get it to work. [Home Assistant](https://www.home-assistant.io/) is software used to provide a unified hub for all your smart devices. It has support for diyHue and Google Assistant, so you can import your diyHue lights into Home Assistant and use Google Assistant to control them via Home Assistant. There are plenty of instructions on the Home Assistant website however details on Phillips Hue with home assistant can be found [here](https://www.home-assistant.io/components/hue/) and details on Google Assistant [here](https://www.home-assistant.io/components/google_assistant/) If you need more help, ask on our Slack chat or on the Home Assistant forums. 58 | 59 | -------------------------------------------------------------------------------- /source/Devices/Sensors/HueTapSwitch/HueTapSwitch.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 = "MikroTik"; 11 | const char* password = "nustiuceparola"; 12 | 13 | #define button1_pin 1 14 | #define button2_pin 3 15 | #define button3_pin 5 16 | #define button4_pin 4 17 | 18 | const char* switchType = "ZGPSwitch"; 19 | 20 | const char* bridgeIp = "192.168.10.200"; 21 | 22 | IPAddress strip_ip ( 192, 168, 10, 96); 23 | IPAddress gateway_ip ( 192, 168, 10, 1); 24 | IPAddress subnet_mask(255, 255, 255, 0); 25 | 26 | int counter; 27 | byte mac[6]; 28 | 29 | void goingToSleep() { 30 | yield(); 31 | delay(100); 32 | ESP.deepSleep(0); 33 | yield(); 34 | } 35 | 36 | String macToStr(const uint8_t* mac) { 37 | String result; 38 | for (int i = 0; i < 6; ++i) { 39 | result += String(mac[i], 16); 40 | if (i < 5) 41 | result += ':'; 42 | } 43 | return result; 44 | } 45 | 46 | void sendHttpRequest(int button) { 47 | WiFiClient client; 48 | String url = "/switch?mac=" + macToStr(mac) + "&button=" + button; 49 | client.connect(bridgeIp, 80); 50 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 51 | "Host: " + bridgeIp + "\r\n" + 52 | "Connection: close\r\n\r\n"); 53 | } 54 | 55 | void setup() { 56 | pinMode(16, OUTPUT); 57 | pinMode(button1_pin, INPUT); 58 | pinMode(button2_pin, INPUT); 59 | pinMode(button3_pin, INPUT); 60 | pinMode(button4_pin, INPUT); 61 | digitalWrite(16, LOW); 62 | 63 | WiFi.mode(WIFI_STA); 64 | WiFi.begin(ssid, password); 65 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 66 | WiFi.macAddress(mac); 67 | 68 | while (WiFi.status() != WL_CONNECTED) { 69 | delay(50); 70 | } 71 | 72 | ArduinoOTA.begin(); 73 | 74 | rst_info *rinfo; 75 | rinfo = ESP.getResetInfoPtr(); 76 | 77 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 78 | 79 | WiFiClient client; 80 | client.connect(bridgeIp, 80); 81 | 82 | //register device 83 | String url = "/switch"; 84 | url += "?devicetype=" + (String)switchType; 85 | url += "&mac=" + macToStr(mac); 86 | 87 | //###Registering device 88 | client.connect(bridgeIp, 80); 89 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 90 | "Host: " + bridgeIp + "\r\n" + 91 | "Connection: close\r\n\r\n"); 92 | } 93 | 94 | } 95 | 96 | void loop() { 97 | ArduinoOTA.handle(); 98 | delay(1); 99 | 100 | if (digitalRead(button1_pin) == HIGH) { 101 | sendHttpRequest(34); 102 | counter = 0; 103 | int i = 0; 104 | while (digitalRead(button1_pin) == HIGH && i < 20) { 105 | delay(20); 106 | i++; 107 | } 108 | } 109 | if (digitalRead(button2_pin) == HIGH) { 110 | sendHttpRequest(16); 111 | counter = 0; 112 | int i = 0; 113 | while (digitalRead(button2_pin) == HIGH && i < 20) { 114 | delay(20); 115 | i++; 116 | } 117 | } 118 | if (digitalRead(button3_pin) == HIGH) { 119 | sendHttpRequest(17); 120 | counter = 0; 121 | int i = 0; 122 | while (digitalRead(button3_pin) == HIGH && i < 20) { 123 | delay(20); 124 | i++; 125 | } 126 | } 127 | if (digitalRead(button4_pin) == HIGH) { 128 | sendHttpRequest(18); 129 | counter = 0; 130 | int i = 0; 131 | while (digitalRead(button4_pin) == HIGH && i < 20) { 132 | delay(20); 133 | i++; 134 | } 135 | } 136 | if (counter == 5000) { 137 | goingToSleep(); 138 | } else { 139 | counter++; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/lights/raspbee.rst: -------------------------------------------------------------------------------- 1 | .. _raspbee: 2 | 3 | Raspbee 4 | ======= 5 | 6 | The Raspbee module is used with Deconz, the software dedicated for this module that provides an API similar to the Hue API 7 | 8 | ZigBee Devices With Built In Support 9 | ------------------------------------ 10 | 11 | * Trandri Remote 12 | * Tradfri Wireless Dimmer 13 | * Tradfri Motion Sensor 14 | * Tradfri On/Off Switch 15 | * Xiaomi Aquara Motion Sensor 16 | 17 | \*Other devices can still be manually configured to perform actions with custom Hue rules 18 | 19 | Deconz installation 20 | ------------------- 21 | 22 | * Execute raspi-config and turn off the serial login as this will enter in conflict with deconz (do not disable also the hardware serial port) 23 | * Follow the steps from here: https://github.com/dresden-elektronik/deconz-rest-plugin for the deconz.deb package download and installation (no need to install dev package or compile the code) 24 | 25 | * Edit the Deconz systemd script to bind on port 8080: ``sudo nano /lib/systemd/system/deconz.service`` replace ``--http-port=80`` with ``--http-port=8080 --upnp=0 --ws-port=8081`` or you can use the following command: 26 | 27 | sed -i 's/ --http-port=80$/ --http-port=8080 --ws-port=8081 --upnp=0/' /lib/systemd/system/deconz.service 28 | 29 | * Start the Deconz service, browse to ``http://{hue emulator ip}:8080`` and add all zigbee devices. 30 | This is done by clicking "Open network" in settings and then reset the devices. Don't configure any device in deconz. 31 | * Start hue emulator (you should see in the logs the import of all zigbee devices) 32 | * Click "Unlock Gateway" in the Deconz settings to allow hue emulator to register, then open ``http://{hue emulator ip}/deconz`` to automatically register the bridge emulator with Deconz. 33 | In order to configure IKEA switches you must first configure the rooms. 34 | 35 | Updates to the Deconz service made in your OS for any reason will most likely overwrite the changes made to the deconz systemctl service file. To prevent that from happening, you can divert updates to that file. If installing in Raspian/Ubuntu/Debian, use the following command to divert updates to that file to another location: 36 | 37 | sudo dpkg-divert --package deconz --add --rename --divert /home//new_deconz.service /lib/systemd/system/deconz.service 38 | 39 | This will divert the new service file to your home directory under the filename "new_deconz.service". Then you can determine if there is anything that has changed. 40 | 41 | 42 | Sensors and Switches Configuration 43 | ---------------------------------- 44 | 45 | * Tradfri Motion Sensors will be added as Hue Motion Sensors and must be configured from the Hue application. 46 | With the original rules in place it will work like a Hue Motion Sensor (ex: dim the light with 30 second before turning off) 47 | * Tradfri Dimmers and Tradfri Remotes must be configured from ``http://{hue emulator ip}/deconz`` 48 | Tradfri Remotes can be configured to work on a specified room (the same as it was developed to) or to act as if it is a Hue Dimmer Switch or Hue Tap Switch, where they must be configured from the Hue application. 49 | When this happens the Tradfri Remote will not be displayed anymore in the Deconz configuration page and can be added back only by removing it from Hue application. 50 | The Tradfri Remote has 5 buttons, while both hue switches have only 4 so for the Tap Switch the top button doesn't perform any action. 51 | For the Dimming Switch, the center button is "On", up/down are brightness up/down and both left/right buttons will turn of the light. 52 | The reason I added the feature to transform the Tradfri Remote into a Hue Switch is because it can then switch scenes where color lights are used, while the Tradfri Remote was designed just to change the brightness and color temperature. 53 | -------------------------------------------------------------------------------- /source/Devices/Sensors/HueDimmerSwitch/HueDimmerSwitch.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include "gpio.h" 7 | #include "user_interface.h" 8 | } 9 | 10 | #define button1_pin 1 11 | #define button2_pin 3 12 | #define button3_pin 5 13 | #define button4_pin 4 14 | 15 | const char* ssid = "MikroTik"; 16 | const char* password = "nustiuceparola"; 17 | const char* switchType = "ZLLSwitch"; 18 | const char* bridge_user = "9f552609847c0dd1f372fee9b76330035b7a3bb1"; 19 | 20 | //Set bridge ip or ip of every light controlled by this switch 21 | 22 | const char* bridgeIp[] = {"192.168.10.200"}; 23 | 24 | IPAddress strip_ip ( 192, 168, 10, 96); 25 | IPAddress gateway_ip ( 192, 168, 10, 1); 26 | IPAddress subnet_mask(255, 255, 255, 0); 27 | 28 | int counter; 29 | byte mac[6]; 30 | 31 | void goingToSleep() { 32 | yield(); 33 | delay(100); 34 | ESP.deepSleep(0); 35 | yield(); 36 | } 37 | 38 | String macToStr(const uint8_t* mac) { 39 | String result; 40 | for (int i = 0; i < 6; ++i) { 41 | result += String(mac[i], 16); 42 | if (i < 5) 43 | result += ':'; 44 | } 45 | return result; 46 | } 47 | 48 | void sendHttpRequest(int button) { 49 | WiFiClient client; 50 | for (int i = 0; i < sizeof(bridgeIp) / 4; i++) { 51 | String url = "/switch?mac=" + macToStr(mac) + "&button=" + button; 52 | client.connect(bridgeIp[i], 80); 53 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 54 | "Host: " + bridgeIp[0] + "\r\n" + 55 | "Connection: close\r\n\r\n"); 56 | } 57 | } 58 | 59 | void setup() { 60 | pinMode(16, OUTPUT); 61 | pinMode(button1_pin, INPUT); 62 | pinMode(button2_pin, INPUT); 63 | pinMode(button3_pin, INPUT); 64 | pinMode(button4_pin, INPUT); 65 | digitalWrite(button1_pin, LOW); 66 | digitalWrite(button2_pin, LOW); 67 | digitalWrite(button3_pin, LOW); 68 | digitalWrite(button4_pin, LOW); 69 | digitalWrite(16, LOW); 70 | 71 | WiFi.mode(WIFI_STA); 72 | WiFi.begin(ssid, password); 73 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 74 | WiFi.macAddress(mac); 75 | 76 | while (WiFi.status() != WL_CONNECTED) { 77 | delay(50); 78 | } 79 | 80 | ArduinoOTA.begin(); 81 | 82 | rst_info *rinfo; 83 | rinfo = ESP.getResetInfoPtr(); 84 | 85 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 86 | 87 | WiFiClient client; 88 | client.connect(bridgeIp[0], 80); 89 | 90 | //register device 91 | String url = "/switch"; 92 | url += "?devicetype=" + (String)switchType; 93 | url += "&mac=" + macToStr(mac); 94 | 95 | //###Registering device 96 | client.connect(bridgeIp[0], 80); 97 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 98 | "Host: " + bridgeIp[0] + "\r\n" + 99 | "Connection: close\r\n\r\n"); 100 | } 101 | 102 | } 103 | 104 | void loop() { 105 | ArduinoOTA.handle(); 106 | delay(1); 107 | 108 | if (digitalRead(button1_pin) == HIGH) { 109 | sendHttpRequest(1000); 110 | counter = 0; 111 | int i = 0; 112 | while (digitalRead(button1_pin) == HIGH && i < 30) { 113 | delay(20); 114 | i++; 115 | } 116 | } 117 | if (digitalRead(button2_pin) == HIGH) { 118 | counter = 0; 119 | int i = 0; 120 | while (digitalRead(button2_pin) == HIGH && i < 30) { 121 | delay(20); 122 | i++; 123 | } 124 | if (i < 30) { 125 | sendHttpRequest(2000); 126 | } else { 127 | sendHttpRequest(2001); 128 | } 129 | } 130 | if (digitalRead(button3_pin) == HIGH) { 131 | counter = 0; 132 | int i = 0; 133 | while (digitalRead(button3_pin) == HIGH && i < 30) { 134 | delay(20); 135 | i++; 136 | } 137 | if (i < 30) { 138 | sendHttpRequest(3000); 139 | } else { 140 | sendHttpRequest(3001); 141 | } 142 | } 143 | if (digitalRead(button4_pin) == HIGH) { 144 | sendHttpRequest(4000); 145 | counter = 0; 146 | int i = 0; 147 | while (digitalRead(button4_pin) == HIGH && i < 30) { 148 | delay(20); 149 | i++; 150 | } 151 | } 152 | if (counter == 5000) { 153 | goingToSleep(); 154 | } else { 155 | counter++; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/AddFuncts/debug.rst: -------------------------------------------------------------------------------- 1 | .. _debug: 2 | 3 | Enable debug mode 4 | ================= 5 | 6 | Host install 7 | ------------ 8 | 1. Stop the hue-emulator service:: 9 | 10 | sudo systemctl stop hue-emulator 11 | 12 | 2. Change directory to the application home directory:: 13 | 14 | cd /opt/hue-emulator 15 | 16 | 3. Start the script with ``sudo ./HueEmulator3.py --debug`` 17 | 18 | Try to avoid unnecessary debugging output generated by other devices that you know work correctly fine such as home assistant, and working lights. The easiest method to prevent this is by temporally turning the working devices off. It is important to save a backup of your config file before entering debug mode and if any changes to your config are made while in debug mode to save the config manually before issuing the keyboard interrupt to stop debug mode. You can do this by issuing an HTTP request from your browser to ``http://IP.OF.DIY.HUE/save``. This will save your configuration file to the DIYHue working directory (/opt/hue-emulator/ if using the easy-install method). 19 | 20 | Docker install 21 | -------------- 22 | 23 | Add the following environment variable to your docker run command. This can be set to `true` or `false` to turn debug on or off. :: 24 | 25 | -e "DEBUG=true" 26 | 27 | HTTPS certificate check 28 | ----------------------- 29 | 30 | To test the https certificate you can use this command from the terminal of the device running diyHue:: 31 | 32 | curl https://127.0.0.1/api/nouser/config -v -k 33 | 34 | 35 | Sample output:: 36 | 37 | pi@raspberrypi:~ $ curl https://127.0.0.1/api/nouser/config -v -k 38 | * Trying 127.0.0.1... 39 | * TCP_NODELAY set 40 | * Connected to 127.0.0.1 (127.0.0.1) port 443 (#0) 41 | * ALPN, offering h2 42 | * ALPN, offering http/1.1 43 | * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 44 | * successfully set certificate verify locations: 45 | * CAfile: /etc/ssl/certs/ca-certificates.crt 46 | CApath: /etc/ssl/certs 47 | * TLSv1.2 (OUT), TLS header, Certificate Status (22): 48 | * TLSv1.2 (OUT), TLS handshake, Client hello (1): 49 | * TLSv1.2 (IN), TLS handshake, Server hello (2): 50 | * TLSv1.2 (IN), TLS handshake, Certificate (11): 51 | * TLSv1.2 (IN), TLS handshake, Server key exchange (12): 52 | * TLSv1.2 (IN), TLS handshake, Server finished (14): 53 | * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): 54 | * TLSv1.2 (OUT), TLS change cipher, Client hello (1): 55 | * TLSv1.2 (OUT), TLS handshake, Finished (20): 56 | * TLSv1.2 (IN), TLS change cipher, Client hello (1): 57 | * TLSv1.2 (IN), TLS handshake, Finished (20): 58 | * SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256 59 | * ALPN, server did not agree to a protocol 60 | * Server certificate: 61 | * subject: C=NL; O=Philips Hue; CN=b827ebfffec8991c 62 | * start date: Jul 22 17:40:03 2018 GMT 63 | * expire date: Jul 19 17:40:03 2028 GMT 64 | * issuer: C=NL; O=Philips Hue; CN=b827ebfffec8991c 65 | * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. 66 | > GET /api/nouser/config HTTP/1.1 67 | > Host: 127.0.0.1 68 | > User-Agent: curl/7.52.1 69 | > Accept: */* 70 | > 71 | < HTTP/1.1 200 OK 72 | < Server: nginx 73 | < Date: Tue, 11 Sep 2018 12:43:26 GMT 74 | < Content-type: application/json 75 | < Content-Length: 227 76 | < 77 | * Curl_http_done: called premature == 0 78 | * Connection #0 to host 127.0.0.1 left intact 79 | {"name":"Philips hue","factorynew":false,"mac":"b8:27:eb:c8:99:1c","datastoreversion":70,"bridgeid":"B827EBFFFEC8991C","modelid":"BSB002","swversion":"1806051111","replacesbridgeid":null,"starterkitid":"","apiversion":"1.24.0"} 80 | 81 | Here are the important lines:: 82 | 83 | issuer: C=NL; O=Philips Hue; CN=b827ebfffec8991c 84 | 85 | and :: 86 | 87 | {"name":"Philips hue","factorynew":false,"mac":"b8:27:eb:c8:99:1c","datastoreversion":70,"bridgeid":"B827EBFFFEC8991C","modelid":"BSB002","swversion":"1806051111","replacesbridgeid":null,"starterkitid":"","apiversion":"1.24.0"} 88 | 89 | The ``CN`` value of the certificate must be the same as the ``bridgeid`` key from the json output. This must also represent the mac address of the main interface with ``fffe`` in the middle. 90 | -------------------------------------------------------------------------------- /source/Devices/Sensors/HueMotionSensor/HueMotionSensor.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern "C" { 5 | #include "gpio.h" 6 | #include "user_interface.h" 7 | } 8 | 9 | /// BEGIN SETUP SENSOR PARAMETERS /// 10 | const char* ssid = "wifi-name"; 11 | const char* password = "wifi-pass"; 12 | 13 | //Set bridge ip 14 | const char* bridgeIp = "192.168.10.200"; 15 | 16 | // seconds to sleep between light level is mesured and sent to bridge 17 | const int sleepTimeS = 1200; // 1200 seconds => 20 minutes 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 | 22 | IPAddress strip_ip ( 192, 168, 10, 97); 23 | IPAddress gateway_ip ( 192, 168, 10, 1); 24 | IPAddress subnet_mask(255, 255, 255, 0); 25 | 26 | /// END SETUP SENSOR PARAMETERS //// 27 | 28 | int counter; 29 | byte rtcStore[6]; 30 | 31 | 32 | void goingToSleep(int seepSeconds, bool sleepRfMode) { 33 | yield(); 34 | delay(100); 35 | if (sleepRfMode) { 36 | ESP.deepSleep(seepSeconds * 1000000, WAKE_RF_DISABLED); 37 | } else { 38 | ESP.deepSleep(1, WAKE_RF_DEFAULT); 39 | } 40 | yield(); 41 | delay(200); 42 | } 43 | 44 | void sendRequest(uint8_t op) { 45 | byte mac[6]; 46 | WiFi.mode(WIFI_STA); 47 | WiFi.begin(ssid, password); 48 | WiFi.config(strip_ip, gateway_ip, subnet_mask); 49 | WiFi.macAddress(mac); 50 | 51 | while (WiFi.status() != WL_CONNECTED) { 52 | delay(20); 53 | } 54 | 55 | String url = "/switch?mac=" + macToStr(mac); 56 | if (op == 0) { 57 | url += "&devicetype=ZLLPresence"; 58 | } else if (op == 1) { 59 | rtcStore[1] = 1; 60 | url += "&presence=true"; 61 | } else if (op == 2) { 62 | rtcStore[1] = 0; 63 | url += "&presence=false"; 64 | } else if (op == 3) { 65 | 66 | int lightlevel = ((255 * rtcStore[4]) + rtcStore[5]) * lightmultiplier; 67 | 68 | url += "&lightlevel="; 69 | url += String(lightlevel); 70 | if (lightlevel < 16000) { 71 | url += "&dark=true"; 72 | rtcStore[3] = 1; 73 | } else { 74 | url += "&dark=false"; 75 | rtcStore[3] = 0; 76 | } 77 | 78 | if (lightlevel > 23000) { 79 | url += "&daylight=true"; 80 | } else { 81 | url += "&daylight=false"; 82 | } 83 | } 84 | 85 | WiFiClient client; 86 | 87 | client.connect(bridgeIp, 80); 88 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 89 | "Host: " + bridgeIp + "\r\n" + 90 | "Connection: close\r\n\r\n"); 91 | } 92 | 93 | String macToStr(const uint8_t* mac) { 94 | String result; 95 | for (uint8_t i = 0; i < 6; ++i) { 96 | result += String(mac[i], 16); 97 | if (i < 5) 98 | result += ':'; 99 | } 100 | return result; 101 | } 102 | 103 | 104 | void setup() { 105 | system_rtc_mem_read(64, rtcStore, 6); 106 | if (rtcStore[0] == 1) { 107 | // wake up in rf mode 108 | rtcStore[0] = 0; 109 | sendRequest(rtcStore[1]); 110 | system_rtc_mem_write(64, rtcStore, 6); 111 | if (rtcStore[2] == 1) { 112 | goingToSleep(30, true); 113 | } else { 114 | goingToSleep(sleepTimeS, true); 115 | } 116 | 117 | } else { 118 | //wake up in non rf mode to avoid rf interferences 119 | pinMode(4, OUTPUT); 120 | digitalWrite(4, HIGH); 121 | pinMode(5, INPUT); 122 | pinMode(A0, INPUT); 123 | rtcStore[0] = 1; 124 | 125 | rst_info *rinfo; 126 | rinfo = ESP.getResetInfoPtr(); 127 | uint8_t operation; 128 | 129 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 130 | operation = 0; //register the senzor 131 | } else if (digitalRead(5) == HIGH) { 132 | if (rtcStore[2] == 0) { 133 | operation = 1; 134 | rtcStore[2] = 1; 135 | } else { 136 | if (rtcStore[3] == 0) { 137 | operation = 3; 138 | } else { 139 | //check again in 30seconds 140 | goingToSleep(30, true); 141 | } 142 | } 143 | } else { 144 | if (rtcStore[2] == 0) { 145 | operation = 3; 146 | } else { 147 | operation = 2; 148 | rtcStore[2] = 0; 149 | } 150 | delay(1000); 151 | } 152 | 153 | if (operation == 3) { 154 | int luminance = analogRead(A0); 155 | rtcStore[4] = 0; 156 | while (luminance > 255) { 157 | luminance -= 255; 158 | rtcStore[4]++; 159 | } 160 | rtcStore[5] = luminance; 161 | } 162 | 163 | rtcStore[1] = operation; 164 | 165 | system_rtc_mem_write(64, rtcStore, 6); 166 | 167 | //reboot in rf mode 168 | goingToSleep(0, false); 169 | 170 | } 171 | } 172 | 173 | void loop() { } 174 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/lights/mqtt.rst: -------------------------------------------------------------------------------- 1 | MQTT - zigbee2mqtt 2 | ================== 3 | 4 | diyHue has support for lights that are controlled over mqtt. It uses the auto discovery feature described `here `_. 5 | This emulator connects directly to mqtt (after you set the correct parameters), and subscribes to the defined auto discovery prefix. 6 | 7 | You'll still need to look for lights (in the app), but any lights that emit an auto discovery message are added once you search for lights. 8 | 9 | For this to work you'll need to setup a mqtt server, that is out of the scope of this documentation. 10 | 11 | Configuration 12 | ------------- 13 | 14 | You will need to start the bridge once (this will generate/update the config) and then you'll need to edit the ``config.json`` file. 15 | 16 | If you're using **docker** to run diyHue, make sure you **stop the container** before changing the config file. 17 | 18 | This is only a small portion of the config, but you should look for the ``emulator`` => ``mqtt`` section. It should look like this: 19 | 20 | .. code-block:: JSON 21 | 22 | { 23 | "emulator": { 24 | "alarm": { 25 | "email": "", 26 | "lasttriggered": 100000, 27 | "on": false 28 | }, 29 | "mqtt": { 30 | "discoveryPrefix": "homeassistant", 31 | "enabled": false, 32 | "mqttPassword": "", 33 | "mqttPort": 1883, 34 | "mqttServer": "mqtt", 35 | "mqttUser": "" 36 | } 37 | }, 38 | } 39 | 40 | Now fill in the correct values: 41 | 42 | * ``discoveryprefix``: don't change 43 | * ``enabled``: **"true"** (if ``mqttServer`` isn't set correctly, hue-emulator will not be reachable) 44 | * ``mqttUser``, ``mqttPassword`` and ``mqttPort``: Match the setting on the mqtt server. Default values are already filled in. 45 | * ``mqttServer``: Enter the server IP, eg. **"127.0.0.1"** or **"localhost"** if the server runs on the same machine. 46 | 47 | Zigbee2mqtt 48 | ----------- 49 | 50 | `Zigbee2mqtt `_ is a really nice application that uses a (pretty) cheap zigbee device and lets you control it from a mqtt server. 51 | To use zigbee2mqtt with diyHue, you'll need to make sure the you turned on ``homeassistant`` in the `configuration `_. This will make zigbee2mqtt start sending the auto discovery messages. 52 | 53 | .. code-block:: YAML 54 | 55 | homeassistant: true 56 | 57 | By using zigbee2mqtt and a compatible zigbee device together with diyHue you could replace the original bridges for zigbee lights. Hue bridge and/or TradFri. 58 | 59 | Other mqtt lights 60 | ----------------- 61 | 62 | We have only tested it with zigbee2mqtt, but other lights that are controlled by mqtt can maybe also work. You have to publish the correct auto discovery message to mqtt for diyhue to be able to pick it up. 63 | 64 | Protocol 65 | -------- 66 | 67 | Auto discovery messages look like this. Topic ``homeassistant/light/{light-id}/light/config`` 68 | 69 | .. code-block:: JSON 70 | 71 | { 72 | "brightness" : true, 73 | "xy" : true, 74 | "schema" : "json", 75 | "command_topic" : "zigbee2mqtt/naam-van-lamp/set", 76 | "state_topic" : "zigbee2mqtt/naam-van-lamp", 77 | "json_attributes_topic" : "zigbee2mqtt/naam-van-lamp", 78 | "name" : "naam-van-lamp_light", 79 | "unique_id" : "0x0017xxxec5e_light_zigbee2mqtt", 80 | "device" : { 81 | "identifiers" : [ "zigbee2mqtt_0x0017xxxec5e" ], 82 | "name" : "naam-van-lamp", 83 | "sw_version" : "Zigbee2mqtt 1.11.0", 84 | "model" : "Hue Bloom (7299760PH)", 85 | "manufacturer" : "Philips" 86 | }, 87 | "availability_topic" : "zigbee2mqtt/bridge/state" 88 | } 89 | 90 | 91 | diyHue subscribes to ``{discoveryPrefix}/light/+/light/config`` and uses the ``brightness``, ``ct`` and ``xy`` values to determine the light type. The ``state_topic`` is used to get data from the light and the ``command_topic`` is used to send a new state to the light. 92 | 93 | Sample state message, topic: ``zigbee2mqtt/naam-van-lamp`` 94 | 95 | .. code-block:: JSON 96 | 97 | { 98 | "state" : "ON", 99 | "brightness" : 200, 100 | "color" : { 101 | "x" : 0.7006, 102 | "y" : 0.2993 103 | } 104 | } 105 | 106 | The light is controlled by sending a message like the state message to the ``command_topic`` like ``zigbee2mqtt/naam-van-lamp/set``. 107 | 108 | .. code-block:: JSON 109 | 110 | { 111 | "state" : "ON", 112 | "brightness" : 200, 113 | "ct": 200, 114 | "color" : { 115 | "x" : 0.7006, 116 | "y" : 0.2993 117 | } 118 | } 119 | 120 | MQTT lights are only available since `this pr `_, so no support for sensors yet. But you can always contribute to this feature. 121 | -------------------------------------------------------------------------------- /source/development.rst: -------------------------------------------------------------------------------- 1 | diyHue - Development 2 | ==================== 3 | 4 | diyHue is an application written in python 3. To do any development you'll need some basic programming knowledge. 5 | 6 | First you create a fork of diyhue on github. `Create diyhue fork `_. 7 | 8 | If you already had a fork, make sure it's in sync with the master branch. 9 | 10 | .. code-block:: Bash 11 | 12 | # Add the remote, call it "upstream": (only once) 13 | git remote add upstream https://github.com/diyHue/diyHue.git 14 | 15 | # Fetch all the branches of that remote into remote-tracking branches, 16 | # such as upstream/master: 17 | git fetch upstream 18 | 19 | # Make sure that you're on your master branch: 20 | git checkout master 21 | 22 | # Rewrite your master branch so that any commits of yours that 23 | # aren't already in upstream/master are replayed on top of that 24 | # other branch: 25 | git rebase upstream/master 26 | 27 | 28 | Repository content 29 | ------------------ 30 | 31 | * ``.build/`` - build requirements 32 | 33 | * ``select.sh`` - Script to move the correct coap client and entertainment service for the target platform, used in docker. 34 | 35 | * ``.github/`` - github specific files (workflows / issue templates) 36 | * ``BridgeEmulator/`` - The actual bridge emulator 37 | 38 | * ``functions/`` - functions used in the bridge 39 | * ``protocols/`` - Light connections (mqtt, esphome, tasmota,...) 40 | * ``web-ui-src/`` - The webinterface (unpackaged) 41 | * ``web-ui/`` - Webinterface packaged 42 | * ``HueEmulator3.py`` - The main executable 43 | * ``coap-client-*`` - Pre-compiled `coap client `_ for connection with Ikea Tradfri bridge 44 | * ``entertainment-*`` - pre-compiled entertainment service. Used to setup the entertainment service for the hue bridge. 45 | * ``ssl_server2_diyhue.c`` - Source of entertainment service. 46 | 47 | * ``RemoteApi/`` - Server used to create a remote connection. 48 | 49 | Docker development 50 | ------------------ 51 | 52 | If you don't want to install python or the diyhue emulator on your machine, you can use these steps to setup your local development environment with the help of docker. Docker is the recommended way to develop and test your changes to diyhue. 53 | 54 | Requirements 55 | ------------ 56 | 57 | - Docker (desktop), windows Docker desktop with linux containers 58 | - Editor like `VSCode `_ 59 | - A folder to put the configuration 60 | - You cannot have the bridge running on this PC, because of the required ports 61 | 62 | Build docker image 63 | ------------------ 64 | 65 | The docker image for diyHue can be build for multiple architectures. Recently we added a Dockerfile that works for all (supported) architectures. 66 | 67 | - Linux 64-bit ``amd64`` 68 | - Arm (raspberry pi 3 eg.) ``arm/v7`` 69 | - Arm 64-bit (raspberry pi 3b/4 eg.) ``arm64`` 70 | 71 | Run the following command from the root of the repository to build the image 72 | 73 | .. code-block:: Bash 74 | 75 | docker build -t diyhue:development -f ./.build/Dockerfile --build-args TARGETPLATFORM=amd64 . 76 | 77 | # Or the following if you enabled buildx for multi architecture images 78 | docker build -t diyhue:development -f ./.build/Dockerfile --load . 79 | 80 | 81 | Start docker image 82 | ------------------ 83 | 84 | Once you made your changes and build the image, you'll need to run the following command to run your new image in debug mode. 85 | Before running change the values to your needs, so make sure you set the ``MAC`` variable to your used network card and the ``IP`` to the IP of your machine. 86 | Also change the folder ``/Users/you/diyhue/export`` to your own configuration folder. 87 | 88 | .. code-block:: Bash 89 | 90 | # Stop and remove current dev container 91 | docker stop diyhue-dev && docker rm diyhue-dev 92 | 93 | # Create new container 94 | docker run -d --name "diyhue-dev" --restart="unless-stopped" --network="bridge" \ 95 | -v '/Users/you/diyhue/export':'/opt/hue-emulator/export/':'rw' \ 96 | -e MAC='f4:0f:05:01:01:01' \ 97 | -e IP='192.168.x.x' \ 98 | -e disable-online-discover='true' \ 99 | -e DEBUG='true' \ 100 | -p 80:80/tcp -p 443:443/tcp -p 1900:1900/udp -p 2100:2100/udp -p 1982:1982/udp \ 101 | diyhue:development 102 | 103 | # Open logging 104 | docker logs -f diyhue-dev 105 | 106 | Publishing the docker image 107 | --------------------------- 108 | 109 | If you want to publish the multiarchitecture image of diyHue, you'll need to setup [Docker buildx](https://docs.docker.com/buildx/working-with-buildx/). Once setup it's a one line command to publish this image to the docker hub for multiple architectures. 110 | 111 | Caution, the first time it has to download a lot of packages for 3 platforms. This will take some time. After the first time the requirements are cached and building should be a lot faster. 112 | 113 | .. code-block:: Bash 114 | 115 | docker buildx build \ 116 | --platform linux/amd64,linux/arm64,linux/arm/v7 \ 117 | -t diyhue/core:development \ 118 | -f .build/Dockerfile \ 119 | --push . 120 | 121 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | -------------------------------------------------------------------------------- /source/Devices/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 | //IPAddress strip_ip ( 192, 168, 10, 96); 32 | //IPAddress gateway_ip ( 192, 168, 10, 1); 33 | //IPAddress subnet_mask(255, 255, 255, 0); 34 | 35 | int counter; 36 | byte mac[6]; 37 | 38 | void goingToSleep() { 39 | /*yield(); 40 | delay(100); 41 | ESP.deepSleep(0); 42 | yield();*/ 43 | } 44 | 45 | String macToStr(const uint8_t* mac) { 46 | String result; 47 | for (int i = 0; i < 6; ++i) { 48 | result += String(mac[i], 16); 49 | if (i < 5) 50 | result += ':'; 51 | } 52 | return result; 53 | } 54 | 55 | void sendHttpRequest(int button) { 56 | WiFiClient client; 57 | String url = "/switch?mac=" + macToStr(mac) + "&button=" + button; 58 | client.connect(bridgeIp, 80); 59 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 60 | "Host: " + bridgeIp + "\r\n" + 61 | "Connection: close\r\n\r\n"); 62 | 63 | Serial.println(String("GET ") + url + " HTTP/1.1\r\n" + 64 | "Host: " + bridgeIp + "\r\n" + 65 | "Connection: close\r\n\r\n"); 66 | } 67 | 68 | 69 | void ISR_S1() { 70 | for (int i = 0; i < 5000; i++) 71 | { 72 | _NOP(); 73 | } 74 | 75 | btn1_trig = true; 76 | if (digitalRead(button1_pin) == HIGH) 77 | { 78 | //Serial.println("S1_Rising!"); 79 | btn1_state = HIGH; 80 | } 81 | else 82 | { 83 | //Serial.println("S1_Falling!"); 84 | btn1_state = LOW; 85 | } 86 | } 87 | 88 | 89 | 90 | void ISR_S2() { 91 | 92 | for (int i = 0; i < 5000; i++) 93 | { 94 | _NOP(); 95 | } 96 | 97 | btn2_trig = true; 98 | 99 | if (digitalRead(button2_pin) == HIGH) 100 | { 101 | //Serial.println("S2_Rising!"); 102 | btn2_state = HIGH; 103 | } 104 | else 105 | { 106 | //Serial.println("S2_Falling!"); 107 | btn2_state = LOW; 108 | } 109 | 110 | } 111 | 112 | 113 | void setup() { 114 | 115 | Serial.begin(250000); 116 | Serial.println(); 117 | Serial.println("Setup!"); 118 | 119 | pinMode(0, OUTPUT); 120 | digitalWrite(0, LOW); 121 | 122 | pinMode(16, OUTPUT); 123 | pinMode(button1_pin, INPUT); 124 | pinMode(button2_pin, INPUT); 125 | //pinMode(button3_pin, INPUT); 126 | //pinMode(button4_pin, INPUT); 127 | 128 | 129 | attachInterrupt(digitalPinToInterrupt(button1_pin), ISR_S1, CHANGE); 130 | attachInterrupt(digitalPinToInterrupt(button2_pin), ISR_S2, CHANGE); 131 | 132 | 133 | 134 | digitalWrite(16, LOW); 135 | 136 | WiFi.mode(WIFI_STA); 137 | WiFi.begin(ssid, password); 138 | //WiFi.config(strip_ip, gateway_ip, subnet_mask); 139 | WiFi.macAddress(mac); 140 | 141 | while (WiFi.status() != WL_CONNECTED) { 142 | delay(50); 143 | } 144 | Serial.println("Connected"); 145 | 146 | ArduinoOTA.begin(); 147 | 148 | rst_info *rinfo; 149 | rinfo = ESP.getResetInfoPtr(); 150 | 151 | if ((*rinfo).reason != REASON_DEEP_SLEEP_AWAKE) { 152 | 153 | WiFiClient client; 154 | client.connect(bridgeIp, 80); 155 | 156 | //register device 157 | String url = "/switch"; 158 | url += "?devicetype=" + (String)switchType; 159 | url += "&mac=" + macToStr(mac); 160 | 161 | //###Registering device 162 | client.connect(bridgeIp, 80); 163 | client.print(String("GET ") + url + " HTTP/1.1\r\n" + 164 | "Host: " + bridgeIp + "\r\n" + 165 | "Connection: close\r\n\r\n"); 166 | } 167 | 168 | if (digitalRead(button1_pin) == LOW) 169 | btn1_state = LOW; 170 | 171 | if (digitalRead(button2_pin) == LOW) 172 | btn2_state = LOW; 173 | 174 | } 175 | 176 | void loop() { 177 | ArduinoOTA.handle(); 178 | delay(1); 179 | 180 | //Serial.println("read..."); 181 | delay(10); 182 | 183 | 184 | if (btn1_trig == true) 185 | { 186 | btn1_trig = false; 187 | if (btn1_state == HIGH) 188 | sendHttpRequest(34); 189 | else 190 | sendHttpRequest(16); 191 | } 192 | 193 | 194 | if (btn2_trig == true) 195 | { 196 | btn2_trig = false; 197 | if (btn2_state == HIGH) 198 | sendHttpRequest(17); 199 | else 200 | sendHttpRequest(18); 201 | } 202 | 203 | /*if (digitalRead(button1_pin) == HIGH && button1_high == false) { 204 | sendHttpRequest(34); 205 | button1_high = true; 206 | } 207 | 208 | if (digitalRead(button1_pin) == LOW && button1_high == true) { 209 | sendHttpRequest(16); 210 | button1_high = false; 211 | } 212 | 213 | if (digitalRead(button2_pin) == HIGH && button2_high == false) { 214 | sendHttpRequest(17); 215 | button2_high = true; 216 | } 217 | 218 | if (digitalRead(button2_pin) == LOW && button2_high == true) { 219 | sendHttpRequest(18); 220 | button2_high = false; 221 | }*/ 222 | 223 | /*if (digitalRead(button2_pin) == HIGH) { 224 | sendHttpRequest(18); 225 | counter = 0; 226 | int i = 0; 227 | while (digitalRead(button2_pin) == HIGH && i < 20) { 228 | delay(20); 229 | i++; 230 | } 231 | } 232 | if (digitalRead(button3_pin) == HIGH) { 233 | sendHttpRequest(17); 234 | counter = 0; 235 | int i = 0; 236 | while (digitalRead(button3_pin) == HIGH && i < 20) { 237 | delay(20); 238 | i++; 239 | } 240 | } 241 | if (digitalRead(button4_pin) == HIGH) { 242 | sendHttpRequest(18); 243 | counter = 0; 244 | int i = 0; 245 | while (digitalRead(button4_pin) == HIGH && i < 20) { 246 | delay(20); 247 | i++; 248 | } 249 | }*/ 250 | /*if (counter == 5000) { 251 | goingToSleep(); 252 | } else { 253 | counter++; 254 | }*/ 255 | 256 | delay(500); 257 | } 258 | -------------------------------------------------------------------------------- /source/Devices/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 | // if you want to setup static ip uncomment these 3 lines and line 72 15 | //IPAddress strip_ip ( 192, 168, 10, 95); 16 | //IPAddress gateway_ip ( 192, 168, 10, 1); 17 | //IPAddress subnet_mask(255, 255, 255, 0); 18 | 19 | bool device_state[devicesCount]; 20 | byte mac[6]; 21 | 22 | ESP8266WebServer server(80); 23 | 24 | void handleNotFound() { 25 | String message = "File Not Found\n\n"; 26 | message += "URI: "; 27 | message += server.uri(); 28 | message += "\nMethod: "; 29 | message += (server.method() == HTTP_GET) ? "GET" : "POST"; 30 | message += "\nArguments: "; 31 | message += server.args(); 32 | message += "\n"; 33 | for (uint8_t i = 0; i < server.args(); i++) { 34 | message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 35 | } 36 | server.send(404, "text/plain", message); 37 | } 38 | 39 | 40 | void setup() { 41 | EEPROM.begin(512); 42 | 43 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 44 | pinMode(devicesPins[ch], OUTPUT); 45 | } 46 | 47 | //WiFi.config(strip_ip, gateway_ip, subnet_mask); 48 | 49 | 50 | if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) { 51 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 52 | digitalWrite(devicesPins[ch], OUTPUT); 53 | } 54 | 55 | } 56 | 57 | WiFiManager wifiManager; 58 | wifiManager.autoConnect("New Hue Device"); 59 | 60 | WiFi.macAddress(mac); 61 | 62 | // Port defaults to 8266 63 | // ArduinoOTA.setPort(8266); 64 | 65 | // Hostname defaults to esp8266-[ChipID] 66 | // ArduinoOTA.setHostname("myesp8266"); 67 | 68 | // No authentication by default 69 | // ArduinoOTA.setPassword((const char *)"123"); 70 | 71 | ArduinoOTA.begin(); 72 | 73 | 74 | server.on("/set", []() { 75 | uint8_t device; 76 | 77 | for (uint8_t i = 0; i < server.args(); i++) { 78 | if (server.argName(i) == "light") { 79 | device = server.arg(i).toInt() - 1; 80 | } 81 | else if (server.argName(i) == "on") { 82 | if (server.arg(i) == "True" || server.arg(i) == "true") { 83 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 84 | EEPROM.write(0, 1); 85 | EEPROM.commit(); 86 | } 87 | device_state[device] = true; 88 | digitalWrite(devicesPins[device], HIGH); 89 | } 90 | else { 91 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 92 | EEPROM.write(0, 0); 93 | EEPROM.commit(); 94 | } 95 | device_state[device] = false; 96 | digitalWrite(devicesPins[device], LOW); 97 | } 98 | } 99 | } 100 | server.send(200, "text/plain", "OK, state:" + device_state[device]); 101 | }); 102 | 103 | server.on("/get", []() { 104 | uint8_t light; 105 | if (server.hasArg("light")) 106 | light = server.arg("light").toInt() - 1; 107 | String power_status; 108 | power_status = device_state[light] ? "true" : "false"; 109 | server.send(200, "text/plain", "{\"on\": " + power_status + "}"); 110 | }); 111 | 112 | server.on("/detect", []() { 113 | 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) + "\"}"); 114 | }); 115 | 116 | server.on("/", []() { 117 | float transitiontime = 100; 118 | if (server.hasArg("startup")) { 119 | if ( EEPROM.read(1) != server.arg("startup").toInt()) { 120 | EEPROM.write(1, server.arg("startup").toInt()); 121 | EEPROM.commit(); 122 | } 123 | } 124 | 125 | for (uint8_t device = 0; device < devicesCount; device++) { 126 | 127 | if (server.hasArg("on")) { 128 | if (server.arg("on") == "true") { 129 | device_state[device] = true; 130 | digitalWrite(devicesPins[device], HIGH); 131 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 132 | EEPROM.write(0, 1); 133 | EEPROM.commit(); 134 | } 135 | } else { 136 | device_state[device] = false; 137 | digitalWrite(devicesPins[device], LOW); 138 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 139 | EEPROM.write(0, 0); 140 | EEPROM.commit(); 141 | } 142 | } 143 | } 144 | } 145 | if (server.hasArg("reset")) { 146 | ESP.reset(); 147 | } 148 | 149 | 150 | String http_content = ""; 151 | http_content += ""; 152 | http_content += ""; 153 | http_content += ""; 154 | http_content += ""; 155 | http_content += "Light Setup"; 156 | http_content += ""; 157 | http_content += ""; 158 | http_content += ""; 159 | http_content += "
"; 160 | http_content += "

Light Setup

"; 161 | http_content += "
"; 162 | http_content += "
"; 163 | http_content += ""; 164 | http_content += "ON"; 165 | http_content += "OFF"; 166 | http_content += "
"; 167 | http_content += "
"; 168 | http_content += ""; 169 | http_content += ""; 170 | http_content += ""; 171 | 172 | server.send(200, "text/html", http_content); 173 | 174 | }); 175 | 176 | 177 | server.onNotFound(handleNotFound); 178 | 179 | server.begin(); 180 | } 181 | 182 | void loop() { 183 | ArduinoOTA.handle(); 184 | server.handleClient(); 185 | } 186 | -------------------------------------------------------------------------------- /source/lights/diylights.rst: -------------------------------------------------------------------------------- 1 | DIY Lights 2 | ========== 3 | 4 | The following devices are currently supported: 5 | 6 | * Generic PWM CCT lights (2 channels) - ex Milight bicolor 7 | * generic PWM RGB lights (3 channels) 8 | * generic PWM RGBW lights (4 channels) - ex. Feican bulbs 9 | * generic PWM RGB-CCT lights (5 chnnels - ex Milight FUT015) 10 | * SK6812 Neopixels 11 | * WS2812B Neopixels 12 | * All ZigBee lights - check :ref:`raspbee` module page 13 | 14 | A lot of Wi-Fi lights from the market are ESP8266 based and can be used very easily with this project by flashing the firmware with one provided. 15 | Almost all dimmable lights that are not ESP8266 based (ex MiLight bulbs) can be converted to Wi-Fi with one ESP-12S module by connecting the outputs directly to led drivers (picture available). 16 | If you decide to convert a MiLight bulb to ESP-12S, then I recommend to use a `micro step down buck converter `_ in order to avoid overheating issues. 17 | 18 | All lights are two way synchronized so any change made by 3rd party device will also be added to the bridge emulator on the first request to each light group. 19 | By default any light that become unreachable will be marked as unreachable and will be displayed as off. 20 | This is because a lot of people still use classic light switches. 21 | 22 | Light GUI 23 | --------- 24 | 25 | .. figure:: /_static/images/lightGUI.png 26 | 27 | All lights have an internal web GUI that can be accesses with any browser and offers the following options: 28 | 29 | * Turn the light on/off 30 | * Set startup option: 31 | 32 | * Light Off (default) 33 | * Light On 34 | * Last State (Turns the light on to the same state as it was the last time it was on) 35 | 36 | * Change the scene. This will change also the power on scene 37 | * Change any light parameter (bri, color, ct, xy, etc) 38 | 39 | Flashing Firmware 40 | ----------------- 41 | 42 | In the new version is mandatory add SPIFFS storage to the ESP module. Try to choose the maximum possible size. For NodeMcu/Wemos D1 mini that have 4Mb of flash select 4M with 3M SPIFFS. You will know if the SPIFFS storage is properly set by looking at wifi manager broadcast SSID, if is in format ESPxxxxx then you must try different SPiFFS option. Future upgrades can be performed manually by exporting the compiled binary file from Arduino and upload it using any browser by accessing /update http location of the light. 43 | 44 | Neopixels 45 | ~~~~~~~~~ 46 | 47 | Before compiling the code, you must set the ``lightsCount`` and ``pixelCount`` variables. 48 | ``lightsCount`` is the number of virtual lights to create from your NeoPixel strip. 49 | ``pixelCount`` is the total number of NeoPixel LED's in the connected strip . ``transitionLeds`` represents the number of LEDs used for smooth transitions of colours between lights. 50 | I recommend using atleast 3 lights, one light at every 20 - 50 LED's so you can enjoy Hue scenes and Hue Entertainment. 51 | The data pin of the LED's must be connected to RX pin of the ESP8266 board. Make sure to disconnect this when uploading or it could fail. 52 | 53 | .. figure:: /_static/images/strip_wiring_to_wemos_d1_mini.jpg 54 | 55 | Generic lights 56 | ~~~~~~~~~~~~~~ 57 | 58 | If your device is factory ESP8266 based, then you must specify the pins used by that device in setting page of the light web gui. 59 | If you don't know what pins are used or what color is controlled on a pin then try random pins. 60 | I recommend using the MiLight FUT15 bulbs converted to ESP-12S because of it's high brightness and good color reproduction. 61 | 62 | .. figure:: /_static/images/MiLight_RGB_CCT_converted_to_ESP-12S.jpg 63 | 64 | Connecting the lights to a Wi-Fi network 65 | ---------------------------------------- 66 | 67 | All lights are using `WiFiManager `_ and on power up, will broadcast for 2 minutes with the SSID set in the ``light_name`` variable (the defaultis ``Hue .....``) 68 | Connect to this network with you phone or computer and browse to ``http://192.168.4.1`` 69 | From here you can choose the SSID of the network you would like the light to connect to and enter its password. 70 | After the light is present on your network open the official Hue application and scan for new lights. 71 | In case no lights are found, check if the nmap package is installed. 72 | Note: The app will often say no lights found but the lights will then appear a few seconds after this notification. So be patient! 73 | 74 | Lights API 75 | ---------- 76 | 77 | The lights use the same Hue protocol however, for sketches with multiple lights the state of every light is added in a root key that identify the light id. 78 | 79 | **detection url**: ``http://{light ip}/detect`` 80 | 81 | sample output: 82 | 83 | .. code-block:: JSON 84 | 85 | {"name":"Living ","protocol":"native_single","modelid":"LCT015","type":"rgb-cct","mac":"A0:20:A6:2C:FB:26","version":2} 86 | 87 | **API for light control or state read** 88 | 89 | http path: ``http://{light ip}/state`` 90 | 91 | http mode: GET for read, PUT to set a new state with json body 92 | 93 | Example json body for devices with single light (generic RGB, generic RGBW, generic RGB-CCT): 94 | ``{"on":true,"bri":144,"xy":[0.53, 0,21]}`` 95 | 96 | Example json body for devices with multiple lights: 97 | ``{1: {"on":true,"bri":144,"xy":[0.53, 0,21]}, 2: {"on":true,"bri":144,"ct":370}, 3: {"on":false}}`` 98 | to read the state of a light is required to specify the light id in the url ``http://{light ip}/state?light=2``. 99 | If not light is specified the state of light id 1 will be returned. 100 | 101 | 102 | Arguments that can be passed in the URL: 103 | 104 | * ``on``: 1 to set light on, 0 to set the light off. 105 | * ``r``, ``g``, ``b``: Set the light color using RGB values between 0 and 255. 106 | * ``x`` and ``y``: Values between 0.0 and 1.0 to set the light color using a CIE chart. 107 | * ``ct``: Value between 153 (max warm white) and 500 (max could white) http://en.wikipedia.org/wiki/Mired 108 | * ``hue``: Value between 0 and 65535, representing the hue of the light. 109 | * ``sat``: Set the saturation of the light. 255 is the most saturated and 0 is the least saturated. 110 | * ``bri``: Set the brightness of the light, 255 is the maximum brightness, 1 is the minimum, 0 will turn the light on to previous state 111 | * ``transitiontime``: Duration of the transition from the light’s current state to the new state. The default is 4 representing 0.4 seconds. 112 | * ``bri_inc``: Increase or decrease the brightness with a specified value 113 | 114 | Firmware upgrade 115 | ---------------- 116 | 117 | You can upgrade the firmware very easily by saving the binary file from Arduino to local disk and uploading it using `/update` page of the light web ui 118 | -------------------------------------------------------------------------------- /source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/master/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = 'diyHue' 23 | copyright = '2018, diyHue Team' 24 | author = 'diyHue Team' 25 | 26 | # The short X.Y version 27 | version = '' 28 | # The full version, including alpha/beta/rc tags 29 | release = '1.0' 30 | 31 | 32 | # -- General configuration --------------------------------------------------- 33 | 34 | # If your documentation needs a minimal Sphinx version, state it here. 35 | # 36 | # needs_sphinx = '1.0' 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be 39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 40 | # ones. 41 | extensions = [ 42 | 'sphinx.ext.autodoc', 43 | 'sphinx.ext.doctest', 44 | 'sphinx.ext.intersphinx', 45 | 'sphinx.ext.todo', 46 | 'sphinx.ext.coverage', 47 | 'sphinx.ext.mathjax', 48 | 'sphinx.ext.ifconfig', 49 | 'sphinx.ext.viewcode', 50 | 'sphinx.ext.githubpages', 51 | ] 52 | 53 | # Add any paths that contain templates here, relative to this directory. 54 | templates_path = ['_templates'] 55 | 56 | # The suffix(es) of source filenames. 57 | # You can specify multiple suffix as a list of string: 58 | # 59 | # source_suffix = ['.rst', '.md'] 60 | source_suffix = '.rst' 61 | 62 | # The master toctree document. 63 | master_doc = 'index' 64 | 65 | # The language for content autogenerated by Sphinx. Refer to documentation 66 | # for a list of supported languages. 67 | # 68 | # This is also used if you do content translation via gettext catalogs. 69 | # Usually you set "language" from the command line for these cases. 70 | language = None 71 | 72 | # List of patterns, relative to source directory, that match files and 73 | # directories to ignore when looking for source files. 74 | # This pattern also affects html_static_path and html_extra_path . 75 | exclude_patterns = [] 76 | 77 | # The name of the Pygments (syntax highlighting) style to use. 78 | pygments_style = 'sphinx' 79 | 80 | 81 | # -- Options for HTML output ------------------------------------------------- 82 | 83 | # The theme to use for HTML and HTML Help pages. See the documentation for 84 | # a list of builtin themes. 85 | # 86 | #html_theme = 'alabaster' 87 | import sphinx_rtd_theme 88 | html_theme = "sphinx_rtd_theme" 89 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 90 | 91 | 92 | # Theme options are theme-specific and customize the look and feel of a theme 93 | # further. For a list of options available for each theme, see the 94 | # documentation. 95 | # 96 | # html_theme_options = {} 97 | 98 | # Add any paths that contain custom static files (such as style sheets) here, 99 | # relative to this directory. They are copied after the builtin static files, 100 | # so a file named "default.css" will overwrite the builtin "default.css". 101 | html_static_path = ['_static'] 102 | 103 | # Custom sidebar templates, must be a dictionary that maps document names 104 | # to template names. 105 | # 106 | # The default sidebars (for documents that don't match any pattern) are 107 | # defined by theme itself. Builtin themes are using these templates by 108 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 109 | # 'searchbox.html']``. 110 | # 111 | # html_sidebars = {} 112 | 113 | 114 | # -- Options for HTMLHelp output --------------------------------------------- 115 | 116 | # Output file base name for HTML help builder. 117 | htmlhelp_basename = 'diyHuedoc' 118 | 119 | 120 | # -- Options for LaTeX output ------------------------------------------------ 121 | 122 | latex_elements = { 123 | # The paper size ('letterpaper' or 'a4paper'). 124 | # 125 | # 'papersize': 'letterpaper', 126 | 127 | # The font size ('10pt', '11pt' or '12pt'). 128 | # 129 | # 'pointsize': '10pt', 130 | 131 | # Additional stuff for the LaTeX preamble. 132 | # 133 | # 'preamble': '', 134 | 135 | # Latex figure (float) alignment 136 | # 137 | # 'figure_align': 'htbp', 138 | } 139 | 140 | # Grouping the document tree into LaTeX files. List of tuples 141 | # (source start file, target name, title, 142 | # author, documentclass [howto, manual, or own class]). 143 | latex_documents = [ 144 | (master_doc, 'diyHue.tex', 'diyHue Documentation', 145 | 'diyHue Team', 'manual'), 146 | ] 147 | 148 | 149 | # -- Options for manual page output ------------------------------------------ 150 | 151 | # One entry per manual page. List of tuples 152 | # (source start file, name, description, authors, manual section). 153 | man_pages = [ 154 | (master_doc, 'diyHue', 'diyHue Documentation', 155 | [author], 1) 156 | ] 157 | 158 | 159 | # -- Options for Texinfo output ---------------------------------------------- 160 | 161 | # Grouping the document tree into Texinfo files. List of tuples 162 | # (source start file, target name, title, author, 163 | # dir menu entry, description, category) 164 | texinfo_documents = [ 165 | (master_doc, 'diyHue', 'diyHue Documentation', 166 | author, 'diyHue', 'One line description of project.', 167 | 'Miscellaneous'), 168 | ] 169 | 170 | 171 | # -- Options for Epub output ------------------------------------------------- 172 | 173 | # Bibliographic Dublin Core info. 174 | epub_title = project 175 | epub_author = author 176 | epub_publisher = author 177 | epub_copyright = copyright 178 | 179 | # The unique identifier of the text. This can be a ISBN number 180 | # or the project homepage. 181 | # 182 | # epub_identifier = '' 183 | 184 | # A unique identification for the text. 185 | # 186 | # epub_uid = '' 187 | 188 | # A list of files that should not be packed into the epub file. 189 | epub_exclude_files = ['search.html'] 190 | 191 | 192 | # -- Extension configuration ------------------------------------------------- 193 | 194 | # -- Options for intersphinx extension --------------------------------------- 195 | 196 | # Example configuration for intersphinx: refer to the Python standard library. 197 | intersphinx_mapping = {'https://docs.python.org/': None} 198 | 199 | # -- Options for todo extension ---------------------------------------------- 200 | 201 | # If true, `todo` and `todoList` produce output, else they produce nothing. 202 | todo_include_todos = True 203 | -------------------------------------------------------------------------------- /source/lights/esphome.rst: -------------------------------------------------------------------------------- 1 | ESPHome 2 | ======== 3 | 4 | ESPHome currently only works with one light per ESPHome device. This protocol will even work with switches that are mapped as lights in ESPHome, making it very flexible and ideal for a large variety of devices. 5 | 6 | Supported modes of operation are: 7 | 8 | * RGBW 9 | * CT 10 | * RGB 11 | * Dimmable 12 | * Toggle 13 | 14 | To add the device to diyHue, simply configure it using the information below and search for lights. The devices should be automatically imported into diyHue with the correct information. 15 | 16 | General Configuration 17 | --------- 18 | 19 | All devices must have a text sensor: 20 | 21 | .. code-block:: YAML 22 | 23 | text_sensor: 24 | - platform: template 25 | name: "light_id" 26 | id: light_id 27 | lambda: |- 28 | char response[100]; 29 | memset( response, 0, 100 ); 30 | strcat( response, "esphome_diyhue_light;"); 31 | strcat( response, WiFi.macAddress().c_str()); 32 | strcat( response, ";"); 33 | strcat( response, App.get_name().c_str()); 34 | strcat( response, ";CT_BOOST;RGB_BOOST" ); // ;CT_BOOST;RGB_BOOST values go here; Replace with 0 to disable 35 | return { response }; 36 | update_interval: 24h 37 | 38 | Configurable options: 39 | 40 | * ``CT_BOOST``: this value is utilized by diyHue to increase/decrease the default brightness of the CT light. Set this value to 0 to disable the feature. Must be an integer. 41 | * ``RGB_BOOST``: same as CT_BOOST except will apply for the RGB component of the light. 42 | 43 | **Important: CT_BOOST and RGB_BOOST must have a numeral value regardless of the bulb's capabilities. For bulbs that are dimmable and toggle, simply set these values to 0.** 44 | 45 | The alert switch will be called when the bulb is requested to be located. As it stands now, it is not ideal as it does not return the light to the original state. 46 | 47 | Entertainment Mode 48 | --------- 49 | 50 | The configuration for entertainment mode differs from the configuration here which does not include entertainment mode. The full code can be found in the ``Lights`` repository. The primary differences are: 51 | 52 | .. code-block:: YAML 53 | 54 | includes: 55 | - diyhueasyncudp.h 56 | libraries: 57 | - ESPAsyncUDP@697c75a025 58 | 59 | custom_component: 60 | - lambda: |- 61 | auto diyhue = new diyhueudp(); 62 | return {diyhue}; 63 | 64 | These lines install the required library, the entertainment component, and initializes it. Additionally, be sure to copy the AsyncUDP component to the ESPHome directory. 65 | 66 | 67 | RGBW 68 | --------- 69 | 70 | Including a white_led and a color_led light in the configuration will allow diyHue to automatically detect the devices as an RGBW device. 71 | 72 | CT 73 | --------- 74 | 75 | Include a white_led light to mark the light as a CT light. 76 | 77 | RGB 78 | --------- 79 | 80 | Include a color_led light to mark the light as a RGB light. 81 | 82 | Dimmable 83 | --------- 84 | 85 | Include a dimmable_led light to mark the light as a Dimmable light. 86 | 87 | Toggle 88 | --------- 89 | 90 | Include a toggle_led light to mark the light as a Toggle light. 91 | 92 | Sample Configuration 93 | --------- 94 | 95 | This is a sample configuration for a RGBW light, namely the `Feit Electric Smart Bulb `_. This configuration can be modified using the above information to integrate practically any type of light ESPHome supports with diyHue. 96 | 97 | .. code-block:: YAML 98 | 99 | esphome: 100 | name: light1 101 | platform: ESP8266 102 | board: esp01_1m 103 | 104 | ota: 105 | password: "redacted" 106 | 107 | wifi: 108 | ssid: "redacted" 109 | password: "redacted" 110 | 111 | ap: 112 | ssid: "ESPhome light1" 113 | 114 | # Enable logging 115 | logger: 116 | level: DEBUG 117 | 118 | # Enable Home Assistant API 119 | api: 120 | password: "redacted" 121 | 122 | power_supply: 123 | - id: 'fast_led_pwr' 124 | pin: GPIO13 125 | 126 | output: 127 | - platform: esp8266_pwm 128 | pin: GPIO5 129 | id: cold_white_gpio 130 | frequency: 4000 Hz 131 | inverted: False 132 | min_power: 0 133 | max_power: 1 134 | 135 | - platform: esp8266_pwm 136 | pin: GPIO12 137 | id: warm_white_gpio 138 | frequency: 4000 Hz 139 | inverted: False 140 | min_power: 0 141 | max_power: 1 142 | 143 | light: 144 | - platform: cwww 145 | id: white_led 146 | name: "white_led" 147 | cold_white: cold_white_gpio 148 | warm_white: warm_white_gpio 149 | cold_white_color_temperature: 6500 K 150 | warm_white_color_temperature: 2000 K 151 | gamma_correct: 0.8 152 | default_transition_length: 0.4s 153 | 154 | - platform: fastled_spi 155 | id: color_led 156 | chipset: SM16716 157 | data_pin: GPIO14 158 | clock_pin: GPIO4 159 | power_supply: fast_led_pwr 160 | num_leds: 1 161 | rgb_order: BGR 162 | name: "color_led" 163 | default_transition_length: 0.4s 164 | gamma_correct: 0.8 165 | effects: 166 | - random: 167 | name: Random Effect With Custom Values 168 | transition_length: 5s 169 | update_interval: 3s 170 | 171 | text_sensor: 172 | - platform: template 173 | name: "light_id" 174 | id: light_id 175 | lambda: |- 176 | char response[100]; 177 | memset( response, 0, 100 ); 178 | strcat( response, "esphome_diyhue_light;"); 179 | strcat( response, WiFi.macAddress().c_str()); 180 | strcat( response, ";"); 181 | strcat( response, App.get_name().c_str()); 182 | strcat( response, ";CT_BOOST;RGB_BOOST" ); // ;CT_BOOST;RGB_BOOST values go here; Replace with 0 to disable 183 | return { response }; 184 | update_interval: 24h 185 | 186 | switch: 187 | - platform: template 188 | name: alert 189 | id: alert 190 | optimistic: true 191 | turn_on_action: 192 | - light.turn_off: color_led 193 | - light.turn_on: 194 | id: white_led 195 | brightness: 100% 196 | color_temperature: 4000 K 197 | - delay: 1s 198 | - light.turn_on: 199 | id: white_led 200 | brightness: 10% 201 | color_temperature: 4000 K 202 | - delay: 1s 203 | - light.turn_on: 204 | id: white_led 205 | brightness: 100% 206 | color_temperature: 4000 K 207 | - delay: 1s 208 | - light.turn_on: 209 | id: white_led 210 | brightness: 10% 211 | color_temperature: 4000 K 212 | - delay: 1s 213 | - light.turn_on: 214 | id: white_led 215 | brightness: 100% 216 | color_temperature: 4000 K 217 | - switch.turn_off: alert 218 | 219 | web_server: 220 | port: 80 221 | -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Sonoff_S20/Sonoff_S20.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define devicesCount 1 10 | 11 | uint8_t devicesPins[devicesCount] = {12}; 12 | uint8_t ledPin = 13; 13 | 14 | const uint8_t buttonPin = 0; // the pin that the pushbutton is attached to 15 | uint8_t buttonState = digitalRead(buttonPin); 16 | uint8_t lastButtonState = buttonState; 17 | unsigned long lastButtonPush = 0; 18 | uint8_t buttonThreshold = 50; 19 | 20 | // if you want to setup static ip uncomment these 3 lines and line 72 21 | //IPAddress strip_ip ( 192, 168, 10, 95); 22 | //IPAddress gateway_ip ( 192, 168, 10, 1); 23 | //IPAddress subnet_mask(255, 255, 255, 0); 24 | 25 | bool device_state[devicesCount]; 26 | byte mac[6]; 27 | 28 | ESP8266WebServer server(80); 29 | 30 | void handleNotFound() { 31 | String message = "File Not Found\n\n"; 32 | message += "URI: "; 33 | message += server.uri(); 34 | message += "\nMethod: "; 35 | message += (server.method() == HTTP_GET) ? "GET" : "POST"; 36 | message += "\nArguments: "; 37 | message += server.args(); 38 | message += "\n"; 39 | for (uint8_t i = 0; i < server.args(); i++) { 40 | message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 41 | } 42 | server.send(404, "text/plain", message); 43 | } 44 | 45 | void setup() { 46 | EEPROM.begin(512); 47 | 48 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 49 | pinMode(devicesPins[ch], OUTPUT); 50 | } 51 | 52 | pinMode(ledPin, OUTPUT); 53 | digitalWrite(ledPin, HIGH); 54 | //WiFi.config(strip_ip, gateway_ip, subnet_mask); 55 | 56 | 57 | if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) { 58 | for (uint8_t i = 0; i < devicesCount; i++) { 59 | digitalWrite(devicesPins[i], OUTPUT); 60 | device_state[i] = true; 61 | } 62 | } 63 | 64 | WiFiManager wifiManager; 65 | wifiManager.autoConnect("New Hue Plug"); 66 | 67 | if (!device_state[0]) { 68 | while (WiFi.status() != WL_CONNECTED) { 69 | // Blink the button led 70 | digitalWrite(ledPin, HIGH); 71 | delay(100); 72 | digitalWrite(ledPin, LOW); 73 | delay(100); 74 | } 75 | } 76 | // OK 77 | digitalWrite(ledPin, LOW); 78 | delay(1000); 79 | digitalWrite(ledPin, HIGH); 80 | 81 | WiFi.macAddress(mac); 82 | 83 | // Port defaults to 8266 84 | // ArduinoOTA.setPort(8266); 85 | 86 | // Hostname defaults to esp8266-[ChipID] 87 | //ArduinoOTA.setHostname("HuePlugTwo"); 88 | 89 | // No authentication by default 90 | //ArduinoOTA.setPassword((const char *)"123"); 91 | 92 | ArduinoOTA.begin(); 93 | 94 | server.on("/set", []() { 95 | uint8_t device; 96 | 97 | for (uint8_t i = 0; i < server.args(); i++) { 98 | if (server.argName(i) == "light") { 99 | device = server.arg(i).toInt() - 1; 100 | } 101 | else if (server.argName(i) == "on") { 102 | if (server.arg(i) == "True" || server.arg(i) == "true") { 103 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 104 | EEPROM.write(0, 1); 105 | EEPROM.commit(); 106 | } 107 | device_state[device] = true; 108 | digitalWrite(devicesPins[device], HIGH); 109 | } 110 | else { 111 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 112 | EEPROM.write(0, 0); 113 | EEPROM.commit(); 114 | } 115 | device_state[device] = false; 116 | digitalWrite(devicesPins[device], LOW); 117 | } 118 | } 119 | } 120 | server.send(200, "text/plain", "OK, state:" + device_state[device]); 121 | }); 122 | 123 | server.on("/get", []() { 124 | uint8_t light; 125 | if (server.hasArg("light")) 126 | light = server.arg("light").toInt() - 1; 127 | String power_status; 128 | power_status = device_state[light] ? "true" : "false"; 129 | server.send(200, "text/plain", "{\"on\": " + power_status + "}"); 130 | }); 131 | 132 | server.on("/detect", []() { 133 | 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) + "\"}"); 134 | }); 135 | 136 | server.on("/", []() { 137 | float transitiontime = 100; 138 | if (server.hasArg("startup")) { 139 | if ( EEPROM.read(1) != server.arg("startup").toInt()) { 140 | EEPROM.write(1, server.arg("startup").toInt()); 141 | EEPROM.commit(); 142 | } 143 | } 144 | 145 | for (uint8_t device = 0; device < devicesCount; device++) { 146 | 147 | if (server.hasArg("on")) { 148 | if (server.arg("on") == "true") { 149 | device_state[device] = true; 150 | digitalWrite(devicesPins[device], HIGH); 151 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 152 | EEPROM.write(0, 1); 153 | EEPROM.commit(); 154 | } 155 | } else { 156 | device_state[device] = false; 157 | digitalWrite(devicesPins[device], LOW); 158 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 159 | EEPROM.write(0, 0); 160 | EEPROM.commit(); 161 | } 162 | } 163 | } 164 | } 165 | if (server.hasArg("reset")) { 166 | ESP.reset(); 167 | } 168 | 169 | 170 | String http_content = ""; 171 | http_content += ""; 172 | http_content += ""; 173 | http_content += ""; 174 | http_content += ""; 175 | http_content += "Light Setup"; 176 | http_content += ""; 177 | http_content += ""; 178 | http_content += ""; 179 | http_content += "
"; 180 | http_content += "

Light Setup

"; 181 | http_content += "
"; 182 | http_content += "
"; 183 | http_content += ""; 184 | http_content += "ON"; 185 | http_content += "OFF"; 186 | http_content += "
"; 187 | http_content += "
"; 188 | http_content += ""; 189 | http_content += ""; 190 | http_content += ""; 191 | 192 | server.send(200, "text/html", http_content); 193 | 194 | }); 195 | 196 | 197 | server.onNotFound(handleNotFound); 198 | 199 | server.begin(); 200 | } 201 | 202 | void loop() { 203 | ArduinoOTA.handle(); 204 | server.handleClient(); 205 | 206 | if (millis() < lastButtonPush + buttonThreshold) return; // check button only when the threshold after last push is reached 207 | 208 | lastButtonPush = millis(); 209 | 210 | buttonState = digitalRead(buttonPin); 211 | 212 | // compare the buttonState to its previous state 213 | if (buttonState == lastButtonState) return; 214 | 215 | if (buttonState == HIGH) { 216 | for (uint8_t device = 0; device < devicesCount; device++) { 217 | device_state[device] = !device_state[device]; 218 | 219 | if (device_state[device] == true) { 220 | digitalWrite(devicesPins[device], HIGH); 221 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 222 | EEPROM.write(0, 1); 223 | EEPROM.commit(); 224 | } 225 | } else { 226 | digitalWrite(devicesPins[device], LOW); 227 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 228 | EEPROM.write(0, 0); 229 | EEPROM.commit(); 230 | } 231 | } 232 | } 233 | } 234 | 235 | // save the current state as the last state, for next time through the loop 236 | lastButtonState = buttonState; 237 | 238 | } 239 | -------------------------------------------------------------------------------- /source/Devices/Lights/Arduino/Generic_ON_OFF_device_433Mhz/Generic_ON_OFF_device_433Mhz.ino: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* 4 | This can control Generic Power Outlets with Remote Control over 433Mhz. 5 | Maximum 8 Devices. 6 | Simulates 2 Remotes with 4 Items each. 7 | Showing 8 Individual Hue Bulbs 8 | 9 | Edit Config as needed 10 | by Mevel 11 | 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | RCSwitch mySwitch = RCSwitch(); 24 | 25 | 26 | //############ CONFIG ############ 27 | 28 | #define devicesCount 8 // 4 or 8 --> Maximum 8 29 | char* houseCodeA = "11110"; //Group A --> Remote Code for Socket 1-4 30 | char* houseCodeB = "11100"; //Group B --> Remote Code for Socket 5-8 31 | 32 | //##########END OF CONFIG ############## 33 | 34 | 35 | 36 | uint8_t devicesPins[devicesCount] = {12, 13, 14, 5, 12, 13, 14, 5}; //irrelevant 37 | uint8_t transmitterPin = 4; // What Pin is the Transmitter conected? 38 | uint8_t transmitterDelay = 100; // Delay between sending commands in ms 39 | uint8_t repeatTransmit = 2; // Number of Transmit attempts 40 | char* deviceId[] = {"10000", "01000", "00100", "00010", "10000", "01000", "00100", "00010"}; 41 | int c; 42 | 43 | 44 | 45 | 46 | // if you want to setup static ip uncomment these 3 lines and line 72 47 | //IPAddress strip_ip ( 192, 168, 10, 95); 48 | //IPAddress gateway_ip ( 192, 168, 10, 1); 49 | //IPAddress subnet_mask(255, 255, 255, 0); 50 | 51 | bool device_state[devicesCount]; 52 | byte mac[6]; 53 | 54 | ESP8266WebServer server(80); 55 | 56 | void handleNotFound() { 57 | String message = "File Not Found\n\n"; 58 | message += "URI: "; 59 | message += server.uri(); 60 | message += "\nMethod: "; 61 | message += (server.method() == HTTP_GET) ? "GET" : "POST"; 62 | message += "\nArguments: "; 63 | message += server.args(); 64 | message += "\n"; 65 | for (uint8_t i = 0; i < server.args(); i++) { 66 | message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 67 | } 68 | server.send(404, "text/plain", message); 69 | } 70 | 71 | void SwitchOn433(uint8_t c) { 72 | 73 | for (int x = 0; x < repeatTransmit; x++) { 74 | 75 | if (c <= 3) { 76 | mySwitch.switchOn(houseCodeA, deviceId[c]); 77 | delay(transmitterDelay); 78 | } 79 | else { 80 | mySwitch.switchOn(houseCodeB, deviceId[c]); 81 | delay(transmitterDelay); 82 | 83 | } 84 | 85 | } 86 | 87 | } 88 | void SwitchOff433(uint8_t c) { 89 | 90 | for (int x = 0; x < repeatTransmit; x++) { 91 | 92 | 93 | if (c <= 3) { 94 | mySwitch.switchOff(houseCodeA, deviceId[c]); 95 | delay(transmitterDelay); 96 | 97 | } else { 98 | 99 | mySwitch.switchOff(houseCodeB, deviceId[c]); 100 | delay(transmitterDelay); 101 | } 102 | 103 | } 104 | } 105 | 106 | void setup() { 107 | EEPROM.begin(512); 108 | Serial.begin(115200); 109 | mySwitch.enableTransmit(transmitterPin); 110 | 111 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 112 | pinMode(devicesPins[ch], OUTPUT); 113 | } 114 | 115 | //WiFi.config(strip_ip, gateway_ip, subnet_mask); 116 | 117 | 118 | if (EEPROM.read(1) == 1 || (EEPROM.read(1) == 0 && EEPROM.read(0) == 1)) { 119 | for (uint8_t ch = 0; ch < devicesCount; ch++) { 120 | digitalWrite(devicesPins[ch], OUTPUT); 121 | } 122 | 123 | } 124 | 125 | WiFiManager wifiManager; 126 | wifiManager.autoConnect("New Hue Device"); 127 | 128 | WiFi.macAddress(mac); 129 | 130 | // Port defaults to 8266 131 | // ArduinoOTA.setPort(8266); 132 | 133 | // Hostname defaults to esp8266-[ChipID] 134 | // ArduinoOTA.setHostname("myesp8266"); 135 | 136 | // No authentication by default 137 | // ArduinoOTA.setPassword((const char *)"123"); 138 | 139 | ArduinoOTA.begin(); 140 | 141 | 142 | server.on("/set", []() { 143 | uint8_t device; 144 | 145 | for (uint8_t i = 0; i < server.args(); i++) { 146 | if (server.argName(i) == "light") { 147 | device = server.arg(i).toInt() - 1; 148 | } 149 | else if (server.argName(i) == "on") { 150 | if (server.arg(i) == "True" || server.arg(i) == "true") { 151 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 152 | EEPROM.write(0, 1); 153 | EEPROM.commit(); 154 | } 155 | device_state[device] = true; 156 | digitalWrite(devicesPins[device], HIGH); 157 | SwitchOn433(device); 158 | } 159 | else { 160 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 161 | EEPROM.write(0, 0); 162 | EEPROM.commit(); 163 | } 164 | device_state[device] = false; 165 | digitalWrite(devicesPins[device], LOW); 166 | SwitchOff433(device); 167 | } 168 | } 169 | } 170 | server.send(200, "text/plain", "OK, state:" + device_state[device]); 171 | }); 172 | 173 | server.on("/get", []() { 174 | uint8_t light; 175 | if (server.hasArg("light")) 176 | light = server.arg("light").toInt() - 1; 177 | String power_status; 178 | power_status = device_state[light] ? "true" : "false"; 179 | server.send(200, "text/plain", "{\"on\": " + power_status + "}"); 180 | }); 181 | 182 | server.on("/detect", []() { 183 | 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) + "\"}"); 184 | }); 185 | 186 | server.on("/", []() { 187 | float transitiontime = 100; 188 | if (server.hasArg("startup")) { 189 | if ( EEPROM.read(1) != server.arg("startup").toInt()) { 190 | EEPROM.write(1, server.arg("startup").toInt()); 191 | EEPROM.commit(); 192 | } 193 | } 194 | 195 | for (uint8_t device = 0; device < devicesCount; device++) { 196 | 197 | if (server.hasArg("on")) { 198 | if (server.arg("on") == "true") { 199 | device_state[device] = true; 200 | digitalWrite(devicesPins[device], HIGH); 201 | 202 | SwitchOn433(device); 203 | 204 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 1) { 205 | EEPROM.write(0, 1); 206 | EEPROM.commit(); 207 | } 208 | } else { 209 | device_state[device] = false; 210 | digitalWrite(devicesPins[device], LOW); 211 | SwitchOff433(device); 212 | if (EEPROM.read(1) == 0 && EEPROM.read(0) != 0) { 213 | EEPROM.write(0, 0); 214 | EEPROM.commit(); 215 | } 216 | } 217 | } 218 | } 219 | if (server.hasArg("reset")) { 220 | ESP.reset(); 221 | } 222 | 223 | 224 | String http_content = ""; 225 | http_content += ""; 226 | http_content += ""; 227 | http_content += ""; 228 | http_content += ""; 229 | http_content += "Light Setup"; 230 | http_content += ""; 231 | http_content += ""; 232 | http_content += ""; 233 | http_content += "
"; 234 | http_content += "

Light Setup

"; 235 | http_content += "
"; 236 | http_content += "
"; 237 | http_content += ""; 238 | http_content += "ON"; 239 | http_content += "OFF"; 240 | http_content += "
"; 241 | http_content += "
"; 242 | http_content += ""; 243 | http_content += ""; 244 | http_content += ""; 245 | 246 | server.send(200, "text/html", http_content); 247 | 248 | }); 249 | 250 | 251 | server.onNotFound(handleNotFound); 252 | 253 | server.begin(); 254 | } 255 | 256 | void loop() { 257 | ArduinoOTA.handle(); 258 | server.handleClient(); 259 | } 260 | 261 | 262 | -------------------------------------------------------------------------------- /source/getting_started.rst: -------------------------------------------------------------------------------- 1 | Getting Started 2 | =============== 3 | 4 | Setup is very quick and easy with two main installation methods currently supported. diyHue can be installed either directly on the host machine, or via a docker image. Currently, we recommend installation via Docker as it's much easier to maintain, update and modify! 5 | 6 | .. note:: 7 | While the host and OpenWrt installation methods are currently supported, there are plans to depreciate these installation methods in the future. They will continue to be available, however, they will be community maintained instead of offically supported. For all new installations, we highly recommend using the Docker installation method. 8 | 9 | Please note that although running diyHue on Windows is theoretically possible, many scripts and functions rely on Linux commands. However, with Docker this is possible! Installation on OpenWrt is also supported. 10 | 11 | It is best to have at least one compatible light ready in order to setup and test the system with. 12 | 13 | Docker Install 14 | -------------- 15 | 16 | Currently the docker image has been tested with x86 systems and ARMv7 systems (Raspberry Pi 2 and later). Currently the ARM image has only been tested with a Raspberry Pi 3b+ If you have other ARM based devices and can test the image, please let us know on our Slack chat or in an issue. The images can be run with both host and bridge network modes. I recommend using the host network mode for ease, however this will give you less control over your docker networks. Using bridge mode allows you to control the traffic in and out of the container but requires more options to setup. 17 | 18 | To run the container with the host network mode:: 19 | 20 | docker run -d --name diyHue --restart=always --network=host -e MAC=XX:XX:XX:XX:XX:XX -v /mnt/hue-emulator/export:/opt/hue-emulator/export diyhue/core:latest 21 | 22 | .. note:: 23 | When running with the bridge network mode you must provide the IP and MAC address of the host device. Four ports are also opened to the container. These port mappings must not be changed as the hue ecosystem expects to communicate over specific ports. 24 | 25 | To run the container with bridge network mode:: 26 | 27 | docker run -d --name diyHue --restart=always --network=bridge -v /mnt/hue-emulator/export:/opt/hue-emulator/export -e MAC=XX:XX:XX:XX:XX:XX -e IP=XX.XX.XX.XX -p 80:80/tcp -p 443:443/tcp -p 1900:1900/udp -p 2100:2100/udp -p 1982:1982/udp diyhue/core:latest 28 | 29 | These commands will run the latest image available, however if you have automated updates enabled with a service such as `watchtower `_, then using latest is not recommended. The images are automatically rebuilt upon a new commit to this repo. As such, larges changes could occur and updates will be frequent. Each image is also tagged with the commit hash. For example ``diyhue/core:391cc642072aac70d544fd428864f74bf9eaf636``. It is then suggested you use one of these images instead and manually update every so often. 30 | 31 | Alternative tags are also available. Images are tagged as follows: 32 | 33 | * ``branch-commitid`` : This will be a particular commit from the specified branch. 34 | * ``branch`` : This is always the latest image from that particular branch. 35 | * ``runid`` : This can come from any branch. The run id is determined from our `Github Actions page `_ which will indicate the commit, branch, and run id of this image. 36 | * ``latest`` : This will always be the latest update from the ``master`` branch. 37 | 38 | The mount directory ``/mnt/hue-emulator/export/`` can be changed to any directory you wish. Backups of the config.json and cert.pem are saved here when changes are made to these files. They are then restored upon container reboot. If you need to make manual changes to these files, do so with the files mounted on the host (rather than the files in the container) and then restart the container to import your changes. To perform a manual export at any time, visit ``http://{emualtor ip}/save``. If there are no files in the mounted directory then they will be regenerated at container start. 39 | 40 | To update the container: 41 | 42 | * Delete the existing container (Don't worry! This won't delete your configuration as this is stored in the mounted directory.) 43 | 44 | .. code-block:: bash 45 | 46 | docker rm -f diyHue 47 | 48 | * Recreate the container using the commands above, changing the tag if necessary. 49 | 50 | Alternatively, you may utilize the docker-compose file found in the .build directory of the repository to setup diyHue. Once copied, it may be started using ``docker-compose up`` and stopped using ``docker-compose down``. Updates can be achieved by changing the tag in the configuration and restarting ``docker-compose restart``. 51 | 52 | The container will auto-start on host boot or a container crash. 53 | 54 | Host Install 55 | ------------ 56 | 57 | When installing diyHue directly on the host, you have two installation methods available. An easy automatic installation script or the commands to install it manually. The automatic install is highly recommended and is kept most up to date. 58 | 59 | Automatic install 60 | ~~~~~~~~~~~~~~~~~ 61 | 62 | Just run the following command to install:: 63 | 64 | curl -s https://raw.githubusercontent.com/diyhue/diyHue/master/BridgeEmulator/easy_install.sh | sudo bash /dev/stdin 65 | 66 | 67 | Once complete, diyHue is installed and running. It will also automatically start on boot. diyHue can also be stopped, started and restarted with the following command:: 68 | 69 | sudo systemctl [start/stop/restart] hue-emulator.service 70 | 71 | Manual install 72 | ~~~~~~~~~~~~~~ 73 | 74 | * Download or clone the mirror with git (recommended) ``git clone https://github.com/diyhue/diyHue.git`` 75 | * Install nmap package for lights autodiscover ``sudo apt install nmap``. On windows nmap utility is missing and the lights must be added manually in configuration witch is not simple. 76 | * Create startup systemd file based on the following example:: 77 | 78 | sudo nano /lib/systemd/system/hue-emulator.service 79 | 80 | * Paste the following code and edit the path of the emulator script:: 81 | 82 | [Unit] 83 | Description=Hue Emulator Service 84 | After=multi-user.target 85 | 86 | [Service] 87 | Type=idle 88 | Restart=always 89 | RestartSec=30 90 | StartLimitInterval=200 91 | StartLimitBurst=5 92 | 93 | WorkingDirectory=/home/pi 94 | ExecStart=/home/pi/HueEmulator.py 95 | 96 | [Install] 97 | WantedBy=multi-user.target 98 | 99 | * Save and execute the following commands:: 100 | 101 | sudo chmod 644 /lib/systemd/system/hue-emulator.service 102 | sudo systemctl daemon-reload 103 | sudo systemctl enable hue-emulator.service 104 | sudo systemctl start hue-emulator.service 105 | 106 | If you want to disable logging to syslog you must add in systemd file ``StandardOutput=null``. 107 | you can check the service status with ``sudo systemctl status hue-emulator.service`` 108 | 109 | OpenWrt Install 110 | --------------- 111 | 112 | First, run following command:: 113 | 114 | opkg update && opkg install wget ca-bundle nano 115 | 116 | You will need to change to the temporary directory:: 117 | 118 | cd /tmp 119 | 120 | It is also necessary to change 3 lines of code from port 80 to 82:: 121 | 122 | nano /etc/config/uhttpd 123 | 124 | Change... :: 125 | 126 | list listen_http 0.0.0.0:80 127 | list listen_http [::]:80 128 | 129 | to... :: 130 | 131 | list listen_http 0.0.0.0:82 132 | list listen_http [::]:82 133 | 134 | 135 | and also:: 136 | 137 | nano /etc/lighttpd/lighttpd.conf 138 | 139 | Change this... :: 140 | 141 | server.port = 80 142 | 143 | to this... :: 144 | 145 | server.port = 82 146 | 147 | 148 | Finally, run the following command to run the install:: 149 | 150 | wget --no-check-certificate https://raw.githubusercontent.com/diyhue/diyHue/master/BridgeEmulator/easy_openwrt.sh && sh easy_openwrt.sh 151 | 152 | The installation in OpenWrt requires a change to the configuration file for the GUI of luci since it runs on port 80 by default, and diyHue must run on port 80, so it was changed to port 82 following the instructions above. Therefore to enter the OpenWrt configuration you must access: ``http://192.168.8.1:82/cgi-bin/luci`` instead. 153 | 154 | OpenWrt Update 155 | --------------- 156 | 157 | Run the following command to update:: 158 | 159 | cd /tmp && wget --no-check-certificate https://raw.githubusercontent.com/diyhue/diyHue/master/BridgeEmulator/update_openwrt.sh && sh update_openwrt.sh 160 | 161 | After the update has finished, the system will restart automatically. 162 | 163 | Demo 164 | ~~~~ 165 | 166 | .. raw:: html 167 | 168 |
169 | 170 |
171 | --------------------------------------------------------------------------------