mirror of https://github.com/arendst/Tasmota.git
Merge pull request #6243 from s-hadinger/issue_6191
Fix wrong telemetry message when SetOption68 1 (#6191)
This commit is contained in:
commit
b25275f9ae
|
@ -2,6 +2,7 @@
|
||||||
* 6.6.0.5 20190816
|
* 6.6.0.5 20190816
|
||||||
* Add command WebSensor<sensor number> 0/1 to control display of sensor data in web GUI (#6085)
|
* Add command WebSensor<sensor number> 0/1 to control display of sensor data in web GUI (#6085)
|
||||||
* Change some table locations from RAM to Flash
|
* Change some table locations from RAM to Flash
|
||||||
|
* Fix wrong telemetry message when SetOption68 1 (#6191)
|
||||||
*
|
*
|
||||||
* 6.6.0.4 20190806
|
* 6.6.0.4 20190806
|
||||||
* Add support for CHIRP soil moisture sensor by Christian Baars
|
* Add support for CHIRP soil moisture sensor by Christian Baars
|
||||||
|
|
|
@ -629,13 +629,13 @@ void MqttShowState(void)
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_HEAPSIZE "\":%d,\"SleepMode\":\"%s\",\"Sleep\":%u,\"LoadAvg\":%u,\"MqttCount\":%u"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_HEAPSIZE "\":%d,\"SleepMode\":\"%s\",\"Sleep\":%u,\"LoadAvg\":%u,\"MqttCount\":%u"),
|
||||||
ESP.getFreeHeap()/1024, GetTextIndexed(stemp1, sizeof(stemp1), Settings.flag3.sleep_normal, kSleepMode), sleep, loop_load_avg, MqttConnectCount());
|
ESP.getFreeHeap()/1024, GetTextIndexed(stemp1, sizeof(stemp1), Settings.flag3.sleep_normal, kSleepMode), sleep, loop_load_avg, MqttConnectCount());
|
||||||
|
|
||||||
for (uint32_t i = 0; i < devices_present; i++) {
|
for (uint32_t i = 1; i <= devices_present; i++) {
|
||||||
#ifdef USE_LIGHT
|
#ifdef USE_LIGHT
|
||||||
if (i == light_device -1) {
|
if (i >= light_device) {
|
||||||
LightState(1);
|
if (i == light_device) { LightState(1); } // call it only once
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
ResponseAppend_P(PSTR(",\"%s\":\"%s\""), GetPowerDevice(stemp1, i +1, sizeof(stemp1), Settings.flag.device_index_enable), GetStateText(bitRead(power, i)));
|
ResponseAppend_P(PSTR(",\"%s\":\"%s\""), GetPowerDevice(stemp1, i, sizeof(stemp1), Settings.flag.device_index_enable), GetStateText(bitRead(power, i-1)));
|
||||||
#ifdef USE_SONOFF_IFAN
|
#ifdef USE_SONOFF_IFAN
|
||||||
if (IsModuleIfan()) {
|
if (IsModuleIfan()) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_CMND_FANSPEED "\":%d"), GetFanspeed());
|
ResponseAppend_P(PSTR(",\"" D_CMND_FANSPEED "\":%d"), GetFanspeed());
|
||||||
|
|
|
@ -1600,8 +1600,10 @@ void LightState(uint8_t append)
|
||||||
} else {
|
} else {
|
||||||
Response_P(PSTR("{"));
|
Response_P(PSTR("{"));
|
||||||
}
|
}
|
||||||
|
if (!light_pwm_multi_channels) {
|
||||||
GetPowerDevice(scommand, light_device, sizeof(scommand), Settings.flag.device_index_enable);
|
GetPowerDevice(scommand, light_device, sizeof(scommand), Settings.flag.device_index_enable);
|
||||||
ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d"), scommand, GetStateText(light_power), light_state.getDimmer());
|
ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d"), scommand, GetStateText(light_power), light_state.getDimmer());
|
||||||
|
|
||||||
if (light_subtype > LST_SINGLE) {
|
if (light_subtype > LST_SINGLE) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor));
|
ResponseAppend_P(PSTR(",\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor));
|
||||||
uint16_t hue;
|
uint16_t hue;
|
||||||
|
@ -1625,6 +1627,7 @@ void LightState(uint8_t append)
|
||||||
if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) {
|
if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_CMND_COLORTEMPERATURE "\":%d"), light_state.getCT());
|
ResponseAppend_P(PSTR(",\"" D_CMND_COLORTEMPERATURE "\":%d"), light_state.getCT());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (append) {
|
if (append) {
|
||||||
if (light_subtype >= LST_RGB) {
|
if (light_subtype >= LST_RGB) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_CMND_SCHEME "\":%d"), Settings.light_scheme);
|
ResponseAppend_P(PSTR(",\"" D_CMND_SCHEME "\":%d"), Settings.light_scheme);
|
||||||
|
@ -1634,7 +1637,19 @@ void LightState(uint8_t append)
|
||||||
}
|
}
|
||||||
ResponseAppend_P(PSTR(",\"" D_CMND_FADE "\":\"%s\",\"" D_CMND_SPEED "\":%d,\"" D_CMND_LEDTABLE "\":\"%s\""),
|
ResponseAppend_P(PSTR(",\"" D_CMND_FADE "\":\"%s\",\"" D_CMND_SPEED "\":%d,\"" D_CMND_LEDTABLE "\":\"%s\""),
|
||||||
GetStateText(Settings.light_fade), Settings.light_speed, GetStateText(Settings.light_correction));
|
GetStateText(Settings.light_fade), Settings.light_speed, GetStateText(Settings.light_correction));
|
||||||
} else {
|
}
|
||||||
|
} else { // light_pwm_multi_channels
|
||||||
|
for (uint32_t i = 0; i < light_subtype; i++) {
|
||||||
|
GetPowerDevice(scommand, light_device + i, sizeof(scommand), 1);
|
||||||
|
uint32_t light_power_masked = light_power & (1 << i); // the light_power value for this device
|
||||||
|
light_power_masked = light_power_masked ? 1 : 0; // convert to on/off
|
||||||
|
ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_CHANNEL "%d\":%d"), scommand, GetStateText(light_power_masked), light_device + i,
|
||||||
|
changeUIntScale(light_current_color[i], 0, 255, 0, 100));
|
||||||
|
}
|
||||||
|
ResponseAppend_P(PSTR(",\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(scolor));
|
||||||
|
} // light_pwm_multi_channels
|
||||||
|
|
||||||
|
if (!append) {
|
||||||
ResponseJsonEnd();
|
ResponseJsonEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2235,7 +2250,7 @@ void CmndWhite(void)
|
||||||
|
|
||||||
void CmndChannel(void)
|
void CmndChannel(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= light_subtype )) {
|
if ((XdrvMailbox.index >= light_device) && (XdrvMailbox.index < light_device + light_subtype )) {
|
||||||
bool coldim = false;
|
bool coldim = false;
|
||||||
// Set "Channel" directly - this allows Color and Direct PWM control to coexist
|
// Set "Channel" directly - this allows Color and Direct PWM control to coexist
|
||||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) {
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) {
|
||||||
|
|
Loading…
Reference in New Issue