fixed unique id
This commit is contained in:
parent
9ddc22ba79
commit
e17a45cdea
@ -154,6 +154,9 @@ class MQTT {
|
||||
mapBaseConfigPayload(diag, diagEl, device_class, name, attr) {
|
||||
name = name || MQTT.convertFriendlyName(diagEl.name);
|
||||
name = this.addNamePrefix(name);
|
||||
// Generate the unique id from the vin and name
|
||||
let unique_id = `${this.vehicle.vin}-${diagEl.name}`
|
||||
unique_id = unique_id.replace(/\s+/g, '-').toLowerCase();
|
||||
return {
|
||||
device_class,
|
||||
name,
|
||||
@ -170,7 +173,7 @@ class MQTT {
|
||||
value_template: `{{ value_json.${MQTT.convertName(diagEl.name)} }}`,
|
||||
json_attributes_topic: _.isUndefined(attr) ? undefined : this.getStateTopic(diag),
|
||||
json_attributes_template: attr,
|
||||
unique_id: `${this.vehicle.vin}-${device_class}-${name}`
|
||||
unique_id: unique_id
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user