service autocomplete

This commit is contained in:
ari committed 2022-06-06 22:37:34 -04:00
1 parent 78494ee74d
commit 4c3b34195a
14 files changed
+437 -274

No files matched your search

+3
View File
@@ -5,6 +5,9 @@ const dummyNamer: Namer = {
getDeviceName(device_id) {
return device_id
},
getServiceName(service) {
return service
},
getEntityName(entity_id, maxEntities = 1) {
if (Array.isArray(entity_id)) {
return entity_id.slice(0, maxEntities).join(' and ')
+2 -1
View File
@@ -5,6 +5,7 @@ import { AutomationTime } from "types/automations/common";
export interface Namer {
getEntityName(entity_id: string | string[], maxEntities?: number): string;
getDeviceName(device_id: string): string;
getServiceName(service: string): string;
}
export const convertTimeToString = (t: AutomationTime) => {
@@ -101,7 +102,7 @@ export const getDescriptionFromAutomationNode = <N extends AutomationNodeTypes>(
}
}
if ('service' in node) {
return node.service
return namer.getServiceName(node.service)
}
if ('repeat' in node) {
return 'Repeat ' + node.repeat.count