mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 15:27:17 +00:00
Merge pull request #13834 from lucboudreau/thermo_sensor
Adds some minimal sensor data to the thermostat driver to allow basic…
This commit is contained in:
commit
20a87186fd
@ -2022,8 +2022,17 @@ const char HTTP_THERMOSTAT_HL[] PROGMEM = "{s}<hr>{m}<hr>{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
|
||||
|
Loading…
x
Reference in New Issue
Block a user