Skip to content

Commit

Permalink
fix: set temperature_unit in climate discovery #731 (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando authored Sep 17, 2020
1 parent 2e174e4 commit d6710fd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,10 @@ Gateway.prototype.discoverDevice = function (node, hassDevice) {
payload.current_temperature_topic = this.mqtt.getTopic(
this.valueTopic(node, currTemp)
)

if (currTemp.units) {
payload.temperature_unit = currTemp.units.contains('C') ? 'C' : 'F'
}
// hass will default the precision to 0.1 for Celsius and 1.0 for Fahrenheit.
// 1.0 is not granular enough as a default and there seems to be no harm in making it more precise.
if (!payload.precision) payload.precision = 0.1
Expand Down

0 comments on commit d6710fd

Please sign in to comment.