Skip to content

Commit

Permalink
Merge pull request #1 from xoseperez/dev
Browse files Browse the repository at this point in the history
merge my dev branch to original
  • Loading branch information
thaeger71 authored Oct 15, 2018
2 parents 20a884c + 88a7076 commit bc65472
Show file tree
Hide file tree
Showing 44 changed files with 18,685 additions and 18,116 deletions.
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,58 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.13.3] 2018-10-08
### Fixed
- Honour build time settings for MQTT on fresh install (#719)
- Fix custom_crash_callback declaration for Arduino IDE 1.8.6 (#1169)
- Fix eneUnits key in web UI (#1177)
- Fix HA names (#1183)
- API is now restful (issue a PUT to change a relay status). It can be disabled from web UI (#1192)
- Remove static array to prevent out of bound in relay.ino (#1217)
- Remove duplicate call to EEPROMr.begin (#1214)
- Fix issue when SPIFFS_SUPPORT is enabled (#1225)
- Fix quoting units_of_measurement in HA config output (#1227)
- Fix "Clear counts" on rfm69 does not reset node count properly (thanks to @Trickx, #1239)
- Fix homecube 3rd led setting (thanks to @mcspr)
- Fix typo in static IP hint text (@thanks to @zafrirron)
- Fix hostname/password length requirements (thanks to @mcspr and @djwmarcx)
- Do not quote numbers in MQTT JSON payloads
- Fix telnet client object deletion (thanks to @mcspr)
- Call wakeUp PMS on first reading cycle to avoid not data in a long period (thanks to @Yonsm)
- Small fixes and windows support for ESPurna OTA Manager (thanks to @mcspr)
- Fix for YiDian XS-SSA05 configs (thanks to @ducky64)
- Send MQTT messages only for button events with assigned actions (thanks to @Valcob)
- Avoid EEPROM commits on callbacks (#1214)

### Added
- Option to report energy based on delta since last report (#369)
- Support for IR-MQTT bridge, also in RAW mode (#556, #907)
- Allow faster sensor reading intervals, down to 1 second (#848)
- Support for Xiaomi Smart Desk Lamp (#884)
- Retry up to 3 times on bad response to Thingspeak server (#1213)
- Support for apparent power and power factor on CSE7/XX sensor (#1215)
- Support for encoders
- Support for Allterco Shelly2
- Added SDS011 sensor support (thanks to @derlucas)
- Added password check to telnet (option to disable it)
- Added PHYX support (thanks to @whitebird)
- Added config command that outputs the configuration in JSON
- Support for MICS-2710, MICS-5525 and MICS-4514, gas sensors
- Support for iWoole LED Table Lamp (thanks to @CollinShorts)
- Command to output free stack
- Password management from web UI (thanks to @mcspr)
- Added BESTEK MRJ1011 support (thanks to @InduPrakash)
- Support for EXS WiFi Relay 5.0 (thanks to @cheise, #1218)
- Allowing disabling or single heartbeat on MQTT connect or repeat (default) (#1196)
- Command to save settings when SETTINGS_AUTOSAVE is off

### Changed
- Upgraded to JustWifi 2.0.2
- Upgraded to FauxmoESP 3.0.1
- Upgraded to DebounceEvent 2.0.4 to properly support BUTTON_SWITCH
- Split `info` command output into `info` and `wifi`. Refactor output.
- Custom HA payloads (thanks to @Yonsm)

## [1.13.2] 2018-08-27
### Fixed
- Fix relay overflow window length
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.13.3a-brightgreen.svg)](CHANGELOG.md)
[![version](https://img.shields.io/badge/version-1.13.3-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://api.codacy.com/project/badge/Grade/c9496e25cf07434cba786b462cb15f49)](https://www.codacy.com/app/xoseperez/espurna/dashboard)
Expand Down Expand Up @@ -240,8 +240,8 @@ Here is the list of supported hardware. For more information please refer to the
|**Maxcio W-US002S**|**HEYGO HY02**|**YiDian XS-SSA05**|
|![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**|||
|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg)|![Bestek MRJ1011](images/devices/bestek-mrj1011.jpg)||
|**WorkChoice EcoPlug**|**Bestek MRJ1011**||
|![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 switch](images/devices/yjzk-2gang-switch.jpg)|
Expand All @@ -250,8 +250,8 @@ Here is the list of supported hardware. For more information please refer to the
|**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)|![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**|||
|![Lohas 9W](images/devices/lohas-9w.jpg)|![Xiaomi Smart Desk Lamp](images/devices/xiaomi-smart-desk-lamp.jpg)|![iWoole LED Table Lamp](images/devices/iwoole-led-table-lamp.jpg)|
|**Lohas 9W**|**Xiaomi Smart Desk Lamp**|**iWoole LED Table Lamp**|
|![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)|
Expand All @@ -262,8 +262,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**|
|![EXS Wifi Relay v5.0](images/devices/exs-wifi-relay-v50.jpg)|![Allterco Shelly1](images/devices/allterco-shelly1.jpg)||
|**EXS Wifi Relay v5.0**|**Alterco Shelly1**||
|![EXS Wifi Relay v5.0](images/devices/exs-wifi-relay-v50.jpg)|![Allterco Shelly1](images/devices/allterco-shelly1.jpg)|![Allterco Shelly2](images/devices/allterco-shelly2.jpg)|
|**EXS Wifi Relay v5.0**|**Alterco Shelly1**|**Alterco Shelly2**|
|![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)|
Expand All @@ -274,6 +274,8 @@ Here is the list of supported hardware. For more information please refer to the
|**Generic DHT11 v1.0**|**Generic DS18B20 v1.0**|**Bruno Horta's OnOfre**|
|![Allnet ESP8266-UP-Relay](images/devices/allnet-esp8266-up-relay.jpg)|![RH Electronics Geiger Counter](images/devices/generic-geiger-diy.png)|![Luani HVIO](images/devices/luani-hvio.jpg)|
|**Allnet ESP8266-UP-Relay**|**RH Electronics Geiger Counter**|**Luani HVIO**|
|![Phyx ESP12 RGBW](images/devices/phyx-esp12-rgbw.jpg)|||
|**Phyx ESP12 RGBW**||||
|![Tonbux Mosquito Killer](images/devices/tonbux-mosquito-killer.jpg)|![Itead Sonoff IFAN02](images/devices/itead-sonoff-ifan02.jpg)||
|**Tonbux Mosquito Killer**|**Itead Sonoff IFAN02**|||

Expand Down
8 changes: 5 additions & 3 deletions code/espurna/button.ino
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ void buttonEvent(unsigned int id, unsigned char event) {
DEBUG_MSG_P(PSTR("[BUTTON] Button #%u event %u\n"), id, event);
if (event == 0) return;

unsigned char action = buttonAction(id, event);

#if MQTT_SUPPORT
buttonMQTT(id, event);
if (action != BUTTON_MODE_NONE || BUTTON_MQTT_SEND_ALL_EVENTS) {
buttonMQTT(id, event);
}
#endif

unsigned char action = buttonAction(id, event);

if (action == BUTTON_MODE_TOGGLE) {
if (_buttons[id].relayID > 0) {
relayToggle(_buttons[id].relayID - 1);
Expand Down
2 changes: 2 additions & 0 deletions code/espurna/config/arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@
//#define GUVAS12SD_SUPPORT 1
//#define HLW8012_SUPPORT 1
//#define MHZ19_SUPPORT 1
//#define MICS2710_SUPPORT 1
//#define MICS5525_SUPPORT 1
//#define NTC_SUPPORT 1
//#define PMSX003_SUPPORT 1
//#define PZEM004T_SUPPORT 1
Expand Down
13 changes: 11 additions & 2 deletions code/espurna/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
// EEPROM
//------------------------------------------------------------------------------

#define EEPROM_SIZE 4096 // EEPROM size in bytes
#define EEPROM_SIZE SPI_FLASH_SEC_SIZE // EEPROM size in bytes (1 sector = 4096 bytes)

//#define EEPROM_RORATE_SECTORS 2 // Number of sectors to use for EEPROM rotation
// If not defined the firmware will use a number based
// on the number of available sectors
Expand Down Expand Up @@ -186,6 +187,7 @@

// Topics that will be reported in heartbeat
#define HEARTBEAT_REPORT_STATUS 1
#define HEARTBEAT_REPORT_SSID 1
#define HEARTBEAT_REPORT_IP 1
#define HEARTBEAT_REPORT_MAC 1
#define HEARTBEAT_REPORT_RSSI 1
Expand Down Expand Up @@ -235,6 +237,8 @@

#ifndef BUTTON_LNGLNGCLICK_DELAY
#define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
#define BUTTON_MQTT_SEND_ALL_EVENTS 0 // 0 - to send only events the are bound to actions
// 1 - to send all button events to MQTT
#endif

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -728,6 +732,7 @@
#define MQTT_TOPIC_LED "led"
#define MQTT_TOPIC_BUTTON "button"
#define MQTT_TOPIC_IP "ip"
#define MQTT_TOPIC_SSID "ssid"
#define MQTT_TOPIC_VERSION "version"
#define MQTT_TOPIC_UPTIME "uptime"
#define MQTT_TOPIC_DATETIME "datetime"
Expand Down Expand Up @@ -795,7 +800,7 @@
// -----------------------------------------------------------------------------

#ifndef SETTINGS_AUTOSAVE
#define SETTINGS_AUTOSAVE 1 // Autosave settings o force manual commit
#define SETTINGS_AUTOSAVE 1 // Autosave settings or force manual commit
#endif

#define SETTINGS_MAX_LIST_COUNT 10 // Maximum index for settings lists
Expand Down Expand Up @@ -1361,6 +1366,10 @@
#define RFM69_MAX_TOPICS 50
#endif

#ifndef RFM69_MAX_NODES
#define RFM69_MAX_NODES 255
#endif

#ifndef RFM69_DEFAULT_TOPIC
#define RFM69_DEFAULT_TOPIC "/rfm69gw/{node}/{key}"
#endif
Expand Down
24 changes: 18 additions & 6 deletions code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON1_RELAY 1

// Hidden button will enter AP mode if dblclick and reset the device when long-long-clicked
#define RELAY1_PIN 12
Expand Down Expand Up @@ -1933,16 +1933,21 @@

// Buttons
#define BUTTON1_PIN 13
#define BUTTON1_MODE BUTTON_PUSHBUTTON
#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 4
#define LED1_PIN_INVERSE 0
#define LED1_PIN 0 // red
#define LED1_PIN_INVERSE 1
#define LED1_MODE LED_MODE_WIFI

#define LED2_PIN 15 // blue
#define LED2_PIN_INVERSE 1
#define LED2_MODE LED_MODE_RELAY

// HLW8012
#ifndef HLW8012_SUPPORT
Expand All @@ -1952,8 +1957,11 @@
#define HLW8012_CF1_PIN 14
#define HLW8012_CF_PIN 5

#define HLW8012_CURRENT_R 0.001 // Current resistor
#define HLW8012_VOLTAGE_R_UP ( 2 * 1200000 ) // Upstream voltage resistor
#define HLW8012_SEL_CURRENT LOW
#define HLW8012_CURRENT_RATIO 25740
#define HLW8012_VOLTAGE_RATIO 313400
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING

// -----------------------------------------------------------------------------
// TONBUX XS-SSA06
Expand Down Expand Up @@ -2921,6 +2929,10 @@
#define ECH1560_MISO_PIN 11
#define ECH1560_INVERTED 12

// MICS-2710 & MICS-5525 test
#define MICS2710_SUPPORT 1
#define MICS5525_SUPPORT 1

#elif defined(TRAVIS02)

// Relay provider dual
Expand Down
22 changes: 18 additions & 4 deletions code/espurna/config/progmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ PROGMEM const char espurna_sensors[] =
#if MHZ19_SUPPORT
"MHZ19 "
#endif
#if MICS2710_SUPPORT
"MICS2710 "
#endif
#if MICS5525_SUPPORT
"MICS5525 "
#endif
#if NTC_SUPPORT
"NTC "
#endif
Expand Down Expand Up @@ -231,7 +237,8 @@ PROGMEM const unsigned char magnitude_decimals[] = {
0, 0, 0, // PM
0, 0, 3, 3, 0,
4, 4, // Geiger Counter decimals
0
0,
0, 0, 0 // NO2, CO, Ohms
};

PROGMEM const char magnitude_unknown_topic[] = "unknown";
Expand Down Expand Up @@ -260,6 +267,9 @@ PROGMEM const char magnitude_hcho_topic[] = "hcho";
PROGMEM const char magnitude_geiger_cpm_topic[] = "ldr_cpm"; // local dose rate [Counts per minute]
PROGMEM const char magnitude_geiger_sv_topic[] = "ldr_uSvh"; // local dose rate [µSievert per hour]
PROGMEM const char magnitude_count_topic[] = "count";
PROGMEM const char magnitude_no2_topic[] = "no2";
PROGMEM const char magnitude_co_topic[] = "co";
PROGMEM const char magnitude_resistance_topic[] = "resistance";

PROGMEM const char* const magnitude_topics[] = {
magnitude_unknown_topic, magnitude_temperature_topic, magnitude_humidity_topic,
Expand All @@ -271,7 +281,8 @@ PROGMEM const char* const magnitude_topics[] = {
magnitude_co2_topic, magnitude_lux_topic, magnitude_uv_topic,
magnitude_distance_topic, magnitude_hcho_topic,
magnitude_geiger_cpm_topic, magnitude_geiger_sv_topic,
magnitude_count_topic
magnitude_count_topic,
magnitude_no2_topic, magnitude_co_topic, magnitude_resistance_topic
};

PROGMEM const char magnitude_empty[] = "";
Expand All @@ -293,6 +304,7 @@ PROGMEM const char magnitude_distance[] = "m";
PROGMEM const char magnitude_mgm3[] = "mg/m³";
PROGMEM const char magnitude_geiger_cpm[] = "cpm"; // Counts per Minute: Unit of local dose rate (Geiger counting)
PROGMEM const char magnitude_geiger_sv[] = "µSv/h"; // µSievert per hour: 2nd unit of local dose rate (Geiger counting)
PROGMEM const char magnitude_resistance[] = "ohm";


PROGMEM const char* const magnitude_units[] = {
Expand All @@ -304,8 +316,10 @@ PROGMEM const char* const magnitude_units[] = {
magnitude_ugm3, magnitude_ugm3, magnitude_ugm3,
magnitude_ppm, magnitude_lux, magnitude_uv,
magnitude_distance, magnitude_mgm3,
magnitude_geiger_cpm, magnitude_geiger_sv, // Geiger counter units
magnitude_empty
magnitude_geiger_cpm, magnitude_geiger_sv, // Geiger counter units
magnitude_empty, //
magnitude_ppm, magnitude_ppm, // NO2 & CO2
magnitude_resistance
};

#endif
2 changes: 2 additions & 0 deletions code/espurna/config/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ extern "C" {
#include <EEPROM_Rotate.h>
EEPROM_Rotate EEPROMr;

void eepromSectorsDebug();

// -----------------------------------------------------------------------------
// GPIO
// -----------------------------------------------------------------------------
Expand Down
49 changes: 49 additions & 0 deletions code/espurna/config/sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,45 @@
#define MHZ19_TX_PIN 15
#endif

//------------------------------------------------------------------------------
// MICS-2710 (and MICS-4514) NO2 sensor
// Enable support by passing MICS2710_SUPPORT=1 build flag
//------------------------------------------------------------------------------

#ifndef MICS2710_SUPPORT
#define MICS2710_SUPPORT 0
#endif

#ifndef MICS2710_NOX_PIN
#define MICS2710_NOX_PIN 0
#endif

#ifndef MICS2710_PRE_PIN
#define MICS2710_PRE_PIN 4
#endif

#define MICS2710_PREHEAT_TIME 10000 // 10s preheat for NOX read
#define MICS2710_RL 820 // RL, load resistor
#define MICS2710_R0 2200 // R0 calibration value for NO2 sensor,
// Typical value as per datasheet

//------------------------------------------------------------------------------
// MICS-5525 (and MICS-4514) CO sensor
// Enable support by passing MICS5525_SUPPORT=1 build flag
//------------------------------------------------------------------------------

#ifndef MICS5525_SUPPORT
#define MICS5525_SUPPORT 0
#endif

#ifndef MICS5525_RED_PIN
#define MICS5525_RED_PIN 0
#endif

#define MICS5525_RL 820 // RL, load resistor
#define MICS5525_R0 750000 // R0 calibration value for NO2 sensor,
// Typical value as per datasheet

//------------------------------------------------------------------------------
// NTC sensor
// Enable support by passing NTC_SUPPORT=1 build flag
Expand Down Expand Up @@ -673,6 +712,8 @@
GEIGER_SUPPORT || \
GUVAS12SD_SUPPORT || \
HLW8012_SUPPORT || \
MICS2710_SUPPORT || \
MICS5525_SUPPORT || \
MHZ19_SUPPORT || \
NTC_SUPPORT || \
SDS011_SUPPORT || \
Expand Down Expand Up @@ -793,6 +834,14 @@
#include "../sensors/MHZ19Sensor.h"
#endif

#if MICS2710_SUPPORT
#include "../sensors/MICS2710Sensor.h"
#endif

#if MICS5525_SUPPORT
#include "../sensors/MICS5525Sensor.h"
#endif

#if NTC_SUPPORT
#include "../sensors/NTCSensor.h"
#endif
Expand Down
Loading

0 comments on commit bc65472

Please sign in to comment.