mirror of https://github.com/arendst/Tasmota.git
v3.9.9
3.9.9 20170130 * Add command status 10 showing sensor data * Fix hlw status messages if hlw is disabled * Remove GPIO07 and GPIO08 from user selectable (#5)
This commit is contained in:
parent
28d457cd82
commit
aaf75f6acb
|
@ -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 **3.9.8** - See ```sonoff/_releasenotes.ino``` for change information.
|
Current version is **3.9.9** - See ```sonoff/_releasenotes.ino``` for change information.
|
||||||
|
|
||||||
- This version provides all (Sonoff) modules in one file and starts up with Sonoff Basic.
|
- This version provides all (Sonoff) modules in one file and starts up with Sonoff Basic.
|
||||||
- Once uploaded select module using the configuration webpage or the commands ```Modules``` and ```Module```.
|
- Once uploaded select module using the configuration webpage or the commands ```Modules``` and ```Module```.
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +1,8 @@
|
||||||
/* 3.9.8 20170130
|
/* 3.9.9 20170130
|
||||||
|
* Add command status 10 showing sensor data
|
||||||
|
* Fix hlw status messages if hlw is disabled
|
||||||
|
*
|
||||||
|
* 3.9.8 20170130
|
||||||
* Remove GPIO07 and GPIO08 from user selectable (#5)
|
* Remove GPIO07 and GPIO08 from user selectable (#5)
|
||||||
*
|
*
|
||||||
* 3.9.7 20170129
|
* 3.9.7 20170129
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VERSION 0x03090800 // 3.9.8
|
#define VERSION 0x03090900 // 3.9.9
|
||||||
|
|
||||||
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};
|
||||||
|
@ -93,7 +93,7 @@ enum emul_t {EMUL_NONE, EMUL_WEMO, EMUL_HUE, EMUL_MAX};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define APP_BAUDRATE 115200 // Default serial baudrate
|
#define APP_BAUDRATE 115200 // Default serial baudrate
|
||||||
#define MAX_STATUS 9
|
#define MAX_STATUS 10
|
||||||
|
|
||||||
enum butt_t {PRESSED, NOT_PRESSED};
|
enum butt_t {PRESSED, NOT_PRESSED};
|
||||||
|
|
||||||
|
@ -1836,6 +1836,7 @@ void publish_status(uint8_t payload)
|
||||||
(!strcmp(SUB_PREFIX,PUB_PREFIX) && (!payload)) ? PUB_PREFIX2 : PUB_PREFIX, sysCfg.mqtt_topic);
|
(!strcmp(SUB_PREFIX,PUB_PREFIX) && (!payload)) ? PUB_PREFIX2 : PUB_PREFIX, sysCfg.mqtt_topic);
|
||||||
|
|
||||||
if ((!sysCfg.mqtt_enabled) && (payload == 6)) payload = 99;
|
if ((!sysCfg.mqtt_enabled) && (payload == 6)) payload = 99;
|
||||||
|
if ((!hlw_flg) && ((payload == 8) || (payload == 9))) payload = 99;
|
||||||
|
|
||||||
if ((payload == 0) || (payload == 99)) {
|
if ((payload == 0) || (payload == 99)) {
|
||||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Status\":{\"Module\":%d, \"FriendlyName\":\"%s\", \"Topic\":\"%s\", \"ButtonTopic\":\"%s\", \"Subtopic\":\"%s\", \"Power\":%d, \"PowerOnState\":%d, \"LedState\":%d, \"SaveData\":%d, \"SaveState\":%d, \"ButtonRetain\":%d, \"PowerRetain\":%d}}"),
|
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Status\":{\"Module\":%d, \"FriendlyName\":\"%s\", \"Topic\":\"%s\", \"ButtonTopic\":\"%s\", \"Subtopic\":\"%s\", \"Power\":%d, \"PowerOnState\":%d, \"LedState\":%d, \"SaveData\":%d, \"SaveState\":%d, \"ButtonRetain\":%d, \"PowerRetain\":%d}}"),
|
||||||
|
@ -1902,11 +1903,53 @@ void publish_status(uint8_t payload)
|
||||||
if ((payload == 0) || (payload == 7)) {
|
if ((payload == 0) || (payload == 7)) {
|
||||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"StatusTIM\":{\"UTC\":\"%s\", \"Local\":\"%s\", \"StartDST\":\"%s\", \"EndDST\":\"%s\", \"Timezone\":%d}}"),
|
snprintf_P(svalue, sizeof(svalue), PSTR("{\"StatusTIM\":{\"UTC\":\"%s\", \"Local\":\"%s\", \"StartDST\":\"%s\", \"EndDST\":\"%s\", \"Timezone\":%d}}"),
|
||||||
rtc_time(0).c_str(), rtc_time(1).c_str(), rtc_time(2).c_str(), rtc_time(3).c_str(), sysCfg.timezone);
|
rtc_time(0).c_str(), rtc_time(1).c_str(), rtc_time(2).c_str(), rtc_time(3).c_str(), sysCfg.timezone);
|
||||||
|
if (payload == 0) mqtt_publish(stopic, svalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((payload == 0) || (payload == 10)) {
|
||||||
|
uint8_t djson = 0;
|
||||||
|
snprintf_P(svalue, sizeof(svalue), PSTR("{\"StatusSNS\":"));
|
||||||
|
sensors_mqttPresent(svalue, sizeof(svalue), &djson);
|
||||||
|
if (!djson) snprintf_P(svalue, sizeof(svalue), PSTR("%s}"), svalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
mqtt_publish(stopic, svalue);
|
mqtt_publish(stopic, svalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sensors_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
|
{
|
||||||
|
char stime[21];
|
||||||
|
|
||||||
|
snprintf_P(stime, sizeof(stime), PSTR("%04d-%02d-%02dT%02d:%02d:%02d"),
|
||||||
|
rtcTime.Year, rtcTime.Month, rtcTime.Day, rtcTime.Hour, rtcTime.Minute, rtcTime.Second);
|
||||||
|
snprintf_P(svalue, ssvalue, PSTR("%s{\"Time\":\"%s\""), svalue, stime);
|
||||||
|
if (pin[GPIO_DSB] < 99) {
|
||||||
|
#ifdef USE_DS18B20
|
||||||
|
dsb_mqttPresent(svalue, ssvalue, djson);
|
||||||
|
#endif // USE_DS18B20
|
||||||
|
#ifdef USE_DS18x20
|
||||||
|
ds18x20_mqttPresent(svalue, ssvalue, djson);
|
||||||
|
#endif // USE_DS18x20
|
||||||
|
}
|
||||||
|
#if defined(USE_DHT) || defined(USE_DHT2)
|
||||||
|
if (dht_type) dht_mqttPresent(svalue, ssvalue, djson);
|
||||||
|
#endif // USE_DHT/2
|
||||||
|
#ifdef USE_I2C
|
||||||
|
if (i2c_flg) {
|
||||||
|
#ifdef USE_HTU
|
||||||
|
htu_mqttPresent(svalue, ssvalue, djson);
|
||||||
|
#endif // USE_HTU
|
||||||
|
#ifdef USE_BMP
|
||||||
|
bmp_mqttPresent(svalue, ssvalue, djson);
|
||||||
|
#endif // USE_BMP
|
||||||
|
#ifdef USE_BH1750
|
||||||
|
bh1750_mqttPresent(svalue, ssvalue, djson);
|
||||||
|
#endif // USE_BH1750
|
||||||
|
}
|
||||||
|
#endif // USE_I2C
|
||||||
|
snprintf_P(svalue, ssvalue, PSTR("%s}"), svalue);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
void every_second_cb()
|
void every_second_cb()
|
||||||
|
@ -2003,37 +2046,11 @@ void every_second()
|
||||||
mqtt_publish(stopic, svalue);
|
mqtt_publish(stopic, svalue);
|
||||||
|
|
||||||
uint8_t djson = 0;
|
uint8_t djson = 0;
|
||||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Time\":\"%s\""), stime);
|
svalue[0] = '\0';
|
||||||
if (pin[GPIO_DSB] < 99) {
|
sensors_mqttPresent(svalue, sizeof(svalue), &djson);
|
||||||
#ifdef USE_DS18B20
|
if (djson) mqtt_publish(stopic, svalue);
|
||||||
dsb_mqttPresent(svalue, sizeof(svalue), &djson, 0);
|
|
||||||
#endif // USE_DS18B20
|
|
||||||
#ifdef USE_DS18x20
|
|
||||||
ds18x20_mqttPresent(svalue, sizeof(svalue), &djson, 0);
|
|
||||||
#endif // USE_DS18x20
|
|
||||||
}
|
|
||||||
#if defined(USE_DHT) || defined(USE_DHT2)
|
|
||||||
if (dht_type) dht_mqttPresent(svalue, sizeof(svalue), &djson, 1);
|
|
||||||
#endif // USE_DHT/2
|
|
||||||
#ifdef USE_I2C
|
|
||||||
if (i2c_flg) {
|
|
||||||
#ifdef USE_HTU
|
|
||||||
htu_mqttPresent(svalue, sizeof(svalue), &djson, 1);
|
|
||||||
#endif // USE_HTU
|
|
||||||
#ifdef USE_BMP
|
|
||||||
bmp_mqttPresent(svalue, sizeof(svalue), &djson, 2);
|
|
||||||
#endif // USE_BMP
|
|
||||||
#ifdef USE_BH1750
|
|
||||||
bh1750_mqttPresent(svalue, sizeof(svalue), &djson, 3);
|
|
||||||
#endif // USE_BH1750
|
|
||||||
}
|
|
||||||
#endif // USE_I2C
|
|
||||||
if (djson) {
|
|
||||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s}"), svalue);
|
|
||||||
mqtt_publish(stopic, svalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hlw_flg) hlw_mqttPresent(4);
|
if (hlw_flg) hlw_mqttPresent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ boolean bh1750_detect()
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void bh1750_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void bh1750_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
if (!bh1750type) return;
|
if (!bh1750type) return;
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ boolean bmp_detect()
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void bmp_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void bmp_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
if (!bmptype) return;
|
if (!bmptype) return;
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ void dht_init()
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void dht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void dht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
char stemp1[10], stemp2[10];
|
char stemp1[10], stemp2[10];
|
||||||
float t, h;
|
float t, h;
|
||||||
|
|
|
@ -57,7 +57,7 @@ void dht_init()
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void dht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void dht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
char stemp1[10], stemp2[10];
|
char stemp1[10], stemp2[10];
|
||||||
float t, h;
|
float t, h;
|
||||||
|
|
|
@ -172,7 +172,7 @@ boolean dsb_readTemp(bool S, float &t)
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void dsb_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void dsb_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
char stemp1[10];
|
char stemp1[10];
|
||||||
float t;
|
float t;
|
||||||
|
|
|
@ -155,7 +155,7 @@ boolean ds18x20_read(uint8_t sensor, bool S, float &t)
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void ds18x20_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void ds18x20_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
char stemp1[10], stemp2[10];
|
char stemp1[10], stemp2[10];
|
||||||
float t;
|
float t;
|
||||||
|
|
|
@ -520,7 +520,7 @@ void hlw_commands(char *svalue, uint16_t ssvalue)
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void hlw_mqttPresent(uint8_t domidx)
|
void hlw_mqttPresent()
|
||||||
{
|
{
|
||||||
char stopic[TOPSZ], svalue[MESSZ], stime[21], stemp0[10], stemp1[10], stemp2[10], stemp3[10];
|
char stopic[TOPSZ], svalue[MESSZ], stime[21], stemp0[10], stemp1[10], stemp2[10], stemp3[10];
|
||||||
float ped, pi, pc;
|
float ped, pi, pc;
|
||||||
|
|
|
@ -229,7 +229,7 @@ uint8_t htu_detect()
|
||||||
* Presentation
|
* Presentation
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
void htu_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson, uint8_t domidx)
|
void htu_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
||||||
{
|
{
|
||||||
if (!htutype) return;
|
if (!htutype) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue