+ added bubble editor

+ initial numeric editor
+ entity id input
This commit is contained in:
Ari Sosnovsky committed 2021-11-16 13:25:53 -05:00
1 parent 6be9f1ba12
commit 60ec7c3f29
7 files changed
+237 -8

No files matched your search

+11 -1
View File
@@ -48,7 +48,7 @@ export const getDescriptionFromAutomationNode = <N extends AutomationNodeTypes>(
switch(node.condition) {
case "numeric_state":
if(node.condition_data.entity_id) {
const center = typeof node.condition_data.entity_id === 'string' ? node.condition_data.entity_id : '...'
const center = prettyEntityId(node.condition_data.entity_id);
if(node.condition_data.above) {
if(node.condition_data.below) {
return `${node.condition_data.above} < ${center} < ${node.condition_data.below}`
@@ -77,6 +77,16 @@ export const getDescriptionFromAutomationNode = <N extends AutomationNodeTypes>(
return 'n/a'
}
export const prettyEntityId = (entityId: string| string[]) => {
if (typeof entityId === 'string') {
return entityId
} else if(entityId.length === 1) {
return entityId[0]
} else {
return "..."
}
}
// export const determineNodeTypes = (action: AutomationNode<any>) : [AutomationNodeType, NodeSubType] => {
// if ('condition' in action) {
// switch (action.condition) {