Added fix for weather entity error

This commit is contained in:
Aalian Khan
2023-04-04 02:07:31 -04:00
committed by GitHub
parent 51e0c7ea25
commit 841180e5ef

View File

@@ -347,15 +347,31 @@ class MushroomStrategy {
const chips = [] const chips = []
// weather // weather
chips.push if (strategyOptions.chips != null && strategyOptions.chips.weather_entity != null)
( {
{ chips.push
type: "weather", (
entity: "weather.forecast_home", {
show_temperature: true, type: "weather",
show_conditions: true entity: strategyOptions.chips.weather_entity,
}, show_temperature: true,
) show_conditions: true
}
)
} else
{
const weatherEntity = entities.find(entity => entity.entity_id.startsWith("weather.") && entity.disabled_by == null)
chips.push
(
{
type: "weather",
entity: weatherEntity.entity_id,
show_temperature: true,
show_conditions: true
}
)
}
// Light count // Light count
const lightCountTemplate = "{% set lights = [" + createListOfFilteredStates(entities, devices, definedAreas, "light.") + "] %} {{ lights | selectattr('state','eq','on') | list | count }}"; const lightCountTemplate = "{% set lights = [" + createListOfFilteredStates(entities, devices, definedAreas, "light.") + "] %} {{ lights | selectattr('state','eq','on') | list | count }}";
@@ -489,10 +505,10 @@ class MushroomStrategy {
} }
// Extra cards // Extra cards
if (strategyOptions.extra_chips != null) { if (strategyOptions.chips != null && strategyOptions.chips.extra_chips != null) {
chips.push chips.push
( (
...strategyOptions.extra_chips ...strategyOptions.chips.extra_chips
) )
} }