Standardize MQTTDiscovery Temp Keys [deprecate tem key] (#703)
* Detect when sensor isn't available or read fails * Add temperature conversion macros * Add 'tempc' & 'tempf' keys to published values * Unique Values for HA Discovery * Remove degree symbol from temp sensors Co-authored-by: Jonathan Michael Wells <jonathan-wells@oist.jp>
This commit is contained in:
1 parent
b7a4591518
commit
4f1b49d135
10 files changed
+97
-52
No files matched your search
@@ -105,7 +105,9 @@ void sendTemperatureData(byte id, float temperature, int humidity, byte battery_
|
||||
StaticJsonBuffer<JSON_MSG_CALC_BUFFER> jsonBuffer;
|
||||
JsonObject& RFdata = jsonBuffer.createObject();
|
||||
RFdata.set("sensor", id);
|
||||
RFdata.set("temperature", temperature);
|
||||
RFdata.set("temperature", temperature); // remove for 0.9.6 release
|
||||
RFdata.set("tempc", temperature);
|
||||
RFdata.set("tempf", wsdr.convertCtoF(temperature));
|
||||
RFdata.set("humidity", humidity);
|
||||
RFdata.set("battery", bitRead(battery_status, 0) == 0 ? "OK" : "Low");
|
||||
pub(subjectRFtoMQTT, RFdata);
|
||||
|
||||
Reference in new issue
Block a user