removed $smType for conditions and trigger
This commit is contained in:
1 parent
49fea3fabd
commit
429dfd5b50
41 files changed
+410
-723
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import { AutomationNode, AutomationNodeSubtype, AutomationNodeTypes } from "types/automations";
|
||||
|
||||
|
||||
export const getNodeType = (node: AutomationNode): AutomationNodeTypes => {
|
||||
if ('condition' in node) {
|
||||
return 'condition'
|
||||
} else if ('platform' in node) {
|
||||
return 'trigger'
|
||||
} else {
|
||||
return 'action'
|
||||
}
|
||||
}
|
||||
|
||||
export const getSubTypeList = <T extends AutomationNodeTypes>(nodeType: T): AutomationNodeSubtype<T>[] => {
|
||||
switch (nodeType) {
|
||||
case 'action':
|
||||
return [
|
||||
"service",
|
||||
"repeat",
|
||||
"wait",
|
||||
"device",
|
||||
"choose",
|
||||
] as any
|
||||
case "condition":
|
||||
return [
|
||||
'or',
|
||||
'and',
|
||||
'not',
|
||||
'numeric_state',
|
||||
'state',
|
||||
'template',
|
||||
'time',
|
||||
'trigger',
|
||||
'zone',
|
||||
] as any
|
||||
case 'trigger':
|
||||
return [
|
||||
'event',
|
||||
'homeassistant',
|
||||
'mqtt',
|
||||
'numeric_state',
|
||||
'state',
|
||||
'tag',
|
||||
'template',
|
||||
'time',
|
||||
'time_pattern',
|
||||
'webhook',
|
||||
'zone',
|
||||
'device',
|
||||
] as any
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user