Browse Source

Merge branch 'dev' of github.com:xoseperez/espurna into dev

rfm69
Xose Pérez 6 years ago
parent
commit
9892765b61
12 changed files with 62 additions and 32 deletions
  1. +23
    -14
      README.md
  2. +1
    -0
      code/.gitignore
  3. +1
    -1
      code/espurna/button.ino
  4. +4
    -2
      code/espurna/config/general.h
  5. +21
    -7
      code/espurna/mqtt.ino
  6. +12
    -8
      code/html/custom.js
  7. BIN
      images/devices/intermittech-quinled-2.6.jpg
  8. BIN
      images/devices/lingan-swa1.jpg
  9. BIN
      images/devices/mancavemade-esp-live.jpg
  10. BIN
      images/devices/maxcio-15a.jpg
  11. BIN
      images/devices/xenon-sm-pw702u.jpg
  12. BIN
      images/devices/yidian-16a.jpg

+ 23
- 14
README.md View File

@ -12,8 +12,9 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari
[![twitter](https://img.shields.io/twitter/follow/xoseperez.svg?style=social)](https://twitter.com/intent/follow?screen_name=xoseperez) [![twitter](https://img.shields.io/twitter/follow/xoseperez.svg?style=social)](https://twitter.com/intent/follow?screen_name=xoseperez)
--- ---
> **2018-05-09**: Default branch in GitHub is now the development branch "dev". The stable branch (the one used to create the binaries) is "[master](https://github.com/xoseperez/espurna/tree/master)".
> **2018-03-09**:<br>
> * Default branch in GitHub is now the development branch "dev".<br>
> * The stable branch (the one used to create the [binary releases](https://github.com/xoseperez/espurna/releases)) is "[master](https://github.com/xoseperez/espurna/tree/master)".
--- ---
@ -60,7 +61,7 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari
* **Sonoff RF Bridge** support * **Sonoff RF Bridge** support
* Multiple virtual switches (tested with up to 16) * Multiple virtual switches (tested with up to 16)
* MQTT-to-RF two-way bridge (no need to learn codes) * MQTT-to-RF two-way bridge (no need to learn codes)
* Support for https://github.com/Portisch/RF-Bridge-EFM8BB1 custom firmware
* Support for [https://github.com/Portisch/RF-Bridge-EFM8BB1](https://github.com/Portisch/RF-Bridge-EFM8BB1) custom firmware
* Support for [different **sensors**](Sensors) * Support for [different **sensors**](Sensors)
* Environment * Environment
* **DHT11 / DHT22 / DHT21 / AM2301 / Itead's SI7021** * **DHT11 / DHT22 / DHT21 / AM2301 / Itead's SI7021**
@ -134,7 +135,9 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari
## Notices ## Notices
--- ---
> **2018-05-09**: Default branch in GitHub is now the development branch "dev". The stable branch (the one used to create the binaries) is "[master](https://github.com/xoseperez/espurna/tree/master)".
> **2018-03-09**:<br>
> * Default branch in GitHub is now the development branch "dev".<br>
> * The stable branch (the one used to create the [binary releases](https://github.com/xoseperez/espurna/releases)) is "[master](https://github.com/xoseperez/espurna/tree/master)".
--- ---
> **2018-01-24**: This repository has been migrated from Bitbucket to GitHub. There were a number of reason to migrate the repository to GitHub. I like Bitbucket and I'm still using it for a lot of projects, but ESPurna has grown and its community as well. Some users have complain about Bitbucket not being enough community-focused. This change is mainly aimed to use a platform with greater acceptance on the open-source community and tools better suited to them (to you), like the possibility to contribute to the documentation in an easy way. > **2018-01-24**: This repository has been migrated from Bitbucket to GitHub. There were a number of reason to migrate the repository to GitHub. I like Bitbucket and I'm still using it for a lot of projects, but ESPurna has grown and its community as well. Some users have complain about Bitbucket not being enough community-focused. This change is mainly aimed to use a platform with greater acceptance on the open-source community and tools better suited to them (to you), like the possibility to contribute to the documentation in an easy way.
@ -194,31 +197,37 @@ Here is the list of supported hardware. For more information please refer to the
|**Itead Sonoff 4CH**|**Itead Sonoff 4CH Pro**|**OpenEnergyMonitor WiFi MQTT Relay / Thermostat**| |**Itead Sonoff 4CH**|**Itead Sonoff 4CH Pro**|**OpenEnergyMonitor WiFi MQTT Relay / Thermostat**|
|![Itead S20](images/devices/itead-s20.jpg)|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg)|![Power meters based on V9261F and ECH1560](images/devices/generic-v9261f.jpg)| |![Itead S20](images/devices/itead-s20.jpg)|![WorkChoice EcoPlug](images/devices/workchoice-ecoplug.jpg)|![Power meters based on V9261F and ECH1560](images/devices/generic-v9261f.jpg)|
|**Itead S20**|**WorkChoice EcoPlug**|**Power meters based on V9261F and ECH1560**| |**Itead S20**|**WorkChoice EcoPlug**|**Power meters based on V9261F and ECH1560**|
|![Schuko Wifi Plug](images/devices/schuko-wifi-plug.jpg)|![KMC 70011 /w power meter](images/devices/kmc-70011.jpg)||
|**Schuko Wifi Plug**|**KMC 70011 /w power meter**||
|![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)|![Tonbux PowerStrip02](images/devices/tonbux-powerstrip02.jpg)|
|**WiOn 50055**|**LINGAN SWA1**|**Tonbux PowerStrip02**
|![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)|| |![Itead Sonoff Touch](images/devices/itead-sonoff-touch.jpg)|![Itead Sonoff T1](images/devices/itead-sonoff-t1.jpg)||
|**Itead Sonoff Touch**|**Itead Sonoff T1**|| |**Itead Sonoff Touch**|**Itead Sonoff T1**||
|![Itead Slampher](images/devices/itead-slampher.jpg)||| |![Itead Slampher](images/devices/itead-slampher.jpg)|||
|**Itead Slampher**||| |**Itead Slampher**|||
|![Itead Sonoff B1](images/devices/itead-sonoff-b1.jpg)|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)| |![Itead Sonoff B1](images/devices/itead-sonoff-b1.jpg)|![AI-Thinker Wifi Light / Noduino OpenLight](images/devices/aithinker-ai-light.jpg)|![Authometion LYT8266](images/devices/authometion-lyt8266.jpg)|
|**Itead Sonoff B1**|**AI-Thinker Wifi Light / Noduino OpenLight**|**Authometion LYT8266**| |**Itead Sonoff B1**|**AI-Thinker Wifi Light / Noduino OpenLight**|**Authometion LYT8266**|
|![Itead Sonoff LED](images/devices/itead-sonoff-led.jpg)|![Itead BN-SZ01](images/devices/itead-bn-sz01.jpg)||
|**Itead Sonoff LED**|**Itead BN-SZ01**||
|![Arilux E27](images/devices/arilux-e27.jpg)|![Itead Sonoff LED](images/devices/itead-sonoff-led.jpg)|![Itead BN-SZ01](images/devices/itead-bn-sz01.jpg)|
|**Arilux E27**|**Itead Sonoff LED**|**Itead BN-SZ01**|
|![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)| |![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)|
|**Arilux AL-LC01 (RGB)**|**Arilux AL-LC02 (RGBW)**|**Arilux AL-LC06 (RGBWWCW)**| |**Arilux AL-LC01 (RGB)**|**Arilux AL-LC02 (RGBW)**|**Arilux AL-LC06 (RGBWWCW)**|
|![Arilux AL-LC11 (RGBWWW) & RF](images/devices/arilux-al-lc11.jpg)|![MagicHome LED Controller (1.0 and 2.x)](images/devices/magichome-led-controller.jpg)|![Huacanxing H801/802](images/devices/huacanxing-h801.jpg)| |![Arilux AL-LC11 (RGBWWW) & RF](images/devices/arilux-al-lc11.jpg)|![MagicHome LED Controller (1.0 and 2.x)](images/devices/magichome-led-controller.jpg)|![Huacanxing H801/802](images/devices/huacanxing-h801.jpg)|
|**Arilux AL-LC11 (RGBWWW) & RF**|**MagicHome LED Controller (1.0/2.x)**|**Huacanxing H801/802**| |**Arilux AL-LC11 (RGBWWW) & RF**|**MagicHome LED Controller (1.0/2.x)**|**Huacanxing H801/802**|
|![InterMitTech QuinLED 2.6](images/devices/intermittech-quinled-2.6.jpg)||
|**InterMitTech QuinLED 2.6**||
|![Itead Sonoff SV](images/devices/itead-sonoff-sv.jpg)|![Itead 1CH Inching](images/devices/itead-1ch-inching.jpg)|![Itead Motor Clockwise/Anticlockwise](images/devices/itead-motor.jpg)| |![Itead Sonoff SV](images/devices/itead-sonoff-sv.jpg)|![Itead 1CH Inching](images/devices/itead-1ch-inching.jpg)|![Itead Motor Clockwise/Anticlockwise](images/devices/itead-motor.jpg)|
|**Itead Sonoff SV**|**Itead 1CH Inching**|**Itead Motor Clockwise/Anticlockwise**| |**Itead Sonoff SV**|**Itead 1CH Inching**|**Itead Motor Clockwise/Anticlockwise**|
|![Jan Goedeke Wifi Relay (NO/NC)](images/devices/jangoe-wifi-relay.png)|![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)](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**| |**Jan Goedeke Wifi Relay (NO/NC)**|**Jorge García Wifi + Relays Board Kit**|**EXS Wifi Relay v3.1**|
|![Wemos D1 Mini Relay Shield](images/devices/wemos-d1-mini-relayshield.jpg)|![Witty Cloud](images/devices/witty-cloud.jpg)||
|**Wemos D1 Mini Relay Shield**|**Witty Cloud**||
|![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**|
|||
|**YJZK 2-gang switch**|**STM_RELAY**||
**Other supported boards:** **Other supported boards:**
WiOn 50055, ManCaveMade ESP-Live, InterMitTech QuinLED 2.6
Arilux E27 light bulb, Xenon SM-PW702U, YJZK 2-gang switch
STM_RELAY, Maxcio W-US002S, HEYGO HY02, YiDian XS-SSA05
*TODO*
## License ## License


+ 1
- 0
code/.gitignore View File

@ -7,3 +7,4 @@ core_version.h
.pioenvs .pioenvs
.piolibdeps .piolibdeps
.DS_Store .DS_Store
.python-version

+ 1
- 1
code/espurna/button.ino View File

@ -27,7 +27,7 @@ void buttonMQTT(unsigned char id, uint8_t event) {
if (id >= _buttons.size()) return; if (id >= _buttons.size()) return;
char payload[2]; char payload[2];
itoa(event, payload, 10); itoa(event, payload, 10);
mqttSend(MQTT_TOPIC_BUTTON, id, payload);
mqttSend(MQTT_TOPIC_BUTTON, id, payload, false, false); // 1st bool = force, 2nd = retain
} }
#endif #endif


+ 4
- 2
code/espurna/config/general.h View File

@ -61,8 +61,8 @@
#ifndef SERIAL_RX_PORT #ifndef SERIAL_RX_PORT
#define SERIAL_RX_PORT Serial // This setting is usually defined #define SERIAL_RX_PORT Serial // This setting is usually defined
// in the hardware.h file for those
// boards that require it
// in the hardware.h file for those
// boards that require it
#endif #endif
#ifndef SERIAL_RX_BAUDRATE #ifndef SERIAL_RX_BAUDRATE
@ -139,8 +139,10 @@
#endif #endif
#define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis #define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis
#ifndef SYSTEM_CHECK_MAX
#define SYSTEM_CHECK_MAX 5 // After this many crashes on boot #define SYSTEM_CHECK_MAX 5 // After this many crashes on boot
// the system is flagged as unstable // the system is flagged as unstable
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// EEPROM // EEPROM


+ 21
- 7
code/espurna/mqtt.ino View File

@ -484,18 +484,24 @@ String mqttTopic(const char * magnitude, unsigned int index, bool is_set) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void mqttSendRaw(const char * topic, const char * message) {
void mqttSendRaw(const char * topic, const char * message, bool retain) {
if (_mqtt.connected()) { if (_mqtt.connected()) {
#if MQTT_USE_ASYNC #if MQTT_USE_ASYNC
unsigned int packetId = _mqtt.publish(topic, _mqtt_qos, _mqtt_retain, message);
unsigned int packetId = _mqtt.publish(topic, _mqtt_qos, retain, message);
DEBUG_MSG_P(PSTR("[MQTT] Sending %s => %s (PID %d)\n"), topic, message, packetId); DEBUG_MSG_P(PSTR("[MQTT] Sending %s => %s (PID %d)\n"), topic, message, packetId);
#else #else
_mqtt.publish(topic, message, _mqtt_retain);
_mqtt.publish(topic, message, retain);
DEBUG_MSG_P(PSTR("[MQTT] Sending %s => %s\n"), topic, message); DEBUG_MSG_P(PSTR("[MQTT] Sending %s => %s\n"), topic, message);
#endif #endif
} }
} }
void mqttSendRaw(const char * topic, const char * message) {
mqttSendRaw (topic, message, _mqtt_retain);
}
void mqttFlush() { void mqttFlush() {
if (!_mqtt.connected()) return; if (!_mqtt.connected()) return;
@ -567,7 +573,7 @@ void mqttEnqueue(const char * topic, const char * message) {
} }
void mqttSend(const char * topic, const char * message, bool force) {
void mqttSend(const char * topic, const char * message, bool force, bool retain) {
bool useJson = force ? false : _mqtt_use_json; bool useJson = force ? false : _mqtt_use_json;
@ -585,20 +591,28 @@ void mqttSend(const char * topic, const char * message, bool force) {
// Send it right away // Send it right away
} else { } else {
mqttSendRaw(mqttTopic(topic, false).c_str(), message);
mqttSendRaw(mqttTopic(topic, false).c_str(), message, retain);
} }
} }
void mqttSend(const char * topic, const char * message, bool force) {
mqttSend(topic, message, force, _mqtt_retain);
}
void mqttSend(const char * topic, const char * message) { void mqttSend(const char * topic, const char * message) {
mqttSend(topic, message, false); mqttSend(topic, message, false);
} }
void mqttSend(const char * topic, unsigned int index, const char * message, bool force) {
void mqttSend(const char * topic, unsigned int index, const char * message, bool force, bool retain) {
char buffer[strlen(topic)+5]; char buffer[strlen(topic)+5];
snprintf_P(buffer, sizeof(buffer), PSTR("%s/%d"), topic, index); snprintf_P(buffer, sizeof(buffer), PSTR("%s/%d"), topic, index);
mqttSend(buffer, message, force);
mqttSend(buffer, message, force, retain);
}
void mqttSend(const char * topic, unsigned int index, const char * message, bool force) {
mqttSend(topic, index, message, force, _mqtt_retain);
} }
void mqttSend(const char * topic, unsigned int index, const char * message) { void mqttSend(const char * topic, unsigned int index, const char * message) {


+ 12
- 8
code/html/custom.js View File

@ -161,9 +161,9 @@ function validateForm(form) {
function getValue(element) { function getValue(element) {
if ($(element).attr("type") === "checkbox") { if ($(element).attr("type") === "checkbox") {
return $(element).is(":checked") ? 1 : 0;
return $(element).prop("checked") ? 1 : 0;
} else if ($(element).attr("type") === "radio") { } else if ($(element).attr("type") === "radio") {
if (!$(element).is(":checked")) {
if (!$(element).prop("checked")) {
return null; return null;
} }
} }
@ -559,9 +559,9 @@ function toggleMenu() {
function showPanel() { function showPanel() {
$(".panel").hide(); $(".panel").hide();
$("#" + $(this).attr("data")).show();
if ($("#layout").hasClass("active")) { toggleMenu(); } if ($("#layout").hasClass("active")) { toggleMenu(); }
$("input[type='checkbox']").
$("#" + $(this).attr("data")).show().
find("input[type='checkbox']").
iphoneStyle("calculateDimensions"). iphoneStyle("calculateDimensions").
iphoneStyle("refresh"); iphoneStyle("refresh");
} }
@ -674,9 +674,13 @@ function addSchedule(event) {
}); });
$(line).find(".button-del-schedule").on("click", delSchedule); $(line).find(".button-del-schedule").on("click", delSchedule);
$(line).find(".button-more-schedule").on("click", moreSchedule); $(line).find(".button-more-schedule").on("click", moreSchedule);
var ena = $(line).find(":checkbox");
ena.prop("checked", false).iphoneStyle("refresh");
line.appendTo("#schedules"); line.appendTo("#schedules");
$(line).find("input[type='checkbox']").
prop("checked", false).
iphoneStyle("calculateDimensions").
iphoneStyle("refresh");
return line; return line;
} }
@ -697,7 +701,7 @@ function initRelays(data) {
$(".id", line).html(i); $(".id", line).html(i);
$("input", line).attr("data", i); $("input", line).attr("data", i);
line.appendTo("#relays"); line.appendTo("#relays");
$(":checkbox", line).iphoneStyle({
$("input[type='checkbox']", line).iphoneStyle({
onChange: doToggle, onChange: doToggle,
resizeContainer: true, resizeContainer: true,
resizeHandle: true, resizeHandle: true,
@ -1079,7 +1083,7 @@ function processData(data) {
var sch_value = schedule[key]; var sch_value = schedule[key];
$("input[name='" + key + "']", sch_line).val(sch_value); $("input[name='" + key + "']", sch_line).val(sch_value);
$("select[name='" + key + "']", sch_line).prop("value", sch_value); $("select[name='" + key + "']", sch_line).prop("value", sch_value);
$(":checkbox[name='" + key + "']", sch_line).
$("input[type='checkbox'][name='" + key + "']", sch_line).
prop("checked", sch_value). prop("checked", sch_value).
iphoneStyle("refresh"); iphoneStyle("refresh");
}); });


BIN
images/devices/intermittech-quinled-2.6.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 29 KiB

BIN
images/devices/lingan-swa1.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 10 KiB

BIN
images/devices/mancavemade-esp-live.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 9.4 KiB

BIN
images/devices/maxcio-15a.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 3.5 KiB

BIN
images/devices/xenon-sm-pw702u.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 25 KiB

BIN
images/devices/yidian-16a.jpg View File

Before After
Width: 400  |  Height: 400  |  Size: 6.0 KiB

Loading…
Cancel
Save