From 07f405ecdaa2f6b11547a1654718762c3e635592 Mon Sep 17 00:00:00 2001 From: Ivan Dyedov Date: Mon, 27 Apr 2020 00:17:16 -0700 Subject: [PATCH] fix: map temperature units to hass values (#394) --- lib/Gateway.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Gateway.js b/lib/Gateway.js index 95efdae7695..76d12dde3b2 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -990,7 +990,11 @@ Gateway.prototype.discoverValue = function (node, valueId) { Object.assign(cfg.discovery_payload, sensor.props || {}) if (valueId.units) { - cfg.discovery_payload.unit_of_measurement = valueId.units + let hassUnitOfMeasurementMap = { + 'C': '°C', + 'F': '°F' + } + cfg.discovery_payload.unit_of_measurement = hassUnitOfMeasurementMap[valueId.units] || valueId.units } // check if there is a custom value configuration for this valueID