From 5ce9025401c1eec462ec3a69343efa6d240421c9 Mon Sep 17 00:00:00 2001 From: Darsh Patel Date: Sat, 28 Apr 2018 01:24:31 +0530 Subject: [PATCH 01/13] Fixed multiple toggles due to repeated code some remotes repeat the code within 200ms thus toggling the relay twice , this fixes the toggle function. --- code/espurna/ir.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/espurna/ir.ino b/code/espurna/ir.ino index 93d75878..5cadae7e 100644 --- a/code/espurna/ir.ino +++ b/code/espurna/ir.ino @@ -14,7 +14,7 @@ Copyright (C) 2017-2018 by François Déchery IRrecv * _ir_recv; decode_results _ir_results; - +unsigned long last = millis(); // ----------------------------------------------------------------------------- // PRIVATE // ----------------------------------------------------------------------------- @@ -43,7 +43,12 @@ void _irProcessCode(unsigned long code) { relayStatus(0, button_value); } if (button_mode == IR_BUTTON_MODE_TOGGLE) { + if (millis() - last > 250){ relayToggle(button_value); + } + else{ + DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); + } } #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE From 9136c99ae298a75bf17865b4e10df54688f80fd7 Mon Sep 17 00:00:00 2001 From: Colin Shorts Date: Sat, 28 Apr 2018 16:41:03 +0100 Subject: [PATCH 02/13] Initial support for Itead Sonoff POW R2 --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 25 +++++++++++++++++++++++++ code/espurna/migrate.ino | 13 +++++++++++++ code/platformio.ini | 25 +++++++++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index ea6e9c83..2e4a9e6b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -19,6 +19,7 @@ //#define ITEAD_S20 //#define ITEAD_SONOFF_TOUCH //#define ITEAD_SONOFF_POW +//#define ITEAD_SONOFF_POW_R2 //#define ITEAD_SONOFF_DUAL //#define ITEAD_SONOFF_DUAL_R2 //#define ITEAD_SONOFF_4CH diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 37f2c596..ae4d52c0 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -379,6 +379,31 @@ #define HLW8012_CF1_PIN 13 #define HLW8012_CF_PIN 14 +#elif defined(ITEAD_SONOFF_POW_R2) + + // Info + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_POW_R2" + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 15 + #define LED1_PIN_INVERSE 0 + + // CSE7766 + #ifndef CSE7766_SUPPORT + #define CSE7766_SUPPORT 1 + #endif + #define CSE7766_PIN 1 + #elif defined(ITEAD_SONOFF_DUAL) // Info diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 8bf615a0..04190b79 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -905,6 +905,19 @@ void migrate() { setSetting("relayType", 3, RELAY_TYPE_NORMAL); setSetting("relayType", 4, RELAY_TYPE_NORMAL); + #elif defined(ITEAD_SONOFF_POW_R2) + + setSetting("board", 71); + setSetting("ledGPIO", 0, 15); + setSetting("ledLogic", 0, 1); + setSetting("btnGPIO", 0, 0); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 12); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("selGPIO", 5); + setSetting("cf1GPIO", 13); + setSetting("cfGPIO", 14); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index db86f9e3..badea42f 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -447,6 +447,31 @@ upload_flags = ${common.upload_flags} monitor_baud = 115200 extra_scripts = ${common.extra_scripts} +[env:itead-sonoff-pow-r2] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW_R2 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:itead-sonoff-pow-r2-ota] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW_R2 +upload_speed = 115200 +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + [env:itead-sonoff-dual] platform = ${common.platform} framework = arduino From 01bd5dad04883c96d816086fcad6f34fd1ff5d59 Mon Sep 17 00:00:00 2001 From: Darsh Patel Date: Sun, 29 Apr 2018 18:57:09 +0530 Subject: [PATCH 03/13] fix requested changes used tabs instead of spaces, change variable name to the one which is more uniform across the project, fixed bug about condition always being true --- code/espurna/ir.ino | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/espurna/ir.ino b/code/espurna/ir.ino index 5cadae7e..5a197417 100644 --- a/code/espurna/ir.ino +++ b/code/espurna/ir.ino @@ -14,7 +14,7 @@ Copyright (C) 2017-2018 by François Déchery IRrecv * _ir_recv; decode_results _ir_results; -unsigned long last = millis(); +unsigned long _ir_last = millis(); // ----------------------------------------------------------------------------- // PRIVATE // ----------------------------------------------------------------------------- @@ -43,11 +43,12 @@ void _irProcessCode(unsigned long code) { relayStatus(0, button_value); } if (button_mode == IR_BUTTON_MODE_TOGGLE) { - if (millis() - last > 250){ - relayToggle(button_value); + if (millis() - _ir_last > 250){ + relayToggle(button_value); + _ir_last = millis(); } else{ - DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); + DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); } } #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE From d1f19cfd558d55b929e333789b51d96c4b181daf Mon Sep 17 00:00:00 2001 From: wildwiz Date: Sun, 29 Apr 2018 17:02:36 +0200 Subject: [PATCH 04/13] changing ota settings to environment variables for itead-sonoff-rfbridge-direct-ota itead-sonoff-s31-ota zhilde-eu44-w-ota --- code/platformio.ini | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/platformio.ini b/code/platformio.ini index db86f9e3..acc64d7b 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -738,8 +738,8 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RFBRIDGE -DRFB_DIRECT upload_speed = 115200 -upload_port = "192.168.4.1" -upload_flags = --auth=fibonacci --port 8266 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 monitor_baud = 19200 extra_scripts = ${common.extra_scripts} @@ -888,8 +888,8 @@ board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_S31 -upload_port = "192.168.4.1" -upload_flags = --auth=fibonacci --port 8266 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 monitor_baud = 115200 extra_scripts = ${common.extra_scripts} @@ -1926,8 +1926,8 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DZHILDE_EU44_W upload_speed = 115200 -upload_port = "192.168.4.1" -upload_flags = --auth=fibonacci --port 8266 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 monitor_baud = 115200 extra_scripts = ${common.extra_scripts} From b03c222f18de2550614d6b7a2a4954d475ed0c9b Mon Sep 17 00:00:00 2001 From: wildwiz Date: Sun, 29 Apr 2018 17:48:04 +0200 Subject: [PATCH 05/13] support for luani HVIO https://luani.de/projekte/esp8266-hvio/ --- code/espurna/config/hardware.h | 33 +++++++++++++++++++++++++++++++++ code/platformio.ini | 25 +++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 37f2c596..239e8767 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1971,6 +1971,39 @@ #define LED1_PIN 1 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// Luani HVIO +// https://luani.de/projekte/esp8266-hvio/ +// https://luani.de/blog/esp8266-230v-io-modul/ +// ----------------------------------------------------------------------------- + +#elif defined(LUANI_HVIO) + + // Info + #define MANUFACTURER "LUANI" + #define DEVICE "HVIO" + + // Buttons + #define BUTTON1_PIN 12 + #define BUTTON1_RELAY 1 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_DBLCLICK BUTTON_MODE_NONE + + #define BUTTON2_PIN 13 + #define BUTTON2_RELAY 2 + #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + + + // Relays + #define RELAY1_PIN 4 + #define RELAY2_PIN 5 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + #define RELAY2_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 15 + #define LED1_PIN_INVERSE 0 + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- diff --git a/code/platformio.ini b/code/platformio.ini index db86f9e3..b259c13b 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1931,6 +1931,31 @@ upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 extra_scripts = ${common.extra_scripts} +[env:luani-hvio] +platform = ${common.platform} +framework = arduino +board = esp07 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DLUANI_HVIO +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:luani-hvio-ota] +platform = ${common.platform} +framework = arduino +board = esp07 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DZLUANI_HVIO +upload_speed = 115200 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + # ------------------------------------------------------------------------------ # GENERIC OTA ENVIRONMENTS # ------------------------------------------------------------------------------ From db8400635ed56ef06aacf40e9f6087d90dfbcfc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 2 May 2018 10:04:20 +0200 Subject: [PATCH 06/13] Version 1.12.6 --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ README.md | 8 +++++--- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 4 ++-- code/espurna/config/version.h | 2 +- code/espurna/ir.ino | 19 +++++++++++-------- code/espurna/migrate.ino | 12 ++++++++++++ 7 files changed, 61 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 922422de..6177350c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,35 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.12.6] 2018-05-02 +### Fixed +- Check NTP_SUPPORT for sensors (thanks to @mcspr) +- Fix AM2302 sensor +- Fix hostname truncated to 20 chars when advertised to DHCP ([#774](https://github.com/xoseperez/espurna/issues/774)) +- Decouple Serial object from Terminal, Debug modules ([#787](https://github.com/xoseperez/espurna/issues/787)) +- Fix Arilux LC-01 definitions ([#797](https://github.com/xoseperez/espurna/issues/797)) +- Do not uppercase hostname in web interface ([#799](https://github.com/xoseperez/espurna/issues/799)) +- Ensure scheduler has access to all channels independently of the color mode ([#807](https://github.com/xoseperez/espurna/issues/807)) + +### Added +- Support for IteadStudio Sonoff S31 ([#497](https://github.com/xoseperez/espurna/issues/497)) +- Option to ignore daylight saving in scheduler ([#783](https://github.com/xoseperez/espurna/issues/783)) +- Report last energy reset datetime in web interface ([#784](https://github.com/xoseperez/espurna/issues/784)) +- Added captive portal in AP mode +- Support for IR toggle mode (thanks to @darshkpatel) +- Support for IteadStudio Sonoff POW R2 (thanks to @ColinShorts) +- Support for Luani HVIO (thanks to @wildwiz) +- Support for Zhilde ZLD-EU55-W power strip (thanks to @wildwiz) +- Support for RFB_DIRECT Sonoff Bridge EFM8BB1 bypass hack (thanks to @wildwiz) +- Support for SenseAir S8 CO2 sensor (thanks to @Yonsm) +- Support for PMS5003T/ST sensors (thanks to @Yonsm) + +### Changed +- Updated JustWifi Library +- Some cleanup in the web interface +- Refactored configuration files (thanks to @lobradov, @mcspr) +- Changes pre-commit hook (thanks to @mcspr) + ## [1.12.5] 2018-04-08 ### Fixed - Fixed expected power calibration ([#676](https://github.com/xoseperez/espurna/issues/676)) diff --git a/README.md b/README.md index 926b3872..d903ab2e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ 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.12.6a-brightgreen.svg)](CHANGELOG.md) +[![version](https://img.shields.io/badge/version-1.12.6-brightgreen.svg)](CHANGELOG.md) [![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.org/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) @@ -63,6 +63,7 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari * Multiple virtual switches (tested with up to 16) * MQTT-to-RF two-way bridge (no need to learn codes) * Support for [https://github.com/Portisch/RF-Bridge-EFM8BB1](https://github.com/Portisch/RF-Bridge-EFM8BB1) custom firmware + * 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** @@ -72,7 +73,8 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari * **AM2320** temperature and humidity sensor over I2C * **Dallas OneWire sensors** like the DS18B20 * **MHZ19** CO2 sensor - * **PMSX003** dust sensor + * **SenseAir S8** CO2 sensor + * **PMSX003/PMS5003T/ST** dust sensors * **BH1750** luminosity sensor * **GUVAS12SD** UV sensor * Power monitoring @@ -243,7 +245,7 @@ Here is the list of supported hardware. For more information please refer to the |**Generic DHT11 v1.0**|**Generic DS18B20 v1.0**|| **Other supported boards:** -*TODO* +IteadStudio Sonoff S31, IteadStudio Sonoff POW R2, Zhilde ZLD-EU55-W, Luani HVIO ## License diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 2e4a9e6b..a6bbdbc5 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -79,6 +79,7 @@ //#define GENERIC_ESP01S_DS18B20_V10 //#define HELTEC_TOUCHRELAY //#define ZHILDE_EU44_W +//#define LUANI_HVIO //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index cf28148b..487f2729 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -400,9 +400,9 @@ // CSE7766 #ifndef CSE7766_SUPPORT - #define CSE7766_SUPPORT 1 + #define CSE7766_SUPPORT 1 #endif - #define CSE7766_PIN 1 + #define CSE7766_PIN 1 #elif defined(ITEAD_SONOFF_DUAL) diff --git a/code/espurna/config/version.h b/code/espurna/config/version.h index f818fe3c..c6c250c1 100644 --- a/code/espurna/config/version.h +++ b/code/espurna/config/version.h @@ -1,5 +1,5 @@ #define APP_NAME "ESPURNA" -#define APP_VERSION "1.12.6a" +#define APP_VERSION "1.12.6" #define APP_REVISION "" #define APP_AUTHOR "xose.perez@gmail.com" #define APP_WEBSITE "http://tinkerman.cat" diff --git a/code/espurna/ir.ino b/code/espurna/ir.ino index 5a197417..7dd0a34c 100644 --- a/code/espurna/ir.ino +++ b/code/espurna/ir.ino @@ -14,7 +14,8 @@ Copyright (C) 2017-2018 by François Déchery IRrecv * _ir_recv; decode_results _ir_results; -unsigned long _ir_last = millis(); +unsigned long _ir_last_toggle = 0; + // ----------------------------------------------------------------------------- // PRIVATE // ----------------------------------------------------------------------------- @@ -42,15 +43,17 @@ void _irProcessCode(unsigned long code) { if (button_mode == IR_BUTTON_MODE_STATE) { relayStatus(0, button_value); } + if (button_mode == IR_BUTTON_MODE_TOGGLE) { - if (millis() - _ir_last > 250){ - relayToggle(button_value); - _ir_last = millis(); - } - else{ - DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); - } + + if (millis() - _ir_last_toggle > 250){ + relayToggle(button_value); + _ir_last_toggle = millis(); + } else { + DEBUG_MSG_P(PSTR("[IR] Ignoring repeated code\n")); + } } + #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE if (button_mode == IR_BUTTON_MODE_BRIGHTER) { diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 04190b79..fb986e86 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -918,6 +918,18 @@ void migrate() { setSetting("cf1GPIO", 13); setSetting("cfGPIO", 14); + #elif defined(LUANI_HVIO) + + setSetting("board", 72); + setSetting("ledGPIO", 0, 15); + setSetting("ledLogic", 0, 0); + setSetting("btnGPIO", 0, 12); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 4); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("relayGPIO", 1, 5); + setSetting("relayType", 1, RELAY_TYPE_NORMAL); + #else // Allow users to define new settings without migration config From bcd01868393a06ae15e8fc51c3ff9336356d7cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 2 May 2018 11:25:45 +0200 Subject: [PATCH 07/13] Fix ESP01 RGBLED definition --- README.md | 6 +++--- code/espurna/config/hardware.h | 1 + code/espurna/config/version.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d903ab2e..d0b72c55 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smar It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. [![version](https://img.shields.io/badge/version-1.12.6-brightgreen.svg)](CHANGELOG.md) -[![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.org/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) +[![branch](https://img.shields.io/badge/branch-master-orange.svg)](https://github.org/xoseperez/espurna/tree/master/) +[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=master)](https://travis-ci.org/xoseperez/espurna) +[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/master.svg)](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) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 487f2729..1e289bc1 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1904,6 +1904,7 @@ // LEDs #define LED1_PIN 2 + #define LED1_PIN_INVERSE 0 // ----------------------------------------------------------------------------- diff --git a/code/espurna/config/version.h b/code/espurna/config/version.h index c6c250c1..92575561 100644 --- a/code/espurna/config/version.h +++ b/code/espurna/config/version.h @@ -1,6 +1,6 @@ #define APP_NAME "ESPURNA" #define APP_VERSION "1.12.6" -#define APP_REVISION "" +#define APP_REVISION "db84006" #define APP_AUTHOR "xose.perez@gmail.com" #define APP_WEBSITE "http://tinkerman.cat" #define CFG_VERSION 3 From 78a807e247c05ebf007ffa3c1df5df749a4dce09 Mon Sep 17 00:00:00 2001 From: Markus Bajones Date: Wed, 2 May 2018 13:00:18 +0200 Subject: [PATCH 08/13] Add support for Allnet ESP8266_UP_Relay --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 33 +++++++++++++++++++++++++++++++++ code/espurna/migrate.ino | 7 +++++++ code/platformio.ini | 24 ++++++++++++++++++++++++ 4 files changed, 65 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index ea6e9c83..29f61478 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -78,6 +78,7 @@ //#define GENERIC_ESP01S_DS18B20_V10 //#define HELTEC_TOUCHRELAY //#define ZHILDE_EU44_W +//#define ALLNET_ESP8266_UP //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 37f2c596..70b7df33 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1971,6 +1971,39 @@ #define LED1_PIN 1 #define LED1_PIN_INVERSE 1 + // ----------------------------------------------------------------------------- + // Allnet 4duino ESP8266-UP-Relais + // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/ + // ----------------------------------------------------------------------------- + +#elif defined(ALLNET_ESP8266_UP) + + // Info + #define MANUFACTURER "ALLNET" + #define DEVICE "ESP8266_UP_Relais" + + // Relays + #define RELAY1_PIN 14 + #define RELAY1_RESET_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_LATCHED + + // LEDs + #define LED1_PIN 0 + #define LED1_PIN_INVERSE 1 + + // Buttons + #define BUTTON1_PIN 4 + #define BUTTON1_MODE BUTTON_PUSHBUTTON + #define BUTTON1_PRESS BUTTON_MODE_TOGGLE + #define BUTTON1_CLICK BUTTON_MODE_NONE + #define BUTTON1_DBLCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGCLICK BUTTON_MODE_NONE + #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE + + #define BUTTON2_PIN 5 + #define BUTTON2_MODE BUTTON_PUSHBUTTON + + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 8bf615a0..ae8edd9b 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -905,6 +905,13 @@ void migrate() { setSetting("relayType", 3, RELAY_TYPE_NORMAL); setSetting("relayType", 4, RELAY_TYPE_NORMAL); + #elif defined(ALLNET_ESP8266_UP) + + setSetting("board", 71); + setSetting("relayGPIO", 0, 14); + setSetting("relayResetGPIO", 1, 12); + setSetting("relayType", 0, RELAY_TYPE_LATCHED); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index db86f9e3..43d3234c 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2054,3 +2054,27 @@ upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} + +[env:allnet-esp8266-up-relay] +platform = ${common.platform} +framework = arduino +board = esp12e +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DALLNET_ESP8266_UP +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:allnet-esp8266-up-relay-ota] +platform = ${common.platform} +framework = arduino +board = esp12e +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DALLNET_ESP8266_UP +upload_speed = 115200 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +extra_scripts = ${common.extra_scripts} From ed609e622351e0c0bf3bbe6d6d218e3a8c07cafc Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Tue, 1 May 2018 18:45:41 +0300 Subject: [PATCH 09/13] Handle C-d in telnet --- code/espurna/telnet.ino | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/espurna/telnet.ino b/code/espurna/telnet.ino index fc3912c6..996da567 100644 --- a/code/espurna/telnet.ino +++ b/code/espurna/telnet.ino @@ -66,6 +66,15 @@ void _telnetData(unsigned char clientId, void *data, size_t len) { // Capture close connection char * p = (char *) data; + + // C-d is sent as two bytes + if (len == 2) { + if ((p[0] == 0xFF) && (p[1] == 0xEC)) { + _telnetClients[clientId]->close(); + return; + } + } + if ((strncmp(p, "close", 5) == 0) || (strncmp(p, "quit", 4) == 0)) { _telnetClients[clientId]->close(); return; From 99311bbe714c14fab0ea97d9fa0309147b7f2cd0 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Wed, 2 May 2018 15:39:55 +0300 Subject: [PATCH 10/13] Sometimes telnet spams this sequence --- code/espurna/telnet.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/espurna/telnet.ino b/code/espurna/telnet.ino index 996da567..918f228e 100644 --- a/code/espurna/telnet.ino +++ b/code/espurna/telnet.ino @@ -67,8 +67,8 @@ void _telnetData(unsigned char clientId, void *data, size_t len) { // Capture close connection char * p = (char *) data; - // C-d is sent as two bytes - if (len == 2) { + // C-d is sent as two bytes (sometimes repeating) + if (len >= 2) { if ((p[0] == 0xFF) && (p[1] == 0xEC)) { _telnetClients[clientId]->close(); return; From 5708a23d2f5ae6d5f63e7bdaa04fc29294117d77 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Wed, 2 May 2018 15:40:11 +0300 Subject: [PATCH 11/13] Immediatly close connection to avoid watchdog --- code/espurna/telnet.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/espurna/telnet.ino b/code/espurna/telnet.ino index 918f228e..006d5d21 100644 --- a/code/espurna/telnet.ino +++ b/code/espurna/telnet.ino @@ -70,7 +70,7 @@ void _telnetData(unsigned char clientId, void *data, size_t len) { // C-d is sent as two bytes (sometimes repeating) if (len >= 2) { if ((p[0] == 0xFF) && (p[1] == 0xEC)) { - _telnetClients[clientId]->close(); + _telnetClients[clientId]->close(true); return; } } From 0c18c3c1570427b316049ecfb62e9bd1e5d94100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 3 May 2018 10:56:10 +0200 Subject: [PATCH 12/13] Add missing sensors to boot log messages --- README.md | 6 +++--- code/espurna/utils.ino | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d0b72c55..d903ab2e 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smar It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. [![version](https://img.shields.io/badge/version-1.12.6-brightgreen.svg)](CHANGELOG.md) -[![branch](https://img.shields.io/badge/branch-master-orange.svg)](https://github.org/xoseperez/espurna/tree/master/) -[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=master)](https://travis-ci.org/xoseperez/espurna) -[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/master.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) +[![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.org/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) [![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) diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index 56b9e88d..c3b092a5 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -356,9 +356,15 @@ void info() { #if ANALOG_SUPPORT DEBUG_MSG_P(PSTR(" ANALOG")); #endif + #if BH1750_SUPPORT + DEBUG_MSG_P(PSTR(" BH1750")); + #endif #if BMX280_SUPPORT DEBUG_MSG_P(PSTR(" BMX280")); #endif + #if CSE7766_SUPPORT + DEBUG_MSG_P(PSTR(" CSE7766")); + #endif #if DALLAS_SUPPORT DEBUG_MSG_P(PSTR(" DALLAS")); #endif @@ -401,6 +407,9 @@ void info() { #if PZEM004T_SUPPORT DEBUG_MSG_P(PSTR(" PZEM004T")); #endif + #if SENSEAIR_SUPPORT + DEBUG_MSG_P(PSTR(" SENSEAIR")); + #endif #if SHT3X_I2C_SUPPORT DEBUG_MSG_P(PSTR(" SHT3X_I2C")); #endif From 9a412520b557d5c2b5f4b4e6815f5d229be889a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 3 May 2018 23:30:37 +0200 Subject: [PATCH 13/13] Changes to the ALLNET 4duino IoT WLAN relay --- code/espurna/config/arduino.h | 2 +- code/espurna/config/hardware.h | 29 +++++++++++++++++++---------- code/espurna/migrate.ino | 4 ++-- code/platformio.ini | 8 ++++---- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 7c23e218..07e33612 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -80,7 +80,7 @@ //#define HELTEC_TOUCHRELAY //#define ZHILDE_EU44_W //#define LUANI_HVIO -//#define ALLNET_ESP8266_UP +//#define ALLNET_4DUINO_IOT_WLAN_RELAIS //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 6f8518c4..e29d0be4 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2000,13 +2000,14 @@ // ----------------------------------------------------------------------------- // Allnet 4duino ESP8266-UP-Relais // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/ + // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf // ----------------------------------------------------------------------------- -#elif defined(ALLNET_ESP8266_UP) +#elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS) // Info #define MANUFACTURER "ALLNET" - #define DEVICE "ESP8266_UP_Relais" + #define DEVICE "4DUINO_IOT_WLAN_RELAIS" // Relays #define RELAY1_PIN 14 @@ -2018,16 +2019,24 @@ #define LED1_PIN_INVERSE 1 // Buttons - #define BUTTON1_PIN 4 - #define BUTTON1_MODE BUTTON_PUSHBUTTON - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE + //#define BUTTON1_PIN 0 + //#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_PIN 5 + // Using pins labelled as SDA & SCL as buttons + #define BUTTON2_PIN 4 #define BUTTON2_MODE BUTTON_PUSHBUTTON + #define BUTTON2_PRESS BUTTON_MODE_TOGGLE + #define BUTTON2_CLICK BUTTON_MODE_NONE + #define BUTTON2_DBLCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGCLICK BUTTON_MODE_NONE + #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE + + #define BUTTON3_PIN 5 + #define BUTTON3_MODE BUTTON_PUSHBUTTON + + // Using pins labelled as SDA & SCL for I2C + //#define I2C_SDA_PIN 4 + //#define I2C_SCL_PIN 5 // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 548537d4..ab4ef36b 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -930,11 +930,11 @@ void migrate() { setSetting("relayGPIO", 1, 5); setSetting("relayType", 1, RELAY_TYPE_NORMAL); - #elif defined(ALLNET_ESP8266_UP) + #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS) setSetting("board", 73); setSetting("relayGPIO", 0, 14); - setSetting("relayResetGPIO", 1, 12); + setSetting("relayResetGPIO", 0, 12); setSetting("relayType", 0, RELAY_TYPE_LATCHED); #else diff --git a/code/platformio.ini b/code/platformio.ini index 737f97fe..a5a58e9e 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2105,25 +2105,25 @@ upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} -[env:allnet-esp8266-up-relay] +[env:allnet-4duino-iot-wlan-relais] platform = ${common.platform} framework = arduino board = esp12e board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m} -DALLNET_ESP8266_UP +build_flags = ${common.build_flags_1m} -DALLNET_4DUINO_IOT_WLAN_RELAIS monitor_baud = 115200 extra_scripts = ${common.extra_scripts} -[env:allnet-esp8266-up-relay-ota] +[env:allnet-4duino-iot-wlan-relais-ota] platform = ${common.platform} framework = arduino board = esp12e board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m} -DALLNET_ESP8266_UP +build_flags = ${common.build_flags_1m} -DALLNET_4DUINO_IOT_WLAN_RELAIS upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266