Update xsns_86_tfminiplus.ino: FIX json output (#18321)

Fixes JSON measurement output. Output numbers like Distance and SignalStrength were published as a string. Now they have the right data type.
This commit is contained in:
Zbyněk Kocur 2023-04-03 16:47:44 +02:00 committed by GitHub
parent 542eca3154
commit b1ea413eae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -191,7 +191,7 @@ void TfmpShow(bool json) {
float distance = (float)tfminiplus_sensor.distance; // cm
if (json) {
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_DISTANCE "\":\"%1_f\",\"" D_JSON_SIGNALSTRENGTH "\":\"%d\",\"" D_JSON_CHIPTEMPERATURE "\":%d}"),
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_DISTANCE "\":%1_f,\"" D_JSON_SIGNALSTRENGTH "\":%d,\"" D_JSON_CHIPTEMPERATURE "\":%d}"),
sensor_name, &distance, tfminiplus_sensor.sigstrength, tfminiplus_sensor.chiptemp);
#ifdef USE_DOMOTICZ
if (0 == TasmotaGlobal.tele_period) {
@ -242,4 +242,4 @@ bool Xsns86(uint32_t callback_id)
}
return result;
}
#endif // USE_TFMINIPLUS
#endif // USE_TFMINIPLUS