From 7e6cb255528751f172477d1ef3590f5bdb7127c2 Mon Sep 17 00:00:00 2001 From: denisfrench Date: Sat, 7 Jan 2017 15:53:39 +1100 Subject: [PATCH 1/6] Add support for WiFi MQTT Relay / Thermostat from OpenEnergyMonitor here; https://guide.openenergymonitor.org/integrations/mqtt-relay/ --- README.md | 4 ++ code/espurna/config/hardware.h | 126 ++++++++++++--------------------- code/platformio.ini | 20 ++++++ images/devices/wifi-relay.jpg | Bin 0 -> 7106 bytes 4 files changed, 69 insertions(+), 81 deletions(-) create mode 100644 images/devices/wifi-relay.jpg diff --git a/README.md b/README.md index 4b8b0bb6..77b72e6f 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,11 @@ For more information please refer to the [ESPurna Wiki](https://bitbucket.org/xo |![IteadStudio Sonoff Dual](images/devices/sonoff-dual.jpg) **IteadStudio Sonoff Dual**|![IteadStudio Sonoff POW](images/devices/sonoff-pow.jpg) **IteadStudio Sonoff POW**|![IteadStudio Sonoff TH10/TH16](images/devices/sonoff-th10-th16.jpg) **IteadStudio Sonoff TH10/TH16**| |![IteadStudio Sonoff RF](images/devices/sonoff-rf.jpg) **IteadStudio Sonoff RF**|![IteadStudio Sonoff SV](images/devices/sonoff-sv.jpg) **IteadStudio Sonoff SV**|![IteadStudio Sonoff Touch](images/devices/sonoff-touch.jpg) **IteadStudio Sonoff Touch**| |![Wemos D1 Mini Relay Shield](images/devices/d1mini.jpg) **Wemos D1 Mini Relay Shield**|![Electrodragon Relay Board](images/devices/electrodragon-relay-board.jpg) **Electrodragon Relay Board**|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg) **WorkChoice EcoPlug**| +<<<<<<< HEAD |![JanGoe Wifi Relay (NO/NC)](images/devices/jangoe-wifi-relay.png) **JanGoe Wifi Relay (NO/NC)**||| +======= +|![WiFi MQTT Relay / Thermostat](images/devices/wifi-relay.jpg) **WiFi MQTT Relay / Thermostat**| +>>>>>>> Add support for WiFi MQTT Relay / Thermostat from OpenEnergyMonitor here; https://guide.openenergymonitor.org/integrations/mqtt-relay/ ## License diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 2d0dd5f2..771773bf 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1,3 +1,35 @@ +//-------------------------------------------------------------------------------- +// HARDWARE +// This setting is normally provided by PlatformIO +// Uncomment the appropiate line to build from the Arduino IDE +//-------------------------------------------------------------------------------- + +//#define NODEMCUV2 +//#define SONOFF +//#define SONOFF_TH +//#define SLAMPHER +//#define S20 +//#define SONOFF_SV +//#define SONOFF_POW +//#define SONOFF_DUAL +//#define SONOFF_4CH +//#define ESP_RELAY_BOARD +//#define ECOPLUG +//#define ESPURNA +//#define WIFI_RELAY + +//#define ENABLE_DHT 1 +//#define ENABLE_DS18B20 1 +//#define ENABLE_EMON 1 +//#define ENABLE_HLW8018 1 +//#define ENABLE_RF 1 +//#define ENABLE_FAUXMO 0 +//#define ENABLE_NOFUSS 1 + +#ifndef ENABLE_FAUXMO + #define ENABLE_FAUXMO 1 +#endif + // ----------------------------------------------------------------------------- // Development boards // ----------------------------------------------------------------------------- @@ -7,9 +39,7 @@ #define MANUFACTURER "NODEMCU" #define DEVICE "LOLIN" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 2 #define LED1_PIN_INVERSE 1 @@ -18,7 +48,6 @@ #define MANUFACTURER "WEMOS" #define DEVICE "D1_MINI" #define RELAY1_PIN 5 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 2 #define LED1_PIN_INVERSE 1 @@ -31,9 +60,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -42,9 +69,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_TH" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -53,9 +78,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_SV" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -64,9 +87,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SLAMPHER" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -75,9 +96,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "S20" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -86,9 +105,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_TOUCH" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -97,9 +114,7 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_POW" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 15 #define LED1_PIN_INVERSE 0 #define ENABLE_POW 1 @@ -119,42 +134,16 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_4CH" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define BUTTON2_PIN 9 - #define BUTTON2_RELAY 2 #define BUTTON3_PIN 10 - #define BUTTON3_RELAY 3 #define BUTTON4_PIN 14 - #define BUTTON4_RELAY 4 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define RELAY2_PIN 5 - #define RELAY2_PIN_INVERSE 0 #define RELAY3_PIN 4 - #define RELAY3_PIN_INVERSE 0 #define RELAY4_PIN 15 - #define RELAY4_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 -#elif defined(ITEAD_1CH_INCHING) - - // Note: definitions for this board are based on third party data - // and have not been fully tested yet. If you have the chance to - // test them, please report back. Thank you. - - #define MANUFACTURER "ITEAD" - #define DEVICE "1CH_INCHING" - #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 - #define BUTTON2_PIN 15 - #define BUTTON2_RELAY 0 - #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 0 - #define LED_PULSE 14 - // ----------------------------------------------------------------------------- // Electrodragon boards // ----------------------------------------------------------------------------- @@ -164,13 +153,9 @@ #define MANUFACTURER "ELECTRODRAGON" #define DEVICE "ESP_RELAY_BOARD" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define BUTTON2_PIN 2 - #define BUTTON2_RELAY 2 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define RELAY2_PIN 13 - #define RELAY2_PIN_INVERSE 0 #define LED1_PIN 16 #define LED1_PIN_INVERSE 0 @@ -183,42 +168,10 @@ #define MANUFACTURER "WORKCHOICE" #define DEVICE "ECOPLUG" #define BUTTON1_PIN 13 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 15 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 2 #define LED1_PIN_INVERSE 0 -// ----------------------------------------------------------------------------- -// JanGoe Wifi Relay (https://github.com/JanGoe/esp8266-wifi-relay) -// ----------------------------------------------------------------------------- - -#elif defined(WIFI_RELAY_NC) - - #define MANUFACTURER "JANGOE" - #define DEVICE "WIFI_RELAY_NC" - #define BUTTON1_PIN 12 - #define BUTTON1_RELAY 1 - #define BUTTON2_PIN 13 - #define BUTTON2_RELAY 2 - #define RELAY1_PIN 2 - #define RELAY1_PIN_INVERSE 1 - #define RELAY2_PIN 14 - #define RELAY2_PIN_INVERSE 1 - -#elif defined(WIFI_RELAY_NO) - - #define MANUFACTURER "JANGOE" - #define DEVICE "WIFI_RELAY_NO" - #define BUTTON1_PIN 12 - #define BUTTON1_RELAY 1 - #define BUTTON2_PIN 13 - #define BUTTON2_RELAY 2 - #define RELAY1_PIN 2 - #define RELAY1_PIN_INVERSE 0 - #define RELAY2_PIN 14 - #define RELAY2_PIN_INVERSE 0 - // ----------------------------------------------------------------------------- // ESPurna board (still beta) // ----------------------------------------------------------------------------- @@ -228,12 +181,23 @@ #define MANUFACTURER "TINKERMAN" #define DEVICE "ESPURNA" #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 - #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 0 +// ----------------------------------------------------------------------------- +// WiFi MQTT Relay / Thermostat +// ----------------------------------------------------------------------------- + +#elif defined(WIFI_RELAY) + + #define MANUFACTURER "OPENENERGYMONITOR" + #define DEVICE "WIFI_RELAY" + #define BUTTON1_PIN 0 + #define RELAY1_PIN 12 + #define LED1_PIN 16 + #define LED1_PIN_INVERSE 0 + // ----------------------------------------------------------------------------- // Unknown hardware // ----------------------------------------------------------------------------- diff --git a/code/platformio.ini b/code/platformio.ini index cb9ca7eb..6a58662c 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -264,6 +264,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +<<<<<<< HEAD [env:jangoe-debug] platform = espressif8266 framework = arduino @@ -281,6 +282,25 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py build_flags = -g -DDEBUG_PORT=Serial -DWIFI_RELAY_NC +======= +[env:wifi-relay-debug] +platform = espressif8266 +framework = arduino +board = esp_wroom_02 +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +extra_script = pio_hooks.py +build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DWIFI_RELAY -DENABLE_DS18B20=1 + +[env:wifi-relay-debug-ota] +platform = espressif8266 +framework = arduino +board = esp_wroom_02 +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +extra_script = pio_hooks.py +build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DWIFI_RELAY -DENABLE_DS18B20=1 +>>>>>>> Add support for WiFi MQTT Relay / Thermostat from OpenEnergyMonitor here; https://guide.openenergymonitor.org/integrations/mqtt-relay/ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 diff --git a/images/devices/wifi-relay.jpg b/images/devices/wifi-relay.jpg new file mode 100644 index 0000000000000000000000000000000000000000..942bbc4dda31c24e6cbd20aad69da278171e0d6f GIT binary patch literal 7106 zcmdT{XH=6*w+3WO>}suYpS`O5k3UH8}hdH2j(^G;d&+536+n)S~4`1v;g3s^^A2S7nV0dT%( zfb%JU7T^*U)nEO>sHrbe)6&z@($LT{(a~L|XJKMxWnp4rX5--HVq@oFXJ+9N;O61u zyLRmwE7u=_0{nu!{MY#Zaza5(O-)Nf%ScPh$j`>Y#{Yk|^ELqM<%_tas3=$gl&lm~ ztQ6<%0Db@kfP(rW+W#0O1=S@QTI$OeyGASk3M$Hr(CO)~T&DWR5eiDGORUs1Y_vDz z*zZFsIXDGxnLYGHT4#|5rov(1ITq?)Wa? z|7m}t{RKu%Lwm7#la&HMc`>D;prN7qXFL~JtZbLqZ&3?sn%$7Q|IiUd!*PL<2l0Ek zb3O@RxHv}1O2rCL2b>=L?eYJ?2YF)3bJxY|dG+N)X6JZ%crh$&#~(7Y*-+u_?s(nC)$eYPIlD~Fiza%Yei7gYmWRraXH5_N(eb1s zo))lwPA2}O?Dtf&=akG3~A$MhqVp)N#IFBir!j45F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uZ2R2b>=<(pAQ0+(i6)6+O-WXw zU#gLOOHaK%xjO*e{fkTdH?o3-;G1e!RT{}h^<5@i}f0U$6XDd_?RqA@yZb!YVa}F^wuU|#p^$gr+nyCFfSULqW zKq(I*LHoGgxJ+jPZK21E)e64X58L> Date: Thu, 12 Jan 2017 20:36:56 +1100 Subject: [PATCH 2/6] Add #define RELAY1_PIN_INVERSE 0 to hardware.h --- code/espurna/config/hardware.h | 1 + 1 file changed, 1 insertion(+) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 771773bf..f095bff7 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -195,6 +195,7 @@ #define DEVICE "WIFI_RELAY" #define BUTTON1_PIN 0 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 16 #define LED1_PIN_INVERSE 0 From 20646803f192afb820edc0606e1d8bd33bdd35a7 Mon Sep 17 00:00:00 2001 From: denisfrench Date: Sat, 28 Jan 2017 15:34:29 +1100 Subject: [PATCH 3/6] Rename wifi-relay to mqtt-relay to deconfict with other hardware --- code/espurna/config/hardware.h | 6 +++--- images/devices/{wifi-relay.jpg => mqtt-relay.jpg} | Bin 2 files changed, 3 insertions(+), 3 deletions(-) rename images/devices/{wifi-relay.jpg => mqtt-relay.jpg} (100%) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index f095bff7..896221f7 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -16,7 +16,7 @@ //#define ESP_RELAY_BOARD //#define ECOPLUG //#define ESPURNA -//#define WIFI_RELAY +//#define MQTT_RELAY //#define ENABLE_DHT 1 //#define ENABLE_DS18B20 1 @@ -189,10 +189,10 @@ // WiFi MQTT Relay / Thermostat // ----------------------------------------------------------------------------- -#elif defined(WIFI_RELAY) +#elif defined(MQTT_RELAY) #define MANUFACTURER "OPENENERGYMONITOR" - #define DEVICE "WIFI_RELAY" + #define DEVICE "MQTT_RELAY" #define BUTTON1_PIN 0 #define RELAY1_PIN 12 #define RELAY1_PIN_INVERSE 0 diff --git a/images/devices/wifi-relay.jpg b/images/devices/mqtt-relay.jpg similarity index 100% rename from images/devices/wifi-relay.jpg rename to images/devices/mqtt-relay.jpg From 786af765af14dc3a3e86d6ddbc0c2189f829dd81 Mon Sep 17 00:00:00 2001 From: denisfrench Date: Sat, 28 Jan 2017 17:32:11 +1100 Subject: [PATCH 4/6] Resolve messy rebase --- README.md | 6 +----- code/espurna/config/arduino.h | 1 + code/platformio.ini | 15 ++++++++------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 77b72e6f..e617f38c 100644 --- a/README.md +++ b/README.md @@ -51,11 +51,7 @@ For more information please refer to the [ESPurna Wiki](https://bitbucket.org/xo |![IteadStudio Sonoff Dual](images/devices/sonoff-dual.jpg) **IteadStudio Sonoff Dual**|![IteadStudio Sonoff POW](images/devices/sonoff-pow.jpg) **IteadStudio Sonoff POW**|![IteadStudio Sonoff TH10/TH16](images/devices/sonoff-th10-th16.jpg) **IteadStudio Sonoff TH10/TH16**| |![IteadStudio Sonoff RF](images/devices/sonoff-rf.jpg) **IteadStudio Sonoff RF**|![IteadStudio Sonoff SV](images/devices/sonoff-sv.jpg) **IteadStudio Sonoff SV**|![IteadStudio Sonoff Touch](images/devices/sonoff-touch.jpg) **IteadStudio Sonoff Touch**| |![Wemos D1 Mini Relay Shield](images/devices/d1mini.jpg) **Wemos D1 Mini Relay Shield**|![Electrodragon Relay Board](images/devices/electrodragon-relay-board.jpg) **Electrodragon Relay Board**|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg) **WorkChoice EcoPlug**| -<<<<<<< HEAD -|![JanGoe Wifi Relay (NO/NC)](images/devices/jangoe-wifi-relay.png) **JanGoe Wifi Relay (NO/NC)**||| -======= -|![WiFi MQTT Relay / Thermostat](images/devices/wifi-relay.jpg) **WiFi MQTT Relay / Thermostat**| ->>>>>>> Add support for WiFi MQTT Relay / Thermostat from OpenEnergyMonitor here; https://guide.openenergymonitor.org/integrations/mqtt-relay/ +|![JanGoe Wifi Relay (NO/NC)](images/devices/jangoe-wifi-relay.png) **JanGoe Wifi Relay (NO/NC)**|![WiFi MQTT Relay / Thermostat](images/devices/mqtt-relay.jpg) **WiFi MQTT Relay / Thermostat**|| ## License diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 489c42b8..437148c3 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -28,6 +28,7 @@ //#define WIFI_RELAY_NC //#define WIFI_RELAY_NO //#define ESPURNA +//#define MQTT_RELAY //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/platformio.ini b/code/platformio.ini index 6a58662c..a2c135f4 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -264,7 +264,6 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 -<<<<<<< HEAD [env:jangoe-debug] platform = espressif8266 framework = arduino @@ -282,25 +281,27 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py build_flags = -g -DDEBUG_PORT=Serial -DWIFI_RELAY_NC -======= -[env:wifi-relay-debug] +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 + +[env:mqtt-relay-debug] platform = espressif8266 framework = arduino board = esp_wroom_02 lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py -build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DWIFI_RELAY -DENABLE_DS18B20=1 +build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DMQTT_RELAY -DENABLE_DS18B20=1 -[env:wifi-relay-debug-ota] +[env:mqtt-relay-debug-ota] platform = espressif8266 framework = arduino board = esp_wroom_02 lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py -build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DWIFI_RELAY -DENABLE_DS18B20=1 ->>>>>>> Add support for WiFi MQTT Relay / Thermostat from OpenEnergyMonitor here; https://guide.openenergymonitor.org/integrations/mqtt-relay/ +build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DMQTT_RELAY -DENABLE_DS18B20=1 upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 From 191c4e9d3f9cff672553bbee27eb9fc2d832798d Mon Sep 17 00:00:00 2001 From: denisfrench Date: Sat, 28 Jan 2017 17:47:58 +1100 Subject: [PATCH 5/6] Manually copy-in hardware.h changes after rebase --- code/espurna/config/hardware.h | 114 ++++++++++++++++++++++++--------- 1 file changed, 82 insertions(+), 32 deletions(-) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 896221f7..04610f3d 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1,35 +1,3 @@ -//-------------------------------------------------------------------------------- -// HARDWARE -// This setting is normally provided by PlatformIO -// Uncomment the appropiate line to build from the Arduino IDE -//-------------------------------------------------------------------------------- - -//#define NODEMCUV2 -//#define SONOFF -//#define SONOFF_TH -//#define SLAMPHER -//#define S20 -//#define SONOFF_SV -//#define SONOFF_POW -//#define SONOFF_DUAL -//#define SONOFF_4CH -//#define ESP_RELAY_BOARD -//#define ECOPLUG -//#define ESPURNA -//#define MQTT_RELAY - -//#define ENABLE_DHT 1 -//#define ENABLE_DS18B20 1 -//#define ENABLE_EMON 1 -//#define ENABLE_HLW8018 1 -//#define ENABLE_RF 1 -//#define ENABLE_FAUXMO 0 -//#define ENABLE_NOFUSS 1 - -#ifndef ENABLE_FAUXMO - #define ENABLE_FAUXMO 1 -#endif - // ----------------------------------------------------------------------------- // Development boards // ----------------------------------------------------------------------------- @@ -39,7 +7,9 @@ #define MANUFACTURER "NODEMCU" #define DEVICE "LOLIN" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 2 #define LED1_PIN_INVERSE 1 @@ -48,6 +18,7 @@ #define MANUFACTURER "WEMOS" #define DEVICE "D1_MINI" #define RELAY1_PIN 5 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 2 #define LED1_PIN_INVERSE 1 @@ -60,7 +31,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -69,7 +42,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_TH" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -78,7 +53,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_SV" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -87,7 +64,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SLAMPHER" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -96,7 +75,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "S20" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -105,7 +86,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_TOUCH" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 @@ -114,7 +97,9 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_POW" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 15 #define LED1_PIN_INVERSE 0 #define ENABLE_POW 1 @@ -134,16 +119,42 @@ #define MANUFACTURER "ITEAD" #define DEVICE "SONOFF_4CH" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define BUTTON2_PIN 9 + #define BUTTON2_RELAY 2 #define BUTTON3_PIN 10 + #define BUTTON3_RELAY 3 #define BUTTON4_PIN 14 + #define BUTTON4_RELAY 4 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define RELAY2_PIN 5 + #define RELAY2_PIN_INVERSE 0 #define RELAY3_PIN 4 + #define RELAY3_PIN_INVERSE 0 #define RELAY4_PIN 15 + #define RELAY4_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 +#elif defined(ITEAD_1CH_INCHING) + + // Note: definitions for this board are based on third party data + // and have not been fully tested yet. If you have the chance to + // test them, please report back. Thank you. + + #define MANUFACTURER "ITEAD" + #define DEVICE "1CH_INCHING" + #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 + #define BUTTON2_PIN 15 + #define BUTTON2_RELAY 0 + #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 0 + #define LED_PULSE 14 + // ----------------------------------------------------------------------------- // Electrodragon boards // ----------------------------------------------------------------------------- @@ -153,9 +164,13 @@ #define MANUFACTURER "ELECTRODRAGON" #define DEVICE "ESP_RELAY_BOARD" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define BUTTON2_PIN 2 + #define BUTTON2_RELAY 2 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define RELAY2_PIN 13 + #define RELAY2_PIN_INVERSE 0 #define LED1_PIN 16 #define LED1_PIN_INVERSE 0 @@ -168,10 +183,42 @@ #define MANUFACTURER "WORKCHOICE" #define DEVICE "ECOPLUG" #define BUTTON1_PIN 13 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 15 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 2 #define LED1_PIN_INVERSE 0 +// ----------------------------------------------------------------------------- +// JanGoe Wifi Relay (https://github.com/JanGoe/esp8266-wifi-relay) +// ----------------------------------------------------------------------------- + +#elif defined(WIFI_RELAY_NC) + + #define MANUFACTURER "JANGOE" + #define DEVICE "WIFI_RELAY_NC" + #define BUTTON1_PIN 12 + #define BUTTON1_RELAY 1 + #define BUTTON2_PIN 13 + #define BUTTON2_RELAY 2 + #define RELAY1_PIN 2 + #define RELAY1_PIN_INVERSE 1 + #define RELAY2_PIN 14 + #define RELAY2_PIN_INVERSE 1 + +#elif defined(WIFI_RELAY_NO) + + #define MANUFACTURER "JANGOE" + #define DEVICE "WIFI_RELAY_NO" + #define BUTTON1_PIN 12 + #define BUTTON1_RELAY 1 + #define BUTTON2_PIN 13 + #define BUTTON2_RELAY 2 + #define RELAY1_PIN 2 + #define RELAY1_PIN_INVERSE 0 + #define RELAY2_PIN 14 + #define RELAY2_PIN_INVERSE 0 + // ----------------------------------------------------------------------------- // ESPurna board (still beta) // ----------------------------------------------------------------------------- @@ -181,7 +228,9 @@ #define MANUFACTURER "TINKERMAN" #define DEVICE "ESPURNA" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 13 #define LED1_PIN_INVERSE 0 @@ -194,6 +243,7 @@ #define MANUFACTURER "OPENENERGYMONITOR" #define DEVICE "MQTT_RELAY" #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 #define RELAY1_PIN 12 #define RELAY1_PIN_INVERSE 0 #define LED1_PIN 16 From 61f487c1ea393d2a20737e1fd89e1b8657192a78 Mon Sep 17 00:00:00 2001 From: denisfrench Date: Sat, 28 Jan 2017 19:44:40 +1100 Subject: [PATCH 6/6] Remove FAUXMO build define switch from mqtt-relay environment --- code/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/platformio.ini b/code/platformio.ini index a2c135f4..843b95d4 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -292,7 +292,7 @@ board = esp_wroom_02 lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py -build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DMQTT_RELAY -DENABLE_DS18B20=1 +build_flags = -g -DDEBUG_PORT=Serial -DMQTT_RELAY -DENABLE_DS18B20=1 [env:mqtt-relay-debug-ota] platform = espressif8266 @@ -301,7 +301,7 @@ board = esp_wroom_02 lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py -build_flags = -g -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DMQTT_RELAY -DENABLE_DS18B20=1 +build_flags = -g -DDEBUG_PORT=Serial -DMQTT_RELAY -DENABLE_DS18B20=1 upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266