Added fix to prevent sending nan value through http get to the destination webserver.

This commit is contained in:
Kai Lauterbach 2022-11-11 11:23:08 +01:00
parent 3e206715fd
commit baff93865c

View file

@ -688,7 +688,7 @@ String getJsonData()
String(currentSensorData[SENSOR_TEMPERATURE], 2) + String(currentSensorData[SENSOR_TEMPERATURE], 2) +
", " + ", " +
hb_ws_msg_humi + hb_ws_msg_humi +
String(currentSensorData[SENSOR_HUMIDITY], 2) + String( (isnan(currentSensorData[SENSOR_HUMIDITY]) ? 0.0 : currentSensorData[SENSOR_HUMIDITY]), 2) +
", " + ", " +
hb_ws_msg_light + hb_ws_msg_light +
String(currentSensorData[SENSOR_LIGHT], 0) + // The light level for the homebridge-http-lux2 plugin is only able to parse integer values String(currentSensorData[SENSOR_LIGHT], 0) + // The light level for the homebridge-http-lux2 plugin is only able to parse integer values
@ -713,7 +713,7 @@ void http_call_send_json_data()
{ {
currentSensorData[sensor_cnt] = measure_wind_result(); currentSensorData[sensor_cnt] = measure_wind_result();
debug("http call to " + String(currentSensorData[sensor_cnt])); //debug("http call to " + String(HTTP_CALL_SEND_JSON_DATA_URL));
// windspeed exceeded send http call // windspeed exceeded send http call
digitalWrite(STATUS_LED_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW);