Add DS18B20 ID always to JSON

Add DS18B20 ID always to JSON (#6853)
This commit is contained in:
Theo Arends 2019-11-07 10:44:03 +01:00
parent dde7364b69
commit 799f05dedf

View File

@ -431,15 +431,11 @@ void Ds18x20Show(bool json)
Ds18x20Name(i);
if (json) {
if (1 == ds18x20_sensors) {
ResponseAppend_P(JSON_SNS_TEMP, ds18x20_types, temperature);
} else {
char address[17];
for (uint32_t j = 0; j < 6; j++) {
sprintf(address+2*j, "%02X", ds18x20_sensor[index].address[6-j]); // Skip sensor type and crc
}
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), ds18x20_types, address, temperature);
char address[17];
for (uint32_t j = 0; j < 6; j++) {
sprintf(address+2*j, "%02X", ds18x20_sensor[index].address[6-j]); // Skip sensor type and crc
}
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), ds18x20_types, address, temperature);
#ifdef USE_DOMOTICZ
if ((0 == tele_period) && (0 == i)) {
DomoticzSensor(DZ_TEMP, temperature);