diff --git a/.github/stale.yml b/.github/stale.yml index b9a5d246..046b9c15 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -23,7 +23,7 @@ staleLabel: stale # Comment to post when marking as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had - recent activity. It will be closed in 30 days if no further activity occurs. + recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. # Comment to post when removing the stale label. @@ -32,7 +32,7 @@ markComment: > # Comment to post when closing a stale Issue or Pull Request. closeComment: > - This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem. + This issue will be auto-closed because there hasn't been any activity for two months. Feel free to open a new one if you still experience this problem. # Limit the number of actions per hour, from 1-30. Default is 30 limitPerRun: 30 diff --git a/CHANGELOG.md b/CHANGELOG.md index dbce18a5..30e5f0bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,45 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.13.2] 2018-08-27 +### Fixed +- Fix relay overflow window length +- Fix TravisCI release condition (thanks to @mcspr, [#1042](https://github.com/xoseperez/espurna/issues/1042)) +- Fix Sonoff RFBridge build in Arduino IDE ([#1043](https://github.com/xoseperez/espurna/issues/1043)) +- Using corrent path separator in gulpfile.js (thanks to @InduPrakash, [#1045](https://github.com/xoseperez/espurna/issues/1045)) +- Fix KMC70011 LED logic (thanks to @zerog2k, [#1056](https://github.com/xoseperez/espurna/issues/1056)) +- Fix Luani HVIO to use 1MB flash size and toggle switch (thanks to @BauerPh, [#1065](https://github.com/xoseperez/espurna/issues/1065) and [#1068](https://github.com/xoseperez/espurna/issues/1068)) +- Fix switches in Microsoft Edge (thanks to @Valcob, [#1066](https://github.com/xoseperez/espurna/issues/1066)) +- Fix build.sh error handling (thanks to @mcspr, [#1075](https://github.com/xoseperez/espurna/issues/1075)) +- Correctly init Serial on RELAY_PROVIDER_STM ([#1130](https://github.com/xoseperez/espurna/issues/1130)) +- Disconnect before running WPS and SmartConfig discovery ([#1146](https://github.com/xoseperez/espurna/issues/1146)) +- Fix sort fields in OTA manager + +### Added +- Support for YJZK 1Ch and 3CH switches (thanks to @CollinShorts and @q32103940, [#1047](https://github.com/xoseperez/espurna/issues/1047)) +- Support for AG-L4 color desk lamp (thanks to @zerog2k, [#1050](https://github.com/xoseperez/espurna/issues/1050)) +- Option to cofigure ON/OFF payload at build time ([#1085](https://github.com/xoseperez/espurna/issues/1085)) +- Option to change default payload for HA ([#1085](https://github.com/xoseperez/espurna/issues/1085)) +- Support for Allterco Shelly1 (thanks to @abmantis, [#1128](https://github.com/xoseperez/espurna/issues/1128)) +- Support for HomeCube 16A (thanks to @hyteoo, [#1106](https://github.com/xoseperez/espurna/issues/1106)) +- Support for multiple sonar sensors (thanks to @ruimarinho, [#1116](https://github.com/xoseperez/espurna/issues/1116)) +- Support for hardware serial on PMSX003 device (thanks to @ruimarinho, [#1122](https://github.com/xoseperez/espurna/issues/1122)) +- Support for Lohas 9W bulbs (thanks to @steveway, [#1135](https://github.com/xoseperez/espurna/issues/1135)) +- Show literal for webUI image in info ([#1142](https://github.com/xoseperez/espurna/issues/1142)) +- Add RFBRIDGE code to full webUI image ([#1157](https://github.com/xoseperez/espurna/issues/1157)) +- Handle events in EventSensor +- Option to remove API_SUPPORT at build time +- Option to save total energy in EEPROM after X reports, disabled by default +- Support for DHT12 sensor (thanks to Altan Altay) +- Support for 2MB flash boards + +### Changed +- Update PlatformIO support to 3.6.X branch +- Explicitly disable ATC on RFM69 gateway ([#938](https://github.com/xoseperez/espurna/issues/938)) +- Reduce memory footprint of API calls ([#1133](https://github.com/xoseperez/espurna/issues/1133)) +- Init relay GPIO when in inverse mode to be OFF ([#1078](https://github.com/xoseperez/espurna/issues/1078)) + + ## [1.13.1] 2018-07-10 ### Fixed - Build issues with Arduino IDE ([#975](https://github.com/xoseperez/espurna/issues/975)) diff --git a/README.md b/README.md index 4ba35419..2112fb62 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smart switches, lights and sensors. It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. -[![version](https://img.shields.io/badge/version-1.13.2b-brightgreen.svg)](CHANGELOG.md) +[![version](https://img.shields.io/badge/version-1.13.3a-brightgreen.svg)](CHANGELOG.md) [![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.com/xoseperez/espurna/tree/dev/) [![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna) -[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) +[![codacy](https://api.codacy.com/project/badge/Grade/c9496e25cf07434cba786b462cb15f49)](https://www.codacy.com/app/xoseperez/espurna/dashboard) [![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE)
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xose%2eperez%40gmail%2ecom&lc=US&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest) @@ -15,8 +15,16 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari --- +## Contributors + +**Without your help this project would not be possible**. I (@xoseperez) simply can't spend all the time I wish on ESPurna but luckly I recieve a lot of contributions, bug fixes, enhancement suggestions,... from people all around the world. I would like to thank each and every one of you. The [contributors](https://github.com/xoseperez/espurna/graphs/contributors) page shows the ones that have done a PR in the past, but I also get contributions in the issues, by email or via the [gitter ESPurna channel](https://gitter.im/tinkerman-cat/espurna), those I also want to thank. + +**Thank you all very much**. + ## Notice +> Ladies and gentlemen in the embedded world, use [PlatformIO](https://platformio.org/). If I could offer you only one tip for the future, [PlatformIO](https://platformio.org/) would be it. + > Please use the [gitter ESPurna channel](https://gitter.im/tinkerman-cat/espurna) for support and questions, you have better chances to get fast answers from me or other ESPurna users. Open an issue here only if you feel there is a bug or you want to request an enhancement. Thank you. ## Features @@ -68,7 +76,7 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari * Support for [direct control of the encoder/decoder bypassing the EFM8BB1](https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack) * Support for [different **sensors**](Sensors) * Environment - * **DHT11 / DHT22 / DHT21 / AM2301 / Itead's SI7021** + * **DHT11 / DHT12 / DHT22 / DHT21 / AM2301 / Itead's SI7021** * **BMP280** and **BME280** temperature, humidity (BME280) and pressure sensor by Bosch * **TMP35** and **TMP36** analog temperature sensors * **NTC** temperature sensors @@ -82,6 +90,7 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari * **BH1750** luminosity sensor * **GUVAS12SD** UV sensor * **GEIGER COUNTER** by RH Electronics + * **HC-SR04**, **SRF05**, **SRF06**, **DYP-ME007**, **JSN-SR04T** & **Parallax PING)))™** distance sensors * Power monitoring * **HLW8012** using the [HLW8012 Library](https://bitbucket.org/xoseperez/hlw8012) (Sonoff POW) * **CSE7766** and **CSE7759B** power monitor chips @@ -89,8 +98,8 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari * Non-invasive **current sensor** using **internal ADC** or **ADC712** or **ADC121** or **ADS1115** * **V9261F** power monitor chip * **PZEM0004T** power monitor board - * Raw analog and digital sensors - * Simple pulse counter + * Raw **analog** and **digital** sensors + * Simple **pulse counter** with **event triggering** option * Support for (almost) any UART based sensor via the **UART-to-MQTT module** * Support for different units (Fahrenheit or Celsius, Watts or Kilowatts, Joules or kWh) * Support for LED lights @@ -215,29 +224,33 @@ Here is the list of supported hardware. For more information please refer to the |![Itead Sonoff 4CH Pro](images/devices/itead-sonoff-4ch-pro.jpg)||| |**Itead Sonoff 4CH Pro**||| |![Itead Sonoff S31](images/devices/itead-sonoff-s31.jpg)|![BlitzWolf BW-SPP2](images/devices/blitzwolf-bw-shp2.jpg)|![Power meters based on V9261F](images/devices/generic-v9261f.jpg)| -|**Itead Sonoff S31**|**Blitzwolf BW-SHP2
(also by HomeCube, Coosa, Goosund)**|**Power meters based on V9261F**| +|**Itead Sonoff S31**|**Blitzwolf BW-SHP2
(also by Coosa, Goosund, HomeCube, Teckin)**|**Power meters based on V9261F**| |![Itead Sonoff POW](images/devices/itead-sonoff-pow.jpg)|![Itead Sonoff POW](images/devices/itead-sonoff-pow-r2.jpg)|![Vanzavanzu Smart WiFi Plug Mini](images/devices/vanzavanzu-smart-wifi-plug-mini.jpg)| |**Itead Sonoff POW**|**Itead Sonoff POW R2**|**Vanzavanzu Smart WiFi Plug Mini**| |![Itead Sonoff Basic](images/devices/itead-sonoff-basic.jpg)|![Itead Sonoff Dual/Dual R2](images/devices/itead-sonoff-dual.jpg)|![Itead Sonoff TH10/TH16](images/devices/itead-sonoff-th.jpg)| |**Itead Sonoff Basic**|**Itead Sonoff Dual/Dual R2**|**Itead Sonoff TH10/TH16**| |![Electrodragon WiFi IOT](images/devices/electrodragon-wifi-iot.jpg)|![OpenEnergyMonitor WiFi MQTT Relay / Thermostat](images/devices/openenergymonitor-mqtt-relay.jpg)|| |**Electrodragon WiFi IOT**|**OpenEnergyMonitor WiFi MQTT Relay / Thermostat**|| -|![Itead S20](images/devices/itead-s20.jpg)|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg)|![Neo Coolcam NAS WR01W](images/devices/neo-coolcam-wifi.jpg)| -|**Itead S20**|**WorkChoice EcoPlug**|**Neo Coolcam NAS WR01W**| +|![Itead S20](images/devices/itead-s20.jpg)|![Itead S20](images/devices/itead-s26.jpg)|![Neo Coolcam NAS WR01W](images/devices/neo-coolcam-wifi.jpg)| +|**Itead S20**|**Itead S26**|**Neo Coolcam NAS WR01W**| |![Schuko Wifi Plug](images/devices/schuko-wifi-plug.jpg)|![KMC 70011](images/devices/kmc-70011.jpg)|![Xenon SM-PW702U](images/devices/xenon-sm-pw702u.jpg)| |**Schuko Wifi Plug**|**KMC 70011**|**Xenon SM-PW702U**| |![Maxcio W-US002S](images/devices/maxcio-w-us002s.jpg)|![HEYGO HY02](images/devices/heygo-hy02.jpg)|![YiDian XS-SSA05](images/devices/yidian-xs-ssa05.jpg)| |**Maxcio W-US002S**|**HEYGO HY02**|**YiDian XS-SSA05**| -|![WiOn 50055](images/devices/wion-50055.jpg)|![LINGAN SWA1](images/devices/lingan-swa1.jpg)|| -|**WiOn 50055**|**LINGAN SWA1**|| +|![WiOn 50055](images/devices/wion-50055.jpg)|![LINGAN SWA1](images/devices/lingan-swa1.jpg)|![HomeCube 16A](images/devices/homecube-16a.jpg)| +|**WiOn 50055**|**LINGAN SWA1**|**HomeCube 16A**| +|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg)||| +|**WorkChoice EcoPlug**||| |![Tonbux PowerStrip02](images/devices/tonbux-powerstrip02.jpg)|![ForNorm Power Strip](images/devices/fornorm-power-strip.jpg)|![Zhilde ZLD-EU55-W](images/devices/zhilde-zld-eu55-w.jpg)| |**Tonbux PowerStrip02**|**Fornorm Power Strip**|**Zhilde ZLD-EU55-W**| -|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|![YJZK 2-gang switch](images/devices/yjzk-2gang-switch.jpg)| -|**Itead Sonoff Touch**|**Itead Sonoff T1**|**YJZK 2-gang switch**| +|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|![YJZK switch](images/devices/yjzk-2gang-switch.jpg)| +|**Itead Sonoff Touch**|**Itead Sonoff T1**|**YJZK 1/2/3-gangs switch**| |![Itead Slampher](images/devices/itead-slampher.jpg)|![Arilux E27](images/devices/arilux-e27.jpg)|![Itead Sonoff B1](images/devices/itead-sonoff-b1.jpg)| |**Itead Slampher**|**Arilux E27**|**Itead Sonoff B1**| -|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)|| -|**AI-Thinker Wifi Light / Noduino OpenLight**|**Authometion LYT8266**|| +|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)|![AG-L4](images/devices/ag-l4.jpg)| +|**AI-Thinker Wifi Light / Noduino OpenLight**|**Authometion LYT8266**|**AG-L4**| +|![Lohas 9W](images/devices/lohas-9w.jpg)||| +|**Lohas 9W**||| |![Itead Sonoff LED](images/devices/itead-sonoff-led.jpg)|![Itead BN-SZ01](images/devices/itead-bn-sz01.jpg)|![InterMitTech QuinLED 2.6](images/devices/intermittech-quinled-2.6.jpg)| |**Itead Sonoff LED**|**Itead BN-SZ01**|**InterMitTech QuinLED 2.6**| |![Arilux AL-LC01 (RGB)](images/devices/arilux-al-lc01.jpg)|![Arilux AL-LC02 (RGBW)](images/devices/arilux-al-lc02.jpg)|![Arilux AL-LC06 (RGBWWCW)](images/devices/arilux-al-lc06.jpg)| @@ -248,6 +261,8 @@ Here is the list of supported hardware. For more information please refer to the |**Itead Sonoff SV**|**Itead 1CH Inching**|**Itead Motor Clockwise/Anticlockwise**| |![Jan Goedeke Wifi Relay (NO/NC)](images/devices/jangoe-wifi-relay.jpg)|![Jorge García Wifi + Relays Board Kit](images/devices/jorgegarcia-wifi-relays.jpg)|![EXS Wifi Relay v3.1](images/devices/exs-wifi-relay-v31.jpg)| |**Jan Goedeke Wifi Relay (NO/NC)**|**Jorge García Wifi + Relays Board Kit**|**EXS Wifi Relay v3.1**| +|![Allterco Shelly1](images/devices/allterco-shelly1.jpg)||| +|**Alterco Shelly1**||| |![ManCaveMade ESP-Live](images/devices/mancavemade-esp-live.jpg)|![Wemos D1 Mini Relay Shield](images/devices/wemos-d1-mini-relayshield.jpg)|![Witty Cloud](images/devices/witty-cloud.jpg)| |**ManCaveMade ESP-Live**|**Wemos D1 Mini Relay Shield**|**Witty Cloud**| |![IKE ESPike](images/devices/ike-espike.jpg)|![Pilotak ESP DIN](images/devices/pilotak-esp-din.jpg)|![Arniex Swifitch](images/devices/arniex-swifitch.jpg)| diff --git a/code/build.sh b/code/build.sh index 5ebf5ace..14c95fe0 100755 --- a/code/build.sh +++ b/code/build.sh @@ -10,6 +10,8 @@ is_git() { } # Script settings + +destination=../firmware version=$(grep APP_VERSION espurna/config/version.h | awk '{print $3}' | sed 's/"//g') if is_git; then @@ -104,13 +106,13 @@ build_environments() { platformio run --silent --environment $environment || exit 1 stat -c %s .pioenvs/$environment/firmware.bin [[ "${TRAVIS_BUILD_STAGE_NAME}" = "Test" ]] || \ - mv .pioenvs/$environment/firmware.bin ../firmware/espurna-$version/espurna-$version-$environment.bin + mv .pioenvs/$environment/firmware.bin $destination/espurna-$version/espurna-$version-$environment.bin done echo "--------------------------------------------------------------" } # Parameters -while getopts "lp" opt; do +while getopts "lpd:" opt; do case $opt in l) print_available @@ -119,6 +121,9 @@ while getopts "lp" opt; do p) par_build=true ;; + d) + destination=$OPTARG + ;; esac done diff --git a/code/eagle.flash.1m0m1s.ld b/code/eagle.flash.1m0m1s.ld index 046c3d87..4102c750 100644 --- a/code/eagle.flash.1m0m1s.ld +++ b/code/eagle.flash.1m0m1s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 1M chips */ +/* Flash Split for 1M chips, no SPIFFS, 1 sector for EEPROM */ /* sketch 999KB */ /* eeprom 4KB */ /* reserved 16KB */ diff --git a/code/eagle.flash.1m0m2s.ld b/code/eagle.flash.1m0m2s.ld index bf07dccd..069f337d 100644 --- a/code/eagle.flash.1m0m2s.ld +++ b/code/eagle.flash.1m0m2s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 1M chips, no SPIFFS */ +/* Flash Split for 1M chips, no SPIFFS, 2 sectors for EEPROM */ /* sketch 995KB */ /* eeprom 8KB */ /* reserved 16KB */ @@ -13,7 +13,7 @@ MEMORY PROVIDE ( _SPIFFS_start = 0x402FA000 ); PROVIDE ( _SPIFFS_end = 0x402FA000 ); -PROVIDE ( _SPIFFS_page = 0 ); -PROVIDE ( _SPIFFS_block = 0 ); +PROVIDE ( _SPIFFS_page = 0x0 ); +PROVIDE ( _SPIFFS_block = 0x0 ); INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/code/eagle.flash.2m1m4s.ld b/code/eagle.flash.2m1m4s.ld new file mode 100644 index 00000000..9d300dd1 --- /dev/null +++ b/code/eagle.flash.2m1m4s.ld @@ -0,0 +1,20 @@ +/* Flash Split for 2M chips, ~1M SPIFFS, 4 sectors for EEPROM */ +/* sketch 1019KB */ +/* spiffs 992KB */ +/* eeprom 16KB */ +/* reserved 16KB */ + +MEMORY +{ + dport0_0_seg : org = 0x3FF00000, len = 0x10 + dram0_0_seg : org = 0x3FFE8000, len = 0x14000 + iram1_0_seg : org = 0x40100000, len = 0x8000 + irom0_0_seg : org = 0x40201010, len = 0xfeff0 +} + +PROVIDE ( _SPIFFS_start = 0x40300000 ); +PROVIDE ( _SPIFFS_end = 0x403F8000 ); +PROVIDE ( _SPIFFS_page = 0x100 ); +PROVIDE ( _SPIFFS_block = 0x2000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/code/eagle.flash.4m1m4s.ld b/code/eagle.flash.4m1m4s.ld index 696adcdc..0812c369 100644 --- a/code/eagle.flash.4m1m4s.ld +++ b/code/eagle.flash.4m1m4s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 4M chips */ +/* Flash Split for 4M chips, ~1M for SPIFFS, 4 sectors for EEPROM */ /* sketch 1019KB */ /* empty/ota? 2048KB */ /* spiffs 992KB */ diff --git a/code/eagle.flash.4m3m4e.ld b/code/eagle.flash.4m3m4e.ld index 6470d827..f25a3874 100644 --- a/code/eagle.flash.4m3m4e.ld +++ b/code/eagle.flash.4m3m4e.ld @@ -1,4 +1,4 @@ -/* Flash Split for 4M chips */ +/* Flash Split for 4M chips, ~3M for SPIFFS, 4 sectors for EEPROM */ /* sketch 1019KB */ /* spiffs 3040KB */ /* eeprom 16KB */ diff --git a/code/eagle.flash.512k0m1s.ld b/code/eagle.flash.512k0m1s.ld index e5a819d7..79d17352 100644 --- a/code/eagle.flash.512k0m1s.ld +++ b/code/eagle.flash.512k0m1s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 512K chips */ +/* Flash Split for 512K chips, no SPIFFS, 1 sector for EEPROM */ /* sketch 487KB */ /* eeprom 4KB */ /* reserved 16KB */ diff --git a/code/espurna/alexa.ino b/code/espurna/alexa.ino index 81815d8b..84e5ea2e 100644 --- a/code/espurna/alexa.ino +++ b/code/espurna/alexa.ino @@ -11,13 +11,13 @@ Copyright (C) 2016-2018 by Xose Pérez #include fauxmoESP alexa; -struct AlexaDevChange { - AlexaDevChange(unsigned char device_id, bool state) : device_id(device_id), state(state) {}; - unsigned char device_id = 0; - bool state = false; -}; #include -static std::queue _alexa_dev_changes; +typedef struct { + unsigned char device_id; + bool state; + unsigned char value; +} alexa_queue_element_t; +static std::queue _alexa_queue; // ----------------------------------------------------------------------------- // ALEXA @@ -29,15 +29,19 @@ bool _alexaWebSocketOnReceive(const char * key, JsonVariant& value) { void _alexaWebSocketOnSend(JsonObject& root) { root["alexaVisible"] = 1; - root["alexaEnabled"] = getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1; + root["alexaEnabled"] = alexaEnabled(); } void _alexaConfigure() { - alexa.enable(getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1); + alexa.enable(wifiConnected() && alexaEnabled()); } // ----------------------------------------------------------------------------- +bool alexaEnabled() { + return (getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1); +} + void alexaSetup() { // Backwards compatibility @@ -46,36 +50,60 @@ void alexaSetup() { // Load & cache settings _alexaConfigure(); - #if WEB_SUPPORT + // Uses hostname as base name for all devices + // TODO: use custom switch name when available + String hostname = getSetting("hostname"); + + // Lights + #if RELAY_PROVIDER == RELAY_PROVIDER_LIGHT + + // Global switch + alexa.addDevice(hostname.c_str()); + + // For each channel + for (unsigned char i = 1; i <= lightChannels(); i++) { + alexa.addDevice((hostname + " " + i).c_str()); + } + + // Relays + #else + + unsigned int relays = relayCount(); + if (relays == 1) { + alexa.addDevice(hostname.c_str()); + } else { + for (unsigned int i=1; i<=relays; i++) { + alexa.addDevice((hostname + " " + i).c_str()); + } + } - // Websockets + #endif + + // Websockets + #if WEB_SUPPORT wsOnSendRegister(_alexaWebSocketOnSend); - wsOnAfterParseRegister(_alexaConfigure); wsOnReceiveRegister(_alexaWebSocketOnReceive); - #endif - unsigned int relays = relayCount(); - String hostname = getSetting("hostname"); - if (relays == 1) { - alexa.addDevice(hostname.c_str()); - } else { - for (unsigned int i=0; i