Support image entity in camera widget (now renamed picture widget) (#4159)

- Allow selecting image entities in the camera widget
 - Rename camera widget to picture widget to better reflect camera + image entity support
This commit is contained in:
Joris Pelgröm 2024-01-25 23:02:51 +01:00 committed by GitHub
parent ef17312e70
commit c6ddca8fdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -47,7 +47,7 @@ import io.homeassistant.companion.android.widgets.template.TemplateWidgetConfigu
enum class WidgetType(val widgetIcon: IIcon) {
BUTTON(CommunityMaterial.Icon2.cmd_gesture_tap),
CAMERA(CommunityMaterial.Icon.cmd_camera),
CAMERA(CommunityMaterial.Icon.cmd_camera_image),
STATE(CommunityMaterial.Icon3.cmd_shape),
MEDIA(CommunityMaterial.Icon3.cmd_play_box_multiple),
TEMPLATE(CommunityMaterial.Icon.cmd_code_braces);

View file

@ -136,7 +136,7 @@ class CameraWidgetConfigureActivity : BaseWidgetConfigureActivity() {
lifecycleScope.launch {
try {
val fetchedEntities = serverManager.integrationRepository(server.id).getEntities().orEmpty()
.filter { it.domain == "camera" }
.filter { it.domain == "camera" || it.domain == "image" }
entities[server.id] = fetchedEntities
if (server.id == selectedServerId) setAdapterEntities(server.id)
} catch (e: Exception) {

View file

@ -132,8 +132,8 @@
<string name="camera_tile_no_entity_yet">Edit the tile settings and select a camera to show</string>
<string name="camera_tile_n">Camera tile #%d</string>
<string name="camera_tiles">Camera tiles</string>
<string name="camera_widgets">Camera widgets</string>
<string name="camera_widget_desc">Displays the latest image from the camera</string>
<string name="camera_widgets">Picture widgets</string>
<string name="camera_widget_desc">Displays the latest picture from a camera or image entity</string>
<string name="cancel">Cancel</string>
<string name="changelog">View full change log</string>
<string name="checking_with_home_assistant">Checking with Home Assistant</string>
@ -974,8 +974,8 @@
<string name="widget_background_type_dynamiccolor">Dynamic color</string>
<string name="widget_background_type_transparent">Transparent</string>
<string name="widget_button_image_description">Service button</string>
<string name="widget_camera_description">Camera widget</string>
<string name="widget_camera_contentdescription">Camera image</string>
<string name="widget_camera_description">Picture widget</string>
<string name="widget_camera_contentdescription">Image</string>
<string name="widget_config_service_error">A custom component is preventing service data from loading.</string>
<string name="widget_creation_error">Unable to create widget.</string>
<string name="widget_entity_fetch_error">Unable to fetch data for configured entity.</string>