diff --git a/README.md b/README.md
index 9870bb54..0d3f92d1 100644
--- a/README.md
+++ b/README.md
@@ -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)
---
-
-> **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**:
+> * Default branch in GitHub is now the development branch "dev".
+> * 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
* 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 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)
* Environment
* **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
---
-> **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**:
+> * Default branch in GitHub is now the development branch "dev".
+> * 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.
@@ -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 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**|
-|![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**|**Itead Sonoff T1**||
|![Itead Slampher](images/devices/itead-slampher.jpg)|||
|**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**|**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)**|**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**|**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**|**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**|
-|![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:**
-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
diff --git a/code/.gitignore b/code/.gitignore
index 1d66a1d5..28fb16ac 100644
--- a/code/.gitignore
+++ b/code/.gitignore
@@ -7,3 +7,4 @@ core_version.h
.pioenvs
.piolibdeps
.DS_Store
+.python-version
\ No newline at end of file
diff --git a/code/espurna/button.ino b/code/espurna/button.ino
index 657cc197..cd94082d 100644
--- a/code/espurna/button.ino
+++ b/code/espurna/button.ino
@@ -27,7 +27,7 @@ void buttonMQTT(unsigned char id, uint8_t event) {
if (id >= _buttons.size()) return;
char payload[2];
itoa(event, payload, 10);
- mqttSend(MQTT_TOPIC_BUTTON, id, payload);
+ mqttSend(MQTT_TOPIC_BUTTON, id, payload, false, false); // 1st bool = force, 2nd = retain
}
#endif
diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h
index a88dc42d..0d2562fa 100644
--- a/code/espurna/config/general.h
+++ b/code/espurna/config/general.h
@@ -61,8 +61,8 @@
#ifndef SERIAL_RX_PORT
#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
#ifndef SERIAL_RX_BAUDRATE
@@ -139,8 +139,10 @@
#endif
#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
// the system is flagged as unstable
+#endif
//------------------------------------------------------------------------------
// EEPROM
diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino
index b7814b3d..ea53f7af 100644
--- a/code/espurna/mqtt.ino
+++ b/code/espurna/mqtt.ino
@@ -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_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);
#else
- _mqtt.publish(topic, message, _mqtt_retain);
+ _mqtt.publish(topic, message, retain);
DEBUG_MSG_P(PSTR("[MQTT] Sending %s => %s\n"), topic, message);
#endif
}
}
+
+void mqttSendRaw(const char * topic, const char * message) {
+ mqttSendRaw (topic, message, _mqtt_retain);
+}
+
void mqttFlush() {
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;
@@ -585,20 +591,28 @@ void mqttSend(const char * topic, const char * message, bool force) {
// Send it right away
} 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) {
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];
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) {
diff --git a/code/html/custom.js b/code/html/custom.js
index d423a801..b2e90172 100644
--- a/code/html/custom.js
+++ b/code/html/custom.js
@@ -161,9 +161,9 @@ function validateForm(form) {
function getValue(element) {
if ($(element).attr("type") === "checkbox") {
- return $(element).is(":checked") ? 1 : 0;
+ return $(element).prop("checked") ? 1 : 0;
} else if ($(element).attr("type") === "radio") {
- if (!$(element).is(":checked")) {
+ if (!$(element).prop("checked")) {
return null;
}
}
@@ -559,9 +559,9 @@ function toggleMenu() {
function showPanel() {
$(".panel").hide();
- $("#" + $(this).attr("data")).show();
if ($("#layout").hasClass("active")) { toggleMenu(); }
- $("input[type='checkbox']").
+ $("#" + $(this).attr("data")).show().
+ find("input[type='checkbox']").
iphoneStyle("calculateDimensions").
iphoneStyle("refresh");
}
@@ -674,9 +674,13 @@ function addSchedule(event) {
});
$(line).find(".button-del-schedule").on("click", delSchedule);
$(line).find(".button-more-schedule").on("click", moreSchedule);
- var ena = $(line).find(":checkbox");
- ena.prop("checked", false).iphoneStyle("refresh");
line.appendTo("#schedules");
+
+ $(line).find("input[type='checkbox']").
+ prop("checked", false).
+ iphoneStyle("calculateDimensions").
+ iphoneStyle("refresh");
+
return line;
}
@@ -697,7 +701,7 @@ function initRelays(data) {
$(".id", line).html(i);
$("input", line).attr("data", i);
line.appendTo("#relays");
- $(":checkbox", line).iphoneStyle({
+ $("input[type='checkbox']", line).iphoneStyle({
onChange: doToggle,
resizeContainer: true,
resizeHandle: true,
@@ -1079,7 +1083,7 @@ function processData(data) {
var sch_value = schedule[key];
$("input[name='" + key + "']", sch_line).val(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).
iphoneStyle("refresh");
});
diff --git a/images/devices/intermittech-quinled-2.6.jpg b/images/devices/intermittech-quinled-2.6.jpg
new file mode 100644
index 00000000..6c491b93
Binary files /dev/null and b/images/devices/intermittech-quinled-2.6.jpg differ
diff --git a/images/devices/lingan-swa1.jpg b/images/devices/lingan-swa1.jpg
new file mode 100644
index 00000000..122a6967
Binary files /dev/null and b/images/devices/lingan-swa1.jpg differ
diff --git a/images/devices/mancavemade-esp-live.jpg b/images/devices/mancavemade-esp-live.jpg
new file mode 100644
index 00000000..bfe3b379
Binary files /dev/null and b/images/devices/mancavemade-esp-live.jpg differ
diff --git a/images/devices/maxcio-15a.jpg b/images/devices/maxcio-15a.jpg
deleted file mode 100644
index a7974a55..00000000
Binary files a/images/devices/maxcio-15a.jpg and /dev/null differ
diff --git a/images/devices/xenon-sm-pw702u.jpg b/images/devices/xenon-sm-pw702u.jpg
new file mode 100644
index 00000000..93173820
Binary files /dev/null and b/images/devices/xenon-sm-pw702u.jpg differ
diff --git a/images/devices/yidian-16a.jpg b/images/devices/yidian-16a.jpg
deleted file mode 100644
index 1f36b69c..00000000
Binary files a/images/devices/yidian-16a.jpg and /dev/null differ