From bdaf151e53ae8fb40633e3f0c516c98f24984385 Mon Sep 17 00:00:00 2001 From: mikosoft83 <63317931+mikosoft83@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:50:15 +0200 Subject: [PATCH 1/4] Update DNDSensorManager.kt Add dynamic icons to DND sensor --- .../companion/android/common/sensors/DNDSensorManager.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt index 7ccb29955c1..3260ed703f9 100755 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt @@ -72,12 +72,19 @@ class DNDSensorManager : SensorManager { NotificationManager.INTERRUPTION_FILTER_UNKNOWN -> STATE_UNKNOWN else -> STATE_UNKNOWN } + val icon = when (state) { + "off" -> "mdi:bell-ring" + "alarms_only" -> "mdi:alarm" + "priority_only" -> "mdi:star-outline" + "total_silence" -> "mdi:bell-sleep" + else -> "mdi:minus-circle" + } onSensorUpdated( context, dndSensor, state, - dndSensor.statelessIcon, + icon, mapOf( "options" to listOf("alarms_only", "off", "priority_only", "total_silence") ) From bab4a34dc495e0bff2a333e3bb6fee11389ca80a Mon Sep 17 00:00:00 2001 From: mikosoft83 <63317931+mikosoft83@users.noreply.github.com> Date: Tue, 16 Jul 2024 09:22:41 +0200 Subject: [PATCH 2/4] Update to binary sensor like icon behavior --- .../companion/android/common/sensors/DNDSensorManager.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt index 3260ed703f9..f3bac9fc7ce 100755 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt @@ -73,10 +73,7 @@ class DNDSensorManager : SensorManager { else -> STATE_UNKNOWN } val icon = when (state) { - "off" -> "mdi:bell-ring" - "alarms_only" -> "mdi:alarm" - "priority_only" -> "mdi:star-outline" - "total_silence" -> "mdi:bell-sleep" + "off" -> "mdi:minus-circle-off" else -> "mdi:minus-circle" } From d217f4f7b7bfa3400adcd7e7519df84bb3fdbea4 Mon Sep 17 00:00:00 2001 From: mikosoft83 <63317931+mikosoft83@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:48:10 +0200 Subject: [PATCH 3/4] Update common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt Co-authored-by: Daniel Shokouhi --- .../companion/android/common/sensors/DNDSensorManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt index f3bac9fc7ce..1604bd9aea3 100755 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt @@ -81,7 +81,7 @@ class DNDSensorManager : SensorManager { context, dndSensor, state, - icon, + if (state != "off") dndSensor.statelessIcon else "mdi:minus-circle-off", mapOf( "options" to listOf("alarms_only", "off", "priority_only", "total_silence") ) From fee1419332c4a12353264b2fc7cf462878c095f7 Mon Sep 17 00:00:00 2001 From: mikosoft83 <63317931+mikosoft83@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:48:58 +0200 Subject: [PATCH 4/4] Remove icon variable --- .../companion/android/common/sensors/DNDSensorManager.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt index 1604bd9aea3..c19fe59f182 100755 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/DNDSensorManager.kt @@ -72,10 +72,6 @@ class DNDSensorManager : SensorManager { NotificationManager.INTERRUPTION_FILTER_UNKNOWN -> STATE_UNKNOWN else -> STATE_UNKNOWN } - val icon = when (state) { - "off" -> "mdi:minus-circle-off" - else -> "mdi:minus-circle" - } onSensorUpdated( context,