forked from DigiLive/mushroom-strategy
Fix bug where multiple entries in entity_config creates duplicates
This commit is contained in:
51
dist/mushroom-strategy.js
vendored
51
dist/mushroom-strategy.js
vendored
@@ -110,7 +110,8 @@ const createPlatformCard = (entities, entity_config, defaultCard, titleCard, dou
|
|||||||
if (titleCard != null) {
|
if (titleCard != null) {
|
||||||
platformCards.push(titleCard);
|
platformCards.push(titleCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entitiesLoop:
|
||||||
for (const entity of entities)
|
for (const entity of entities)
|
||||||
{
|
{
|
||||||
// Entity config does not exist then push defualt card, otherwise loop to find matching entity
|
// Entity config does not exist then push defualt card, otherwise loop to find matching entity
|
||||||
@@ -148,35 +149,37 @@ const createPlatformCard = (entities, entity_config, defaultCard, titleCard, dou
|
|||||||
...config
|
...config
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
continue entitiesLoop;
|
||||||
} else
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doubleTapActionConfig != null)
|
||||||
|
{
|
||||||
|
var doubleTapAction =
|
||||||
{
|
{
|
||||||
if (doubleTapActionConfig != null) {
|
double_tap_action:
|
||||||
var doubleTapAction =
|
{
|
||||||
|
target:
|
||||||
{
|
{
|
||||||
double_tap_action:
|
entity_id: entity.entity_id
|
||||||
{
|
},
|
||||||
target:
|
...doubleTapActionConfig
|
||||||
{
|
|
||||||
entity_id: entity.entity_id
|
|
||||||
},
|
|
||||||
...doubleTapActionConfig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
platformCards.push
|
|
||||||
(
|
|
||||||
{
|
|
||||||
entity: entity.entity_id,
|
|
||||||
...defaultCard,
|
|
||||||
...doubleTapAction
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
platformCards.push
|
||||||
|
(
|
||||||
|
{
|
||||||
|
entity: entity.entity_id,
|
||||||
|
...defaultCard,
|
||||||
|
...doubleTapAction
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return platformCards;
|
return platformCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1306,4 +1309,4 @@ class MushroomStrategy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("ll-strategy-mushroom-strategy", MushroomStrategy);
|
customElements.define("ll-strategy-mushroom-strategy", MushroomStrategy);
|
||||||
|
Reference in New Issue
Block a user