From 52a0d5b365c9dbf4dc8d5bbcf14c3dcd26d602f6 Mon Sep 17 00:00:00 2001 From: SteWers <42718143+SteWers@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:00:55 +0100 Subject: [PATCH] [Thermostat] Fix JSON index (#20011) * [Thermostat] Fix JSON index * Fix index in debug log --- tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino b/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino index 3443db6a9..b3af31b20 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_39_thermostat.ino @@ -1285,7 +1285,7 @@ void ThermostatDebug(uint8_t ctr_output) { char ctr_output_chr[FLOATSZ]; char result_chr[FLOATSZ]; - dtostrfd(ctr_output, 0, ctr_output_chr); + dtostrfd(ctr_output + 1, 0, ctr_output_chr); dtostrfd(Thermostat[ctr_output].status.counter_seconds, 0, result_chr); AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_THERMOSTAT "Thermostat[%s].status.counter_seconds: %s"), ctr_output_chr, result_chr); dtostrfd(Thermostat[ctr_output].status.thermostat_mode, 0, result_chr); @@ -1340,7 +1340,7 @@ void DebugControllerParameters(uint8_t ctr_output) { char ctr_output_chr[FLOATSZ]; char result_chr[FLOATSZ]; - dtostrfd(ctr_output, 0, ctr_output_chr); + dtostrfd(ctr_output + 1, 0, ctr_output_chr); dtostrfd(Thermostat[ctr_output].status.controller_mode, 0, result_chr); AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_THERMOSTAT "Thermostat[%s].CONTROLLERMODESET: %s"), ctr_output_chr, result_chr); dtostrfd(Thermostat[ctr_output].time_pi_cycle, 0, result_chr); @@ -2049,7 +2049,7 @@ void CmndEnableOutputSet(void) \*********************************************************************************************/ #ifdef USE_WEBSERVER -const char HTTP_THERMOSTAT_INFO[] PROGMEM = "{s}" D_THERMOSTAT "{m}%s{e}"; +const char HTTP_THERMOSTAT_INFO[] PROGMEM = "{s}" D_THERMOSTAT " %d{m}%s{e}"; const char HTTP_THERMOSTAT_TEMPERATURE[] PROGMEM = "{s}%s{m}%*_f " D_UNIT_DEGREE "%c{e}"; const char HTTP_THERMOSTAT_TEMP_GRAD[] PROGMEM = "{s}" D_THERMOSTAT_GRADIENT "{m}%c%*_f " D_UNIT_DEGREE "%c/" D_UNIT_HOUR "{e}"; const char HTTP_THERMOSTAT_DUTY_CYCLE[] PROGMEM = "{s}" D_THERMOSTAT_DUTY_CYCLE "{m}%d " D_UNIT_PERCENT "{e}"; @@ -2068,7 +2068,7 @@ void ThermostatShow(uint8_t ctr_output, bool json) { if (json) { float f_target_temp = Thermostat[ctr_output].temp_target_level / 10.0f; - ResponseAppend_P(PSTR(",\"Thermostat%i\":{"), ctr_output); + ResponseAppend_P(PSTR(",\"Thermostat%i\":{"), ctr_output + 1); ResponseAppend_P(PSTR("%s\"%s\":%i"), "", D_CMND_THERMOSTATMODESET, Thermostat[ctr_output].status.thermostat_mode); ResponseAppend_P(PSTR("%s\"%s\":%2_f"), ",", D_CMND_TEMPTARGETSET, &f_target_temp); ResponseAppend_P(PSTR("%s\"%s\":%i"), ",", D_CMND_CTRDUTYCYCLEREAD, ThermostatGetDutyCycle(ctr_output)); @@ -2083,13 +2083,13 @@ void ThermostatShow(uint8_t ctr_output, bool json) WSContentSend_P(HTTP_THERMOSTAT_HL); if (Thermostat[ctr_output].status.thermostat_mode == THERMOSTAT_OFF) { - WSContentSend_P(HTTP_THERMOSTAT_INFO, D_DISABLED ); + WSContentSend_P(HTTP_THERMOSTAT_INFO, ctr_output + 1, D_DISABLED ); } else { char c_unit = Thermostat[ctr_output].status.temp_format==TEMP_CELSIUS ? D_UNIT_CELSIUS[0] : D_UNIT_FAHRENHEIT[0]; float f_temperature; - WSContentSend_P(HTTP_THERMOSTAT_INFO, D_ENABLED); + WSContentSend_P(HTTP_THERMOSTAT_INFO, ctr_output + 1, D_ENABLED); f_temperature = Thermostat[ctr_output].temp_target_level / 10.0f; WSContentSend_PD(HTTP_THERMOSTAT_TEMPERATURE, D_THERMOSTAT_SET_POINT, Settings->flag2.temperature_resolution, &f_temperature, c_unit);