From 23f0f63579a882bcd8b49064e86033f124c7a199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Sat, 5 Feb 2022 21:00:13 +0100 Subject: [PATCH 1/2] Support (input_)button entities in quick settings tiles --- .../io/homeassistant/companion/android/qs/TileExtensions.kt | 6 +++++- .../companion/android/settings/qs/ManageTilesFragment.kt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/homeassistant/companion/android/qs/TileExtensions.kt b/app/src/main/java/io/homeassistant/companion/android/qs/TileExtensions.kt index 32820ae932f..047d3660001 100755 --- a/app/src/main/java/io/homeassistant/companion/android/qs/TileExtensions.kt +++ b/app/src/main/java/io/homeassistant/companion/android/qs/TileExtensions.kt @@ -121,7 +121,11 @@ abstract class TileExtensions : TileService() { try { integrationUseCase.callService( tileData?.entityId?.split(".")!![0], - if (tileData.entityId.split(".")[0] in toggleDomains) "toggle" else "turn_on", + when (tileData.entityId.split(".")[0]) { + "button", "input_button" -> "press" + in toggleDomains -> "toggle" + else -> "turn_on" + }, hashMapOf("entity_id" to tileData.entityId) ) Log.d(TAG, "Service call sent for tile ID: $tileId") diff --git a/app/src/main/java/io/homeassistant/companion/android/settings/qs/ManageTilesFragment.kt b/app/src/main/java/io/homeassistant/companion/android/settings/qs/ManageTilesFragment.kt index b27ec9dcdd9..1b3e80e8b16 100755 --- a/app/src/main/java/io/homeassistant/companion/android/settings/qs/ManageTilesFragment.kt +++ b/app/src/main/java/io/homeassistant/companion/android/settings/qs/ManageTilesFragment.kt @@ -32,7 +32,7 @@ class ManageTilesFragment constructor( companion object { private const val TAG = "TileFragment" val validDomains = listOf( - "cover", "fan", "humidifier", "input_boolean", "light", + "button", "cover", "fan", "humidifier", "input_boolean", "input_button", "light", "media_player", "remote", "siren", "scene", "script", "switch" ) } From 7bf37e96d47bed754dfa633d52e50c6d65b802b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Sat, 5 Feb 2022 21:13:41 +0100 Subject: [PATCH 2/2] Changelog --- app/src/main/res/xml/changelog_master.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index b4725f8bd28..9397e33e9d6 100755 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -17,6 +17,7 @@ Improve reliability of opening entity information from device controls Editing Wear OS Template Tile from phone settings Add support for button and input_button domains in device controls + Add support for button and input_button domains in quick settings tiles Add In Use sensor for Quest devices Minimal version fixes to remove Google dependencies Lots of miscellaneous bug fixes