Remove precision rounding from HA MQTT autodiscovery template (#3636)

* Remove precision rounding from HA MQTT autodiscovery template

Precision rounding should be handled in converters and made available to
all MQTT consumers (not just HA)

* Update homeassistant.test.js

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
Crowbar Z
2020-05-29 23:13:09 +02:00
committed by GitHub
co-authored by Koen Kanters
parent 7d1a97841c
commit 51a6b9226d
2 changed files with 3 additions and 12 deletions
-9
View File
@@ -1908,15 +1908,6 @@ class HomeAssistant extends Extension {
payload.availability_topic = `${settings.get().mqtt.base_topic}/bridge/state`;
}
// Add precision to value_template
if (deviceSettings.hasOwnProperty(`${config.object_id}_precision`)) {
const precision = deviceSettings[`${config.object_id}_precision`];
let template = payload.value_template;
template = template.replace('{{ ', '').replace(' }}', '');
template = `{{ (${template} | float) | round(${precision}) }}`;
payload.value_template = template;
}
if (payload.command_topic) {
payload.command_topic = `${settings.get().mqtt.base_topic}/${friendlyName}/`;