Skip to content

Commit

Permalink
v3.1.15
Browse files Browse the repository at this point in the history
3.1.15 20170108
* Fix Domoticz send key regression with Toggle command
  • Loading branch information
arendst committed Jan 8, 2017
1 parent 3a931e2 commit e9da9b4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Sonoff-MQTT-OTA-Arduino
Provide ESP8266 based itead Sonoff with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.

Current version is **3.1.14** - See ```sonoff/_releasenotes.ino``` for change information.
Current version is **3.1.15** - See ```sonoff/_releasenotes.ino``` for change information.

Starting with version 2.0.0 the following devices are supported:
<img alt="Sonoff" src="https://github.com/arendst/arendst.github.io/blob/master/media/sonoffbasic.jpg" width="250" align="right" />
Expand Down
Binary file modified api/arduino/sonoff.ino.bin
Binary file not shown.
5 changes: 4 additions & 1 deletion sonoff/_releasenotes.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* 3.1.14 20170107
/* 3.1.15 20170108
* Fix Domoticz send key regression with Toggle command
*
* 3.1.14 20170107
* Add support for command TOGGLE (define MQTT_CMND_TOGGLE) when ButtonTopic is in use and not equal to Topic (#207)
*
* 3.1.13 20170107
Expand Down
6 changes: 3 additions & 3 deletions sonoff/sonoff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* ====================================================
*/

#define VERSION 0x03010E00 // 3.1.14
#define VERSION 0x03010F00 // 3.1.15

#define SONOFF 1 // Sonoff, Sonoff RF, Sonoff SV, Sonoff Dual, Sonoff TH, S20 Smart Socket, 4 Channel
#define SONOFF_POW 9 // Sonoff Pow
Expand Down Expand Up @@ -1676,10 +1676,10 @@ void send_button_power(byte device, byte state)
snprintf_P(svalue, sizeof(svalue), PSTR("%s"), (state) ? (state == 2) ? MQTT_CMND_TOGGLE : MQTT_STATUS_ON : MQTT_STATUS_OFF);
}
#ifdef USE_DOMOTICZ
if (sysCfg.domoticz_key_idx[device -1] && strlen(svalue) && !strcmp(sysCfg.mqtt_topic,sysCfg.mqtt_topic2)) {
if (sysCfg.domoticz_key_idx[device -1] && strlen(svalue)) {
strlcpy(stopic, sysCfg.domoticz_in_topic, sizeof(stopic));
snprintf_P(svalue, sizeof(svalue), PSTR("{\"command\":\"switchlight\", \"idx\":%d, \"switchcmd\":\"%s\"}"),
sysCfg.domoticz_key_idx[device -1], (state) ? "On" : "Off");
sysCfg.domoticz_key_idx[device -1], (state) ? (state == 2) ? "Toggle" : "On" : "Off");
mqtt_publish(stopic, svalue);
} else {
mqtt_publish_sec(stopic, svalue, sysCfg.mqtt_button_retain);
Expand Down

0 comments on commit e9da9b4

Please sign in to comment.