diff --git a/tasmota/xdrv_39_thermostat.ino b/tasmota/xdrv_39_thermostat.ino
index 60a8c7b10..ae8d2d92f 100644
--- a/tasmota/xdrv_39_thermostat.ino
+++ b/tasmota/xdrv_39_thermostat.ino
@@ -2022,8 +2022,17 @@ const char HTTP_THERMOSTAT_HL[] PROGMEM = "{s}
{m}
{e}";
#endif // USE_WEBSERVER
-void ThermostatShow(uint8_t ctr_output)
+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("%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));
+ ResponseJsonEnd();
+ return;
+ }
#ifdef USE_WEBSERVER
WSContentSend_P(HTTP_THERMOSTAT_HL);
@@ -2110,11 +2119,16 @@ bool Xdrv39(uint8_t function)
}
}
break;
+ case FUNC_JSON_APPEND:
+ for (ctr_output = 0; ctr_output < THERMOSTAT_CONTROLLER_OUTPUTS; ctr_output++) {
+ ThermostatShow(ctr_output, true);
+ }
+ break;
#ifdef USE_WEBSERVER
case FUNC_WEB_SENSOR:
for (ctr_output = 0; ctr_output < THERMOSTAT_CONTROLLER_OUTPUTS; ctr_output++) {
- ThermostatShow(ctr_output);
+ ThermostatShow(ctr_output, false);
}
break;
#endif // USE_WEBSERVER