Skip to content

Commit

Permalink
fix: map temperature units to hass values (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
idyedov authored Apr 27, 2020
1 parent 42021e9 commit 07f405e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 07f405e

Please sign in to comment.