mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
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:
co-authored by
Koen Kanters
parent
7d1a97841c
commit
51a6b9226d
@@ -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}/`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user