diff --git a/app/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt b/app/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt index 7dbe1c519f2..965b321537f 100755 --- a/app/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt +++ b/app/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt @@ -13,7 +13,6 @@ val notificationItem = NotificationItem(1, 1636389288682, "testing", "{\"message val wearDeviceName = "Device Name" val attributes: Map = mapOf( - "friendly_name" to "Testing", "icon" to "mdi:cellphone", ) diff --git a/app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreen.kt b/app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreen.kt index f9f45f6ee58..a46dc0747e5 100644 --- a/app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreen.kt +++ b/app/src/main/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreen.kt @@ -511,7 +511,7 @@ private val previewEntityWidgetConfigureState = EntityWidgetConfigureState( }, entityDisplayState = Loaded(listOf(EntityDisplayWithContext(EntityDisplayWithoutContext(previewEntity1)))), selectedEntityId = previewEntity1.entityId, - availableAttributes = listOf("brightness", "friendly_name"), + availableAttributes = listOf("brightness", "power"), selectedAttributeIds = listOf("brightness"), label = "Office light", textSize = "30", diff --git a/app/src/screenshotTest/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest.kt b/app/src/screenshotTest/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest.kt index 46d91da0655..1c9fc36a08c 100644 --- a/app/src/screenshotTest/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest.kt +++ b/app/src/screenshotTest/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest.kt @@ -85,12 +85,13 @@ private val previewEntityWidgetConfigureState = EntityWidgetConfigureState( EntityDisplayWithContext( EntityDisplayWithoutContext( previewEntity1, + name = "Preview Entity 1", ), ), ), ), selectedEntityId = previewEntity1.entityId, - availableAttributes = listOf("brightness", "friendly_name"), + availableAttributes = listOf("brightness", "power"), selectedAttributeIds = listOf("brightness"), label = "Office light", textSize = "30", diff --git a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_foldable_c908f502_0.png b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_foldable_c908f502_0.png index 12912fc3175..34dd0d9a04a 100644 Binary files a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_foldable_c908f502_0.png and b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_foldable_c908f502_0.png differ diff --git a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_e05166be_0.png b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_e05166be_0.png index da17684376d..f8a57ab7746 100644 Binary files a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_e05166be_0.png and b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_e05166be_0.png differ diff --git a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_landscape_9e00b29d_0.png b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_landscape_9e00b29d_0.png index a4eb6380887..a3fb8339af0 100644 Binary files a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_landscape_9e00b29d_0.png and b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_phone_landscape_9e00b29d_0.png differ diff --git a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_small_phone_66e7bbf2_0.png b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_small_phone_66e7bbf2_0.png index d618129ec25..8800f95eb69 100644 Binary files a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_small_phone_66e7bbf2_0.png and b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_small_phone_66e7bbf2_0.png differ diff --git a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_2f22c4ea_0.png b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_2f22c4ea_0.png index 2f00d559c59..11aa596d9a7 100644 Binary files a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_2f22c4ea_0.png and b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_2f22c4ea_0.png differ diff --git a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_landscape_62cae397_0.png b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_landscape_62cae397_0.png index 0db7ffa6bc0..1d1684ed47c 100644 Binary files a/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_landscape_62cae397_0.png and b/app/src/screenshotTestFullDebug/reference/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenshotTest/EntityWidgetConfigureContent selected entity_tablet_landscape_62cae397_0.png differ diff --git a/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenTest.kt b/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenTest.kt index 731dec2adab..53e0fc7644d 100644 --- a/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenTest.kt +++ b/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureScreenTest.kt @@ -246,8 +246,8 @@ class EntityWidgetConfigureScreenTest { fun `Given an unselected attribute when its chip is clicked then onAttributeAdded is triggered`() { composeTestRule.apply { testScreen(configuredState) { - onNodeWithText("friendly_name").performScrollTo().performClick() - assertEquals("friendly_name", attributeAdded) + onNodeWithText("power").performScrollTo().performClick() + assertEquals("power", attributeAdded) } } } @@ -318,7 +318,7 @@ class EntityWidgetConfigureScreenTest { val ENTITY = Entity( entityId = "light.office", state = "on", - attributes = mapOf("friendly_name" to "Office light"), + attributes = mapOf("power" to "50W"), lastChanged = LocalDateTime.MIN, lastUpdated = LocalDateTime.MIN, ) @@ -331,7 +331,7 @@ class EntityWidgetConfigureScreenTest { val configuredState = newWidgetState.copy( selectedEntityId = ENTITY.entityId, - availableAttributes = listOf("brightness", "friendly_name"), + availableAttributes = listOf("brightness", "power"), selectedAttributeIds = listOf("brightness"), label = "Office light", stateSeparator = " - ", diff --git a/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureViewModelTest.kt b/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureViewModelTest.kt index 63398a2dcda..81f067eb4a9 100644 --- a/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureViewModelTest.kt +++ b/app/src/test/kotlin/io/homeassistant/companion/android/widgets/entity/EntityWidgetConfigureViewModelTest.kt @@ -75,7 +75,7 @@ class EntityWidgetConfigureViewModelTest { assertTrue(state.isUpdateWidget) assertEquals(serverId, state.selectedServerId) assertEquals(entity.entityId, state.selectedEntityId) - assertEquals(listOf("brightness", "friendly_name"), state.selectedAttributeIds) + assertEquals(listOf("brightness", "power"), state.selectedAttributeIds) assertEquals("Office light", state.label) assertEquals("28", state.textSize) assertEquals(" - ", state.stateSeparator) @@ -193,12 +193,12 @@ class EntityWidgetConfigureViewModelTest { fun `Given custom attributes when attributes are added then input is parsed and cleared`() = runTest { val viewModel = createViewModel(entity.entityId) viewModel.onAttributeAdded("brightness") - viewModel.onCustomAttributeChanged("friendly_name, unit_of_measurement, brightness") + viewModel.onCustomAttributeChanged("power, unit_of_measurement, brightness") viewModel.onCustomAttributesAdded() val state = viewModel.state.value - assertEquals(listOf("brightness", "friendly_name", "unit_of_measurement"), state.selectedAttributeIds) + assertEquals(listOf("brightness", "power", "unit_of_measurement"), state.selectedAttributeIds) assertEquals("", state.customAttribute) } @@ -234,7 +234,7 @@ class EntityWidgetConfigureViewModelTest { id = widgetId, serverId = serverId, entityId = entity.entityId, - attributeIds = "brightness,friendly_name", + attributeIds = "brightness,power", label = "Office light", textSize = 28F, stateSeparator = " - ", diff --git a/app/src/test/kotlin/io/homeassistant/companion/android/widgets/todo/TodoUtils.kt b/app/src/test/kotlin/io/homeassistant/companion/android/widgets/todo/TodoUtils.kt deleted file mode 100644 index 66c2941020e..00000000000 --- a/app/src/test/kotlin/io/homeassistant/companion/android/widgets/todo/TodoUtils.kt +++ /dev/null @@ -1,14 +0,0 @@ -package io.homeassistant.companion.android.widgets.todo - -import io.homeassistant.companion.android.common.data.integration.Entity -import java.time.LocalDateTime - -internal fun fakeServerEntity(entityId: String, friendlyName: String? = null): Entity { - return Entity( - entityId = entityId, - state = "", - attributes = if (friendlyName != null) mapOf("friendly_name" to friendlyName) else emptyMap(), - lastChanged = LocalDateTime.now(), - lastUpdated = LocalDateTime.now(), - ) -} diff --git a/common/src/test/kotlin/io/homeassistant/companion/android/common/data/integration/FriendlyStateTest.kt b/common/src/test/kotlin/io/homeassistant/companion/android/common/data/integration/FriendlyStateTest.kt index 880ad045d5e..7901039acc8 100644 --- a/common/src/test/kotlin/io/homeassistant/companion/android/common/data/integration/FriendlyStateTest.kt +++ b/common/src/test/kotlin/io/homeassistant/companion/android/common/data/integration/FriendlyStateTest.kt @@ -53,7 +53,7 @@ class FriendlyStateTest { private fun createEntity( entityId: String = "light.living_room", state: String = "on", - attributes: Map = mapOf("friendly_name" to "Living Room Light"), + attributes: Map = emptyMap(), ) = Entity( entityId = entityId, state = state, diff --git a/common/src/test/kotlin/io/homeassistant/companion/android/common/data/websocket/impl/entities/CompressedEntityTest.kt b/common/src/test/kotlin/io/homeassistant/companion/android/common/data/websocket/impl/entities/CompressedEntityTest.kt index 90d5e0ff2e9..eae1b334778 100644 --- a/common/src/test/kotlin/io/homeassistant/companion/android/common/data/websocket/impl/entities/CompressedEntityTest.kt +++ b/common/src/test/kotlin/io/homeassistant/companion/android/common/data/websocket/impl/entities/CompressedEntityTest.kt @@ -31,10 +31,10 @@ class CompressedEntityTest { val lastChanged = 42.0 val lastUpdated = 41.1 val attributes = mapOf( - "friendly_name" to Random.nextInt().toString(), + "dummy" to Random.nextInt().toString(), "icon" to Random.nextInt().toString(), ) - val rawData = """{"s":"$state","lc":$lastChanged,"lu":$lastUpdated,"a":{"friendly_name":"${attributes["friendly_name"]}","icon":"${attributes["icon"]}"}}""" + val rawData = """{"s":"$state","lc":$lastChanged,"lu":$lastUpdated,"a":{"dummy":"${attributes["dummy"]}","icon":"${attributes["icon"]}"}}""" val expected = CompressedEntityState(state = JsonPrimitive(state), attributes = attributes, lastChanged = lastChanged, lastUpdated = lastUpdated) assertEquals(expected, kotlinJsonMapper.decodeFromString(rawData)) } diff --git a/wear/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt b/wear/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt index 72cd39b3bc2..05b7cb3fedc 100755 --- a/wear/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt +++ b/wear/src/main/kotlin/io/homeassistant/companion/android/util/PreviewData.kt @@ -6,12 +6,10 @@ import io.homeassistant.companion.android.data.SimplifiedEntity import java.time.LocalDateTime val attributes: Map = mapOf( - "friendly_name" to "Testing", "icon" to "mdi:cellphone", ) val lightAttributes: Map = mapOf( - "friendly_name" to "Light", "icon" to "mdi:light-bulb", "supported_color_modes" to listOf("color_temp", "hs"), "supported_features" to 36, @@ -24,7 +22,6 @@ val lightAttributes: Map = mapOf( ) val fanAttributes: Map = mapOf( - "friendly_name" to "Fan", "icon" to "mdi:fan", "supported_features" to 1, "percentage" to 20, @@ -45,10 +42,10 @@ val previewEntityList = mapOf( val previewFavoritesList = listOf("light.first", "scene.first") val simplifiedEntity = - SimplifiedEntity(previewEntity1.entityId, attributes["friendly_name"].toString(), attributes["icon"].toString()) + SimplifiedEntity(previewEntity1.entityId, previewEntity1.entityId, attributes["icon"].toString()) -val playPreviewEntityScene1 = Entity("scene.first", "on", mapOf("friendly_name" to "Cleaning mode"), dateTime, dateTime) -val playPreviewEntityScene2 = Entity("scene.second", "on", mapOf("friendly_name" to "Colorful"), dateTime, dateTime) -val playPreviewEntityScene3 = Entity("scene.third", "on", mapOf("friendly_name" to "Goodbye"), dateTime, dateTime) +val playPreviewEntityScene1 = Entity("scene.first", "on", emptyMap(), dateTime, dateTime) +val playPreviewEntityScene2 = Entity("scene.second", "on", emptyMap(), dateTime, dateTime) +val playPreviewEntityScene3 = Entity("scene.third", "on", emptyMap(), dateTime, dateTime) val sensorList = listOf(BatterySensorManager.isChargingState) diff --git a/wear/src/screenshotTest/kotlin/io/homeassistant/companion/android/EntityListViewPreviewsTest.kt b/wear/src/screenshotTest/kotlin/io/homeassistant/companion/android/EntityListViewPreviewsTest.kt index affa06120c4..81b30af8a3a 100755 --- a/wear/src/screenshotTest/kotlin/io/homeassistant/companion/android/EntityListViewPreviewsTest.kt +++ b/wear/src/screenshotTest/kotlin/io/homeassistant/companion/android/EntityListViewPreviewsTest.kt @@ -20,8 +20,8 @@ class EntityListViewPreviewsTest { EntityViewList( entityLists = mapOf( stringResource(R.string.lights) to listOf( - EntityDisplayWithoutContext(previewEntity1), - EntityDisplayWithoutContext(previewEntity2), + EntityDisplayWithoutContext(previewEntity1, name = "Main"), + EntityDisplayWithoutContext(previewEntity2, name = "Floor secondary"), ), ), entityListsOrder = listOf(stringResource(R.string.lights)), diff --git a/wear/src/screenshotTestDebug/reference/io/homeassistant/companion/android/EntityListViewPreviewsTest/PreviewEntityListView_85f0dd27_0.png b/wear/src/screenshotTestDebug/reference/io/homeassistant/companion/android/EntityListViewPreviewsTest/PreviewEntityListView_85f0dd27_0.png index 132504dd748..5c2d4d733ec 100644 Binary files a/wear/src/screenshotTestDebug/reference/io/homeassistant/companion/android/EntityListViewPreviewsTest/PreviewEntityListView_85f0dd27_0.png and b/wear/src/screenshotTestDebug/reference/io/homeassistant/companion/android/EntityListViewPreviewsTest/PreviewEntityListView_85f0dd27_0.png differ