mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Fix Sonoff Pow exception 0 where epc1=0x40107345
This commit is contained in:
parent
c0b1ceba8b
commit
2efb5cd1cd
@ -1,4 +1,7 @@
|
||||
/* 5.5.2 20170808
|
||||
/* 5.5.2a
|
||||
* Fix intermittent exception 0 on Sonoff Pow
|
||||
*
|
||||
* 5.5.2 20170808
|
||||
* Extent max number of WS2812 pixels from 256 to 512 (#667)
|
||||
* Add OTA handling if server responds with no update available (#695)
|
||||
* Removed undocumented command FlashMode (#696)
|
||||
|
@ -25,7 +25,7 @@
|
||||
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
||||
====================================================*/
|
||||
|
||||
#define VERSION 0x05050200 // 5.5.2
|
||||
#define VERSION 0x05050201 // 5.5.2a
|
||||
|
||||
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};
|
||||
@ -1999,7 +1999,7 @@ void every_second()
|
||||
}
|
||||
|
||||
if (hlw_flg) {
|
||||
hlw_mqttPresent();
|
||||
hlw_mqttPresent(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ void hlw_savestate()
|
||||
sysCfg.hlw_kWhtotal = rtcMem.hlw_kWhtotal;
|
||||
}
|
||||
|
||||
boolean hlw_readEnergy(byte option, float &et, float &ed, uint16_t &e, uint16_t &w, float &u, float &i, float &c)
|
||||
void hlw_readEnergy(byte option, float &et, float &ed, uint16_t &e, uint16_t &w, float &u, float &i, float &c)
|
||||
{
|
||||
unsigned long cur_kWhtoday = hlw_kWhtoday;
|
||||
unsigned long hlw_len;
|
||||
@ -202,6 +202,9 @@ boolean hlw_readEnergy(byte option, float &et, float &ed, uint16_t &e, uint16_t
|
||||
} else {
|
||||
hlw_period = rtc_loctime() - hlw_lasttime;
|
||||
}
|
||||
if (!hlw_period) {
|
||||
hlw_period = sysCfg.tele_period;
|
||||
}
|
||||
hlw_lasttime = rtc_loctime();
|
||||
hlw_interval = 3600 / hlw_period;
|
||||
if (hlw_Ecntr) {
|
||||
@ -241,8 +244,6 @@ boolean hlw_readEnergy(byte option, float &et, float &ed, uint16_t &e, uint16_t
|
||||
} else {
|
||||
c = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void hlw_init()
|
||||
@ -366,7 +367,7 @@ void hlw_margin_chk()
|
||||
if (jsonflg) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s}"), svalue);
|
||||
mqtt_publish_topic_P(2, PSTR("MARGINS"), svalue);
|
||||
hlw_mqttPresent();
|
||||
hlw_mqttPresent(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +382,7 @@ void hlw_margin_chk()
|
||||
if (!hlw_mplh_counter) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"MaxPowerReached\":\"%d%s\"}"), pw, (sysCfg.flag.value_units) ? " W" : "");
|
||||
mqtt_publish_topic_P(1, PSTR("WARNING"), svalue);
|
||||
hlw_mqttPresent();
|
||||
hlw_mqttPresent(0);
|
||||
do_cmnd_power(1, 0);
|
||||
if (!hlw_mplr_counter) {
|
||||
hlw_mplr_counter = sysCfg.param[P_MAX_POWER_RETRY] +1;
|
||||
@ -408,7 +409,7 @@ void hlw_margin_chk()
|
||||
} else {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"MaxPowerReachedRetry\":\"%s\"}"), getStateText(0));
|
||||
mqtt_publish_topic_P(1, PSTR("WARNING"), svalue);
|
||||
hlw_mqttPresent();
|
||||
hlw_mqttPresent(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -429,7 +430,7 @@ void hlw_margin_chk()
|
||||
dtostrf(ped, 1, 3, svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"MaxEnergyReached\":\"%s%s\"}"), svalue, (sysCfg.flag.value_units) ? " kWh" : "");
|
||||
mqtt_publish_topic_P(1, PSTR("WARNING"), svalue);
|
||||
hlw_mqttPresent();
|
||||
hlw_mqttPresent(0);
|
||||
do_cmnd_power(1, 0);
|
||||
}
|
||||
}
|
||||
@ -647,13 +648,13 @@ void hlw_mqttStat(byte option, char* svalue, uint16_t ssvalue)
|
||||
#endif // USE_DOMOTICZ
|
||||
}
|
||||
|
||||
void hlw_mqttPresent()
|
||||
void hlw_mqttPresent(byte option)
|
||||
{
|
||||
// {"Time":"2017-03-04T13:37:24", "Total":0.013, "Yesterday":0.013, "Today":0.000, "Period":0, "Power":0, "Factor":0.00, "Voltage":0, "Current":0.000}
|
||||
char svalue[200]; // was MESSZ
|
||||
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Time\":\"%s\", "), getDateTime().c_str());
|
||||
hlw_mqttStat(1, svalue, sizeof(svalue));
|
||||
hlw_mqttStat(option, svalue, sizeof(svalue));
|
||||
mqtt_publish_topic_P(2, PSTR("ENERGY"), svalue);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user