mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Filter battery sensors from generated UI (#4799)
* Filter battery sensors from generated UI * Use fancy TypeScript feature
This commit is contained in:
parent
15e7b8117c
commit
8a4c52aeb7
1
src/data/sensor.ts
Normal file
1
src/data/sensor.ts
Normal file
@ -0,0 +1 @@
|
||||
export const SENSOR_DEVICE_CLASS_BATTERY = "battery";
|
@ -41,6 +41,7 @@ import {
|
||||
EntityRegistryEntry,
|
||||
} from "../../../data/entity_registry";
|
||||
import { processEditorEntities } from "../editor/process-editor-entities";
|
||||
import { SENSOR_DEVICE_CLASS_BATTERY } from "../../../data/sensor";
|
||||
|
||||
const DEFAULT_VIEW_ENTITY_ID = "group.default_view";
|
||||
const DOMAINS_BADGES = [
|
||||
@ -181,6 +182,11 @@ export const computeCards = (
|
||||
conf.icon = stateObj.attributes.icon;
|
||||
}
|
||||
entities.push(conf);
|
||||
} else if (
|
||||
domain === "sensor" &&
|
||||
stateObj?.attributes.device_class === SENSOR_DEVICE_CLASS_BATTERY
|
||||
) {
|
||||
// Do nothing.
|
||||
} else {
|
||||
let name: string;
|
||||
const entityConf =
|
||||
|
Loading…
x
Reference in New Issue
Block a user