From 37f8ee41c053f5fac2f85ac77af3e49a519cacdd Mon Sep 17 00:00:00 2001 From: Daniel Shokouhi Date: Sun, 27 Aug 2023 09:19:33 -0700 Subject: [PATCH 1/3] Fix last update sensor intent not retrieving value --- .../companion/android/common/sensors/SensorReceiverBase.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt index 7aac4f4369e..3f8674372ff 100644 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt @@ -115,9 +115,7 @@ abstract class SensorReceiverBase : BroadcastReceiver() { for (setting in allSettings) { if (setting.value != "" && intent.action == setting.value) { val eventData = intent.extras?.keySet() - ?.associate { - it.toString() to (intent.extras?.getString(it) ?: "") - } + ?.associate { it.toString() to intent.extras?.get(it).toString() } ?.plus("intent" to intent.action.toString()) ?: mapOf("intent" to intent.action.toString()) Log.d(tag, "Event data: $eventData") From 09200cc8af6c11b51a0adc02792915771679146c Mon Sep 17 00:00:00 2001 From: Daniel Shokouhi Date: Sun, 27 Aug 2023 09:45:26 -0700 Subject: [PATCH 2/3] Suppress deprecation --- .../companion/android/common/sensors/SensorReceiverBase.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt index 3f8674372ff..9438b01b736 100644 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt @@ -38,6 +38,7 @@ import java.net.SocketTimeoutException import java.util.Locale import javax.inject.Inject +@Suppress("DEPRECATION") abstract class SensorReceiverBase : BroadcastReceiver() { companion object { const val ACTION_UPDATE_SENSOR = "io.homeassistant.companion.android.UPDATE_SENSOR" From c8bf728ea401d9b9c477cd64bcf0fcee4e813380 Mon Sep 17 00:00:00 2001 From: Daniel Shokouhi Date: Sun, 27 Aug 2023 09:47:40 -0700 Subject: [PATCH 3/3] Move suppression --- .../companion/android/common/sensors/SensorReceiverBase.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt b/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt index 9438b01b736..aa0a730bed0 100644 --- a/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/sensors/SensorReceiverBase.kt @@ -38,7 +38,6 @@ import java.net.SocketTimeoutException import java.util.Locale import javax.inject.Inject -@Suppress("DEPRECATION") abstract class SensorReceiverBase : BroadcastReceiver() { companion object { const val ACTION_UPDATE_SENSOR = "io.homeassistant.companion.android.UPDATE_SENSOR" @@ -110,6 +109,7 @@ abstract class SensorReceiverBase : BroadcastReceiver() { return } + @Suppress("DEPRECATION") if (isSensorEnabled(LastUpdateManager.lastUpdate.id)) { LastUpdateManager().sendLastUpdate(context, intent.action) val allSettings = sensorDao.getSettings(LastUpdateManager.lastUpdate.id)