mirror of https://github.com/arendst/Tasmota.git
v5.7.1f - Add dimmer parameter to Wakeup
5.7.1f * Reduce code and string length for output of commands Modules and GPIOs * Add optional dimmer parameter to command Wakeup for AiLight, Sonoff B1, Led and BN-SZ01 (#867)
This commit is contained in:
parent
2d5fc29976
commit
cb0410a5dc
|
@ -1,7 +1,7 @@
|
||||||
## Sonoff-Tasmota
|
## Sonoff-Tasmota
|
||||||
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
|
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
|
||||||
|
|
||||||
Current version is **5.7.1e** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
Current version is **5.7.1f** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||||
|
|
||||||
### ATTENTION All versions
|
### ATTENTION All versions
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
/* 5.7.1e
|
/* 5.7.1f
|
||||||
|
* Reduce code and string length for output of commands Modules and GPIOs
|
||||||
|
* Add optional dimmer parameter to command Wakeup (#867)
|
||||||
|
*
|
||||||
|
* 5.7.1e
|
||||||
* Add Sonoff SC debug information
|
* Add Sonoff SC debug information
|
||||||
* Change syslog service
|
* Change syslog service
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
||||||
====================================================*/
|
====================================================*/
|
||||||
|
|
||||||
#define VERSION 0x05070105 // 5.7.1e
|
#define VERSION 0x05070106 // 5.7.1f
|
||||||
|
|
||||||
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
|
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
|
||||||
enum week_t {Last, First, Second, Third, Fourth};
|
enum week_t {Last, First, Second, Third, Fourth};
|
||||||
|
@ -882,6 +882,8 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
byte otype = 0;
|
byte otype = 0;
|
||||||
byte ptype = 0;
|
byte ptype = 0;
|
||||||
|
byte jsflg = 0;
|
||||||
|
byte lines = 1;
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
uint16_t grpflg = 0;
|
uint16_t grpflg = 0;
|
||||||
uint16_t index;
|
uint16_t index;
|
||||||
|
@ -1178,29 +1180,23 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%d (%s)\"}"), sysCfg.module +1, stemp1);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%d (%s)\"}"), sysCfg.module +1, stemp1);
|
||||||
}
|
}
|
||||||
else if (!strcasecmp_P(type, PSTR(D_CMND_MODULES))) {
|
else if (!strcasecmp_P(type, PSTR(D_CMND_MODULES))) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULES "1\":\""));
|
for (byte i = 0; i < MAXMODULE; i++) {
|
||||||
byte jsflg = 0;
|
if (!jsflg) {
|
||||||
for (byte i = 0; i < MAXMODULE /2; i++) {
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULES "%d\":\""), lines);
|
||||||
if (jsflg) {
|
} else {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, "), mqtt_data);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, "), mqtt_data);
|
||||||
}
|
}
|
||||||
jsflg = 1;
|
jsflg = 1;
|
||||||
snprintf_P(stemp1, sizeof(stemp1), modules[i].name);
|
snprintf_P(stemp1, sizeof(stemp1), modules[i].name);
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d (%s)"), mqtt_data, i +1, stemp1);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d (%s)"), mqtt_data, i +1, stemp1);
|
||||||
}
|
if ((strlen(mqtt_data) > 200) || (i == MAXMODULE -1)) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data);
|
||||||
mqtt_publish_topic_P(5, type);
|
mqtt_publish_topic_P(5, type);
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULES "2\":\""));
|
jsflg = 0;
|
||||||
jsflg = 0;
|
lines++;
|
||||||
for (byte i = MAXMODULE /2; i < MAXMODULE; i++) {
|
|
||||||
if (jsflg) {
|
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, "), mqtt_data);
|
|
||||||
}
|
}
|
||||||
jsflg = 1;
|
|
||||||
snprintf_P(stemp1, sizeof(stemp1), modules[i].name);
|
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d (%s)"), mqtt_data, i +1, stemp1);
|
|
||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data);
|
mqtt_data[0] = '\0';
|
||||||
}
|
}
|
||||||
else if (!strcasecmp_P(type, PSTR(D_CMND_GPIO)) && (index < MAX_GPIO_PIN)) {
|
else if (!strcasecmp_P(type, PSTR(D_CMND_GPIO)) && (index < MAX_GPIO_PIN)) {
|
||||||
mytmplt cmodule;
|
mytmplt cmodule;
|
||||||
|
@ -1233,29 +1229,23 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcasecmp_P(type, PSTR(D_CMND_GPIOS))) {
|
else if (!strcasecmp_P(type, PSTR(D_CMND_GPIOS))) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_GPIOS "1\":\""));
|
for (byte i = 0; i < GPIO_SENSOR_END; i++) {
|
||||||
byte jsflg = 0;
|
if (!jsflg) {
|
||||||
for (byte i = 0; i < GPIO_SENSOR_END /2; i++) {
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_GPIOS "%d\":\""), lines);
|
||||||
if (jsflg) {
|
} else {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, "), mqtt_data);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, "), mqtt_data);
|
||||||
}
|
}
|
||||||
jsflg = 1;
|
jsflg = 1;
|
||||||
snprintf_P(stemp1, sizeof(stemp1), sensors[i]);
|
snprintf_P(stemp1, sizeof(stemp1), sensors[i]);
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d (%s)"), mqtt_data, i, stemp1);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d (%s)"), mqtt_data, i, stemp1);
|
||||||
}
|
if ((strlen(mqtt_data) > 200) || (i == GPIO_SENSOR_END -1)) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data);
|
||||||
mqtt_publish_topic_P(5, type);
|
mqtt_publish_topic_P(5, type);
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_GPIOS "2\":\""));
|
jsflg = 0;
|
||||||
jsflg = 0;
|
lines++;
|
||||||
for (byte i = GPIO_SENSOR_END /2; i < GPIO_SENSOR_END; i++) {
|
|
||||||
if (jsflg) {
|
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, "), mqtt_data);
|
|
||||||
}
|
}
|
||||||
jsflg = 1;
|
|
||||||
snprintf_P(stemp1, sizeof(stemp1), sensors[i]);
|
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d (%s)"), mqtt_data, i, stemp1);
|
|
||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data);
|
mqtt_data[0] = '\0';
|
||||||
}
|
}
|
||||||
else if (!strcasecmp_P(type, PSTR(D_CMND_PWM)) && (index > pwm_idxoffset) && (index <= 5)) {
|
else if (!strcasecmp_P(type, PSTR(D_CMND_PWM)) && (index > pwm_idxoffset) && (index <= 5)) {
|
||||||
if ((payload >= 0) && (payload <= PWM_RANGE) && (pin[GPIO_PWM1 + index -1] < 99)) {
|
if ((payload >= 0) && (payload <= PWM_RANGE) && (pin[GPIO_PWM1 + index -1] < 99)) {
|
||||||
|
|
|
@ -549,6 +549,9 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUPDURATION "\":%d}"), sysCfg.led_wakeup);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUPDURATION "\":%d}"), sysCfg.led_wakeup);
|
||||||
}
|
}
|
||||||
else if (!strcasecmp_P(type, PSTR(D_CMND_WAKEUP))) {
|
else if (!strcasecmp_P(type, PSTR(D_CMND_WAKEUP))) {
|
||||||
|
if ((payload >= 0) && (payload <= 100)) {
|
||||||
|
sysCfg.led_dimmer[0] = payload;
|
||||||
|
}
|
||||||
sl_wakeupActive = 3;
|
sl_wakeupActive = 3;
|
||||||
do_cmnd_power(1, 1);
|
do_cmnd_power(1, 1);
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_STARTED "\"}"));
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_STARTED "\"}"));
|
||||||
|
|
Loading…
Reference in New Issue