forked from DigiLive/mushroom-strategy
Refactor to look at card_options instead
This commit is contained in:
2
dist/mushroom-strategy.js
vendored
2
dist/mushroom-strategy.js
vendored
File diff suppressed because one or more lines are too long
@@ -118,7 +118,7 @@ class MushroomStrategy {
|
|||||||
// Find the state of the current sensor.
|
// Find the state of the current sensor.
|
||||||
const sensorState = sensorStates.find(state => state.entity_id === sensor.entity_id);
|
const sensorState = sensorStates.find(state => state.entity_id === sensor.entity_id);
|
||||||
let cardOptions = Helper.strategyOptions.card_options?.[sensor.entity_id] ?? {};
|
let cardOptions = Helper.strategyOptions.card_options?.[sensor.entity_id] ?? {};
|
||||||
let deviceOptions = Helper.strategyOptions.devices?.[sensor.device_id] ?? {};
|
let deviceOptions = Helper.strategyOptions.card_options?.[sensor.device_id] ?? {};
|
||||||
|
|
||||||
if (!cardOptions.hidden && !deviceOptions.hidden) {
|
if (!cardOptions.hidden && !deviceOptions.hidden) {
|
||||||
if (sensorState?.attributes.unit_of_measurement) {
|
if (sensorState?.attributes.unit_of_measurement) {
|
||||||
@@ -150,7 +150,7 @@ class MushroomStrategy {
|
|||||||
// Create a card for each domain-entity of the current area.
|
// Create a card for each domain-entity of the current area.
|
||||||
for (const entity of entities) {
|
for (const entity of entities) {
|
||||||
let cardOptions = Helper.strategyOptions.card_options?.[entity.entity_id] ?? {};
|
let cardOptions = Helper.strategyOptions.card_options?.[entity.entity_id] ?? {};
|
||||||
let deviceOptions = Helper.strategyOptions.devices?.[entity.device_id] ?? {};
|
let deviceOptions = Helper.strategyOptions.card_options?.[entity.device_id] ?? {};
|
||||||
|
|
||||||
if (!cardOptions.hidden && !deviceOptions.hidden) {
|
if (!cardOptions.hidden && !deviceOptions.hidden) {
|
||||||
domainCards.push(new cardModule[className](entity, cardOptions).getCard());
|
domainCards.push(new cardModule[className](entity, cardOptions).getCard());
|
||||||
@@ -221,7 +221,7 @@ class MushroomStrategy {
|
|||||||
|
|
||||||
for (const entity of miscellaneousEntities) {
|
for (const entity of miscellaneousEntities) {
|
||||||
let cardOptions = Helper.strategyOptions.card_options?.[entity.entity_id] ?? {};
|
let cardOptions = Helper.strategyOptions.card_options?.[entity.entity_id] ?? {};
|
||||||
let deviceOptions = Helper.strategyOptions.devices?.[entity.device_id] ?? {};
|
let deviceOptions = Helper.strategyOptions.card_options?.[entity.device_id] ?? {};
|
||||||
|
|
||||||
if (!cardOptions.hidden && !deviceOptions.hidden) {
|
if (!cardOptions.hidden && !deviceOptions.hidden) {
|
||||||
miscellaneousCards.push(new cardModule.MiscellaneousCard(entity, cardOptions).getCard());
|
miscellaneousCards.push(new cardModule.MiscellaneousCard(entity, cardOptions).getCard());
|
||||||
|
@@ -77,7 +77,7 @@ class AbstractView {
|
|||||||
// Create a card for each domain-entity of the current area.
|
// Create a card for each domain-entity of the current area.
|
||||||
for (const entity of entities) {
|
for (const entity of entities) {
|
||||||
let cardOptions = Helper.strategyOptions.card_options?.[entity.entity_id] ?? {};
|
let cardOptions = Helper.strategyOptions.card_options?.[entity.entity_id] ?? {};
|
||||||
let deviceOptions = Helper.strategyOptions.devices?.[entity.device_id] ?? {};
|
let deviceOptions = Helper.strategyOptions.card_options?.[entity.device_id] ?? {};
|
||||||
|
|
||||||
if (cardOptions.hidden || deviceOptions.hidden) {
|
if (cardOptions.hidden || deviceOptions.hidden) {
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user