Skip to content

Commit

Permalink
feat: Precision support and default set to 0.1 on hass discovery clim…
Browse files Browse the repository at this point in the history
…ate devices (#326)
  • Loading branch information
chilicheech authored Mar 25, 2020
1 parent 0ede845 commit 0d44d23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,12 @@ Gateway.prototype.discoverDevice = function (node, hassDevice) {
}

let currTemp = node.values[payload.current_temperature_topic]
if (currTemp !== undefined) payload.current_temperature_topic = this.mqtt.getTopic(this.valueTopic(node, currTemp))
if (currTemp !== undefined) {
payload.current_temperature_topic = this.mqtt.getTopic(this.valueTopic(node, currTemp))
// 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
}
} else {
payload = hassDevice.discovery_payload

Expand Down

0 comments on commit 0d44d23

Please sign in to comment.