From b102ec52e4173d3f8ae882962d7e019dcded31ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 28 Nov 2016 15:55:45 +0100 Subject: [PATCH] Declared all libraries as PlatformIO dependencies, updated documentation --- .gitmodules | 18 ------ code/.gitignore | 4 ++ code/lib/EmonLiteESP | 1 - code/lib/HLW8012 | 1 - code/lib/JustWifi | 1 - code/lib/NoFUSSClient | 1 - code/lib/RemoteSwitch | 1 - code/lib/fauxmoESP | 1 - code/platformio.custom.ini | 20 ++++++- code/platformio.official.ini | 76 ++++++++++++++---------- code/src/fauxmo.ino | 6 +- code/vendor/RemoteSwitch-arduino-library | 1 - code/vendor/emonliteesp | 1 - code/vendor/nofuss | 1 - docs/Firmware.md | 39 ++++++------ 15 files changed, 92 insertions(+), 80 deletions(-) create mode 100644 code/.gitignore delete mode 120000 code/lib/EmonLiteESP delete mode 160000 code/lib/HLW8012 delete mode 160000 code/lib/JustWifi delete mode 120000 code/lib/NoFUSSClient delete mode 120000 code/lib/RemoteSwitch delete mode 160000 code/lib/fauxmoESP delete mode 160000 code/vendor/RemoteSwitch-arduino-library delete mode 160000 code/vendor/emonliteesp delete mode 160000 code/vendor/nofuss diff --git a/.gitmodules b/.gitmodules index e89abbbe..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +0,0 @@ -[submodule "code/vendor/nofuss"] - path = code/vendor/nofuss - url = https://bitbucket.org/xoseperez/nofuss.git -[submodule "code/vendor/emonliteesp"] - path = code/vendor/emonliteesp - url = https://bitbucket.org/xoseperez/emonliteesp.git -[submodule "code/vendor/RemoteSwitch-arduino-library"] - path = code/vendor/RemoteSwitch-arduino-library - url = https://github.com/jccprj/RemoteSwitch-arduino-library -[submodule "code/lib/JustWifi"] - path = code/lib/JustWifi - url = https://bitbucket.org/xoseperez/justwifi -[submodule "code/lib/HLW8012"] - path = code/lib/HLW8012 - url = https://bitbucket.org/xoseperez/hlw8012.git -[submodule "code/lib/fauxmoESP"] - path = code/lib/fauxmoESP - url = https://bitbucket.org/xoseperez/fauxmoesp.git diff --git a/code/.gitignore b/code/.gitignore new file mode 100644 index 00000000..e05273b2 --- /dev/null +++ b/code/.gitignore @@ -0,0 +1,4 @@ +.pioenvs +.clang_complete +.gcc-flags.json +.piolibdeps \ No newline at end of file diff --git a/code/lib/EmonLiteESP b/code/lib/EmonLiteESP deleted file mode 120000 index 048e3b79..00000000 --- a/code/lib/EmonLiteESP +++ /dev/null @@ -1 +0,0 @@ -../vendor/emonliteesp/code/lib/EmonLiteESP \ No newline at end of file diff --git a/code/lib/HLW8012 b/code/lib/HLW8012 deleted file mode 160000 index 1dfa68b9..00000000 --- a/code/lib/HLW8012 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1dfa68b9e79a4a8ea96df4ed20f64e0c12ee9d26 diff --git a/code/lib/JustWifi b/code/lib/JustWifi deleted file mode 160000 index 012b9773..00000000 --- a/code/lib/JustWifi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 012b9773add97ba5675b62e70f14164a38024010 diff --git a/code/lib/NoFUSSClient b/code/lib/NoFUSSClient deleted file mode 120000 index 51a070f9..00000000 --- a/code/lib/NoFUSSClient +++ /dev/null @@ -1 +0,0 @@ -../vendor/nofuss/client/lib/NoFUSSClient \ No newline at end of file diff --git a/code/lib/RemoteSwitch b/code/lib/RemoteSwitch deleted file mode 120000 index a3467d9d..00000000 --- a/code/lib/RemoteSwitch +++ /dev/null @@ -1 +0,0 @@ -../vendor/RemoteSwitch-arduino-library \ No newline at end of file diff --git a/code/lib/fauxmoESP b/code/lib/fauxmoESP deleted file mode 160000 index 175e4ff6..00000000 --- a/code/lib/fauxmoESP +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 175e4ff668be6bc4f9cb42e579b38403c3b6f063 diff --git a/code/platformio.custom.ini b/code/platformio.custom.ini index f4647173..54b155e2 100644 --- a/code/platformio.custom.ini +++ b/code/platformio.custom.ini @@ -12,9 +12,25 @@ env_default = node-debug [common] platform = espressif8266 framework = arduino -lib_install = 19,31,44,64,305,306,346,359,408,727 extra_script = pio_hooks.py -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP +lib_deps = + 19 + 31 + 44 + 64 + 305 + 306 + 346 + 359 + 408 + 727 + https://bitbucket.org/xoseperez/justwifi.git + https://bitbucket.org/xoseperez/nofuss.git + https://bitbucket.org/xoseperez/hlw8012.git + https://bitbucket.org/xoseperez/emonliteesp.git + https://bitbucket.org/xoseperez/fauxmoESP.git + https://github.com/jccprj/RemoteSwitch-arduino-library [ota] upload_speed = 115200 diff --git a/code/platformio.official.ini b/code/platformio.official.ini index 11c015d2..7499831a 100644 --- a/code/platformio.official.ini +++ b/code/platformio.official.ini @@ -2,96 +2,112 @@ env_default = node-debug [common] -lib_install = 19,31,44,64,305,306,346,359,408,727 +lib_deps = + 19 + 31 + 44 + 64 + 305 + 306 + 346 + 359 + 408 + 727 + https://bitbucket.org/xoseperez/justwifi.git + https://bitbucket.org/xoseperez/nofuss.git + https://bitbucket.org/xoseperez/hlw8012.git + https://bitbucket.org/xoseperez/emonliteesp.git + https://bitbucket.org/xoseperez/fauxmoesp.git + https://github.com/jccprj/RemoteSwitch-arduino-library [env:sonoff-debug] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:sonoff-debug-ota] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:sonoff-pow-debug] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF_POW -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:sonoff-pow-debug-ota] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF_POW upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:slampher-debug] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSLAMPHER -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:slampher-debug-ota] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSLAMPHER upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:s20-debug] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DS20 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:s20-debug-ota] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DS20 upload_speed = 115200 upload_port = "192.168.4.1" +lib_ignore = FauxmoESP upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP [env:node-debug] platform = espressif8266_stage framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = nodemcuv2 build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial -DENABLE_FAUXMO=1 @@ -99,14 +115,14 @@ build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial -DENABLE_FAUXMO=1 [env:node-debug-ota] platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = nodemcuv2 build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP @@ -114,50 +130,50 @@ lib_ignore = fauxmoESP topic = /home/cellar/airconditioner/ip platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DS20 upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:washer-device] topic = /home/cellar/washer/ip platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF -DENABLE_EMON=1 -DENABLE_DHT=1 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP [env:studio-lamp-device] topic = /home/studio/lamp/ip -platform = espressif8266 +platform = espressif8266_stage framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m -build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF +build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF -DENABLE_FAUXMO=1 upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = [env:living-lamp-device] topic = /home/living/lamp/ip platform = espressif8266 framework = arduino -lib_install = ${common.lib_install} +lib_deps = ${common.lib_deps} extra_script = pio_hooks.py board = esp01_1m build_flags = -Wl,-Tesp8266.flash.1m256.ld -DDEBUG_PORT=Serial -DSONOFF upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -lib_ignore = fauxmoESP +lib_ignore = FauxmoESP diff --git a/code/src/fauxmo.ino b/code/src/fauxmo.ino index cd32c601..245432c0 100644 --- a/code/src/fauxmo.ino +++ b/code/src/fauxmo.ino @@ -18,14 +18,14 @@ fauxmoESP fauxmo; // ----------------------------------------------------------------------------- void fauxmoConfigure() { - fauxmo.setDeviceName(getSetting("hostname", HOSTNAME).c_str()); fauxmo.enable(getSetting("fauxmoEnabled", String(FAUXMO_ENABLED)).toInt() == 1); } void fauxmoSetup() { fauxmoConfigure(); - fauxmo.onMessage([](bool state) { - DEBUG_MSG("[FAUXMO] State: %s\n", state ? "ON" : "OFF"); + fauxmo.addDevice(getSetting("hostname", HOSTNAME).c_str()); + fauxmo.onMessage([](const char * name, bool state) { + DEBUG_MSG("[FAUXMO] %s state: %s\n", name, state ? "ON" : "OFF"); relayStatus(0, state); }); } diff --git a/code/vendor/RemoteSwitch-arduino-library b/code/vendor/RemoteSwitch-arduino-library deleted file mode 160000 index 6a382a72..00000000 --- a/code/vendor/RemoteSwitch-arduino-library +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a382a72de81fc8a15dde391be174777d7ba80ca diff --git a/code/vendor/emonliteesp b/code/vendor/emonliteesp deleted file mode 160000 index 84ab031a..00000000 --- a/code/vendor/emonliteesp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 84ab031a5e7022183a78e5e69fa84d68007952d0 diff --git a/code/vendor/nofuss b/code/vendor/nofuss deleted file mode 160000 index 49322fb1..00000000 --- a/code/vendor/nofuss +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 49322fb1927ac465fbfe996af903daaeb3ff7845 diff --git a/docs/Firmware.md b/docs/Firmware.md index 80775080..dfb8afb2 100644 --- a/docs/Firmware.md +++ b/docs/Firmware.md @@ -5,24 +5,27 @@ The project is ready to be build using [PlatformIO][1]. Please refer to their web page for instructions on how to install the builder. -PlatformIO will take care of some of the library dependencies, but not all the required libraries are available in the platform library manager. Some dependencies are thus checked out as submodules in GIT. So the normal initial checkout should be: - -``` -git clone https://bitbucket.org/xoseperez/espurna.git -git submodule init -git submodule update -``` - -On linux/max systems the libraries are soft linked to the code/lib folder and you are ready to go. Windows systems do not have this feature so you will have to copy them manually like this (ONLY WINDOWS): - -``` -cd espurna/code -copy vendor/emonliteesp/code/lib/EmonLiteESP lib/EmonLiteESP -copy vendor/nofuss/client/lib/NoFUSSClient lib/NoFUSSClient -copy vendor/RemoteSwitch-arduino-library lib/RemoteSwitch -``` - -This libraries are optional at the moment and will only be linked if you set ENABLE_NOFUSS, ENABLE_EMON or ENABLE_RF from your build flag. +If you are using PlatformIO /strongly recommended) it will take care of the library dependencies. Otherwise you will have to install them manually: + +* Benoit Blanchon's [ArduinoJson](https://github.com/bblanchon/ArduinoJson) +* Hristo Gochkov's [ESPAsyncTCP](https://github.com/me-no-dev/ESPAsyncTCP) +* Hristo Gochkov's [ESPAsyncUDP](https://github.com/me-no-dev/ESPAsyncUDP) +* Hristo Gochkov's [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) +* Marvin Roger's [AyncMqttClient](https://github.com/marvinroger/async-mqtt-client) +* Adafruit's [DHT Sensor Library](https://github.com/adafruit/DHT-sensor-library) (required if compiling with DHT support: -DENABLE_DHT) +* Adafruit's [Unified Sensor Library](https://github.com/adafruit/Adafruit_Sensor) (required if compiling with DHT support: -DENABLE_DHT) +* The PatternAgents (et al.) [Embedis](https://github.com/thingSoC/embedis) +* German Martin's [NtpCLientLib](https://github.com/gmag11/NtpClient) +* Michael Maregolis & Paul Stoffregen's [Time](https://github.com/PaulStoffregen/Time) +* Randy Simons' [RemoteSwitch](https://github.com/jccprj/RemoteSwitch-arduino-library) (required if using custom RF module: -DENABLE_RF) + +And my own libraries: + +* [JustWifi](https://bitbucket.org/xoseperez/justwifi.git) +* [FauxmoESP](https://bitbucket.org/xoseperez/fauxmoesp.git) (required if compiling with WeMo emulation support: -DENABLE_FAUXMO) +* [HLW8012](https://bitbucket.org/xoseperez/hlw8012.git) (required if compiling for Sonoff POW: -DENABLE_POW) +* [EmonLiteESP](https://bitbucket.org/xoseperez/emonliteesp.git) (required if compiling with Energy Monitoring support: -DENABLE_EMON) +* [NoFUSS](https://bitbucket.org/xoseperez/nofuss.git) (required if compiling with NoFUSS Automatic OTA support: -DENABLE_NOFUSS) Once you have all the code, you can check if it's working by: