From d7c734e880ba744738b82c63d6c5a16d65d8ce75 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Thu, 20 May 2021 20:29:59 +0200 Subject: [PATCH 1/3] Added Badge for BatteryLow warning 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..8e2e244ab2 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: 'oh:lowbattery', 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_LowBattery', true) + if (direct.length) return direct + return findPoints(allEquipmentPoints(this.element.equipment), 'Point_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 @@
- + From 51cd13a2bcc14576ee148bb835372bfb05a2746e Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Fri, 21 May 2021 09:26:30 +0200 Subject: [PATCH 2/3] Incorporated comments from review Signed-off-by: Christoph Weitkamp --- .../web/src/components/cards/glance/location/status-badge.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 8e2e244ab2..79d2ae4c38 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,7 +42,7 @@ export default { return { badgeConfigs: { alarms: { icon: 'f7:exclamationmark_triangle_fill' }, - battery: { icon: 'oh:lowbattery', state: 'on' }, + battery: { icon: 'f7:battery_25', state: 'on' }, lights: { icon: 'oh:lightbulb' }, windows: { icon: 'oh:window', state: 'open' }, doors: { icon: 'oh:door', state: 'open' }, @@ -72,7 +72,7 @@ export default { let direct, equipment, allPoints, points switch (this.type) { case 'battery': - direct = findPoints(this.element.properties, 'Point_LowBattery', true) + direct = findPoints(this.element.properties, 'Point_Status_LowBattery', true) if (direct.length) return direct return findPoints(allEquipmentPoints(this.element.equipment), 'Point_LowBattery', true) case 'lights': From 92fe32bc5817c3a7e60291452e44b6e88f455258 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Fri, 21 May 2021 15:29:14 +0200 Subject: [PATCH 3/3] Incorporated review comments Signed-off-by: Christoph Weitkamp --- .../web/src/components/cards/glance/location/status-badge.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 79d2ae4c38..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 @@ -74,7 +74,7 @@ export default { case 'battery': direct = findPoints(this.element.properties, 'Point_Status_LowBattery', true) if (direct.length) return direct - return findPoints(allEquipmentPoints(this.element.equipment), 'Point_LowBattery', true) + 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