Merge pull request #4 from AalianKhan/AalianKhan-patch-3

Fix bugs
This commit is contained in:
Aalian Khan
2023-03-31 15:41:43 -04:00
committed by GitHub

View File

@@ -418,7 +418,7 @@ class MushroomStrategy {
} }
// Cover count // Cover count
const coverCountTemplate = "{% set covers = [" + createListOfFilteredStates(entities, devices, definedAreas, "cover.") + "]%} {{ covers | selectattr('state','ne','closed') | list | count }}" const coverCountTemplate = "{% set covers = [" + createListOfFilteredStates(entities, devices, definedAreas, "cover.") + "]%} {{ covers | selectattr('state','eq','open') | list | count }}"
if (strategyOptions.chips == null || (strategyOptions.chips != null && strategyOptions.chips.cover_count != false)) if (strategyOptions.chips == null || (strategyOptions.chips != null && strategyOptions.chips.cover_count != false))
{ {
chips.push chips.push
@@ -1105,6 +1105,7 @@ class MushroomStrategy {
subtitle: "Sensors" subtitle: "Sensors"
}, },
); );
sensorsLoop:
for (const sensor of sensors) for (const sensor of sensors)
{ {
// Find the state obj that matches with current sensor // Find the state obj that matches with current sensor
@@ -1154,34 +1155,36 @@ class MushroomStrategy {
{ {
...config ...config
}, },
);
} if (sensorStateObj.attributes.unit_of_measurement != null)
{
sensorCards.push
(
{
type: "custom:mini-graph-card",
entities:
[
sensor.entity_id
],
animate: true,
line_color: "green"
},
);
} else
{
sensorCards.push
(
{
type: "custom:mushroom-entity-card",
entity: sensor.entity_id,
icon_color: "green"
},
); );
continue sensorsLoop;
} }
} }
if (sensorStateObj.attributes.unit_of_measurement != null)
{
sensorCards.push
(
{
type: "custom:mini-graph-card",
entities:
[
sensor.entity_id
],
animate: true,
line_color: "green"
},
);
} else
{
sensorCards.push
(
{
type: "custom:mushroom-entity-card",
entity: sensor.entity_id,
icon_color: "green"
},
);
}
} }
} }
cards.push cards.push