forked from DigiLive/mushroom-strategy
Added fix for weather entity error
This commit is contained in:
38
dist/mushroom-strategy.js
vendored
38
dist/mushroom-strategy.js
vendored
@@ -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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user