From d2aec16811d14adc0d1728788b10ae2b74b3c9e5 Mon Sep 17 00:00:00 2001 From: Philip Abbey Date: Sat, 24 Aug 2024 14:21:02 +0100 Subject: [PATCH] Update BackgroundServiceDelegate.mc Failed to make commensurate changes to the background service code. --- source/BackgroundServiceDelegate.mc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/BackgroundServiceDelegate.mc b/source/BackgroundServiceDelegate.mc index 0f54139..a5d5a51 100644 --- a/source/BackgroundServiceDelegate.mc +++ b/source/BackgroundServiceDelegate.mc @@ -150,20 +150,26 @@ class BackgroundServiceDelegate extends System.ServiceDelegate { "type" => "sensor", "unique_id" => "heart_rate", "icon" => "mdi:heart-pulse" - }, - { + } + ]; + + if (ActivityMonitor.Info has :floorsClimbed) { + data.add({ "state" => activityInfo.floorsClimbed == null ? "unknown" : activityInfo.floorsClimbed, "type" => "sensor", "unique_id" => "floors_climbed_today", "icon" => "mdi:stairs-up" - }, - { + }); + } + + if (ActivityMonitor.Info has :floorsDescended) { + data.add({ "state" => activityInfo.floorsDescended == null ? "unknown" : activityInfo.floorsDescended, "type" => "sensor", "unique_id" => "floors_descended_today", "icon" => "mdi:stairs-down" - } - ]; + }); + } if (ActivityMonitor.Info has :respirationRate) { data.add({