Add trigger/condition/action dialog - Show device group always on top (#27812)

add automation element dialog Device always on top
This commit is contained in:
Wendelin
2025-11-05 14:27:53 +01:00
committed by Bram Kragten
parent 1ec432a20f
commit 2d36a0d37f

View File

@@ -383,9 +383,16 @@ class DialogAddAutomationElement
generatedCollections.push({ generatedCollections.push({
titleKey: collection.titleKey, titleKey: collection.titleKey,
groups: groups.sort((a, b) => groups: groups.sort((a, b) => {
stringCompare(a.name, b.name, this.hass.locale.language) // make sure device is always on top
), if (a.key === "device" || a.key === "device_id") {
return -1;
}
if (b.key === "device" || b.key === "device_id") {
return 1;
}
return stringCompare(a.name, b.name, this.hass.locale.language);
}),
}); });
}); });
return generatedCollections; return generatedCollections;