From c71db73a6163026f383d352ace8362bc41ccd426 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Fri, 21 May 2021 15:52:27 +0200 Subject: [PATCH] [Main UI] Added Badge for BatteryLow warning (#1063) Signed-off-by: Christoph Weitkamp --- .../web/src/assets/definitions/widgets/home/index.js | 1 + .../src/components/cards/glance/location/status-badge.vue | 5 +++++ .../web/src/components/cards/location-card.vue | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/assets/definitions/widgets/home/index.js b/bundles/org.openhab.ui/web/src/assets/definitions/widgets/home/index.js index 85133d2ac1..da488c243a 100644 --- a/bundles/org.openhab.ui/web/src/assets/definitions/widgets/home/index.js +++ b/bundles/org.openhab.ui/web/src/assets/definitions/widgets/home/index.js @@ -53,6 +53,7 @@ export const OhLocationCardParameters = () => new WidgetDefinition('oh-location- pb('disableBadges', 'Disable badges', 'Do not examine items to display badges - can help with performance if you don\'t need them.'), pt('badges', 'Enabled badges', 'Select the badges you wish to show in the header of the card. Display all if none are selected.') .o([ + { value: 'battery', label: 'Low Battery Warning' }, { value: 'lights', label: 'Lights On' }, { value: 'windows', label: 'Open Windows' }, { value: 'doors', label: 'Open Doors' }, diff --git a/bundles/org.openhab.ui/web/src/components/cards/glance/location/status-badge.vue b/bundles/org.openhab.ui/web/src/components/cards/glance/location/status-badge.vue index 8d97b25a2a..47ffbec1a0 100644 --- a/bundles/org.openhab.ui/web/src/components/cards/glance/location/status-badge.vue +++ b/bundles/org.openhab.ui/web/src/components/cards/glance/location/status-badge.vue @@ -42,6 +42,7 @@ export default { return { badgeConfigs: { alarms: { icon: 'f7:exclamationmark_triangle_fill' }, + battery: { icon: 'f7:battery_25', state: 'on' }, lights: { icon: 'oh:lightbulb' }, windows: { icon: 'oh:window', state: 'open' }, doors: { icon: 'oh:door', state: 'open' }, @@ -70,6 +71,10 @@ export default { query () { let direct, equipment, allPoints, points switch (this.type) { + case 'battery': + direct = findPoints(this.element.properties, 'Point_Status_LowBattery', true) + if (direct.length) return direct + return findPoints(allEquipmentPoints(this.element.equipment), 'Point_Status_LowBattery', true) case 'lights': direct = findPoints(this.element.properties, 'Point_Control', true, 'Property_Light') if (direct.length) return direct diff --git a/bundles/org.openhab.ui/web/src/components/cards/location-card.vue b/bundles/org.openhab.ui/web/src/components/cards/location-card.vue index 563b3552fe..c1955e7bc4 100644 --- a/bundles/org.openhab.ui/web/src/components/cards/location-card.vue +++ b/bundles/org.openhab.ui/web/src/components/cards/location-card.vue @@ -8,7 +8,7 @@
- +