Skip to content

Commit

Permalink
fix: disable live camera feed on security view
Browse files Browse the repository at this point in the history
  • Loading branch information
Lebe1ge committed Jan 8, 2025
1 parent 321dfd9 commit f5bb462
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 46 deletions.
29 changes: 8 additions & 21 deletions custom_components/linus_dashboard/www/linus-strategy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ class Helper {

if (!this.#domains[domain]) this.#domains[domain] = [];

if (Helper.linus_dashboard_config?.excluded_domains?.includes(domain)) return acc;
if (Helper.linus_dashboard_config?.excluded_domains?.includes(domain)) return acc;

const area = entity.area_id ? areasById[entity.area_id] : {} as StrategyArea;
Expand Down
12 changes: 6 additions & 6 deletions src/cards/CameraCard.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {AbstractCard} from "./AbstractCard";
import {cards} from "../types/strategy/cards";
import {EntityRegistryEntry} from "../types/homeassistant/data/entity_registry";
import {PictureEntityCardConfig} from "../types/homeassistant/panels/lovelave/cards/types";
import { AbstractCard } from "./AbstractCard";
import { cards } from "../types/strategy/cards";
import { EntityRegistryEntry } from "../types/homeassistant/data/entity_registry";
import { PictureEntityCardConfig } from "../types/homeassistant/panels/lovelave/cards/types";

// noinspection JSUnusedGlobalSymbols Class is dynamically imported.
/**
Expand All @@ -24,7 +24,7 @@ class CameraCard extends AbstractCard {
type: "picture-entity",
show_name: false,
show_state: false,
camera_view: "live",
// camera_view: "live",
};

/**
Expand All @@ -41,4 +41,4 @@ class CameraCard extends AbstractCard {
}
}

export {CameraCard};
export { CameraCard };
23 changes: 6 additions & 17 deletions src/views/SecurityView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ class SecurityView {
})

for (const person of persons) {
globalSection.cards.push(new PersonCard(person, {
layout: "horizontal",
primary_info: "name",
secondary_info: "state"
}).getCard())
globalSection.cards.push(new PersonCard(person).getCard());
}
}

Expand All @@ -169,7 +165,7 @@ class SecurityView {
}

const sections = [globalSection]
// if (Helper.domains.camera?.length) sections.push(await this.createCamerasSection())
if (Helper.domains.camera?.length) sections.push(await this.createCamerasSection())

return sections;
}
Expand Down Expand Up @@ -198,16 +194,9 @@ class SecurityView {
}]
};

const orderedFloors = Object.values(Helper.floors).sort((a, b) => {
// Check if 'level' is undefined in either object
if (a.level === undefined) return 1; // a should come after b
if (b.level === undefined) return -1; // b should come after a
const floors = Helper.orderedFloors;

// Both 'level' values are defined, compare them
return a.level - b.level;
});

for (const floor of orderedFloors) {
for (const floor of floors) {

if (floor.areas_slug.length === 0) continue

Expand All @@ -226,7 +215,7 @@ class SecurityView {
]

// Create cards for each area.
for (const [i, area] of floor.areas_slug.map(area_slug => Helper.areas[area_slug]).entries()) {
for (const area of floor.areas_slug.map(area_slug => Helper.areas[area_slug])) {
const entities = Helper.getAreaEntities(area, domain);
const className = Helper.sanitizeClassName(domain + "Card");

Expand Down Expand Up @@ -279,7 +268,7 @@ class SecurityView {
}

// Create and insert a Controller card.
areaCards.unshift(...new ControllerCard(target, titleCardOptions, domain).createCard())
areaCards.unshift(...new ControllerCard(titleCardOptions, domain).createCard())

floorCards.push(...areaCards);
}
Expand Down

0 comments on commit f5bb462

Please sign in to comment.