Refactor to look at card_options instead

This commit is contained in:
Aalian Khan
2023-09-14 15:58:59 -04:00
parent 01c6205c02
commit 7ab85afb85
3 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -118,7 +118,7 @@ class MushroomStrategy {
// Find the state of the current sensor.
const sensorState = sensorStates.find(state => state.entity_id === 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 (sensorState?.attributes.unit_of_measurement) {
@@ -150,7 +150,7 @@ class MushroomStrategy {
// Create a card for each domain-entity of the current area.
for (const entity of entities) {
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) {
domainCards.push(new cardModule[className](entity, cardOptions).getCard());
@@ -221,7 +221,7 @@ class MushroomStrategy {
for (const entity of miscellaneousEntities) {
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) {
miscellaneousCards.push(new cardModule.MiscellaneousCard(entity, cardOptions).getCard());

View File

@@ -77,7 +77,7 @@ class AbstractView {
// Create a card for each domain-entity of the current area.
for (const entity of entities) {
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) {
continue;