Skip to content

Commit 9ee8ac4

Browse files
authored
Add summaries and area context to native dashboard (#4221)
<!-- Thank you for submitting a Pull Request and helping to improve Home Assistant. Please complete the following sections to help the processing and review of your changes. Please do not delete anything from this template. --> ## Summary <!-- Provide a brief summary of the changes you have made and most importantly what they aim to achieve --> ## Screenshots <!-- If this is a user-facing change not in the frontend, please include screenshots in light and dark mode. --> <img width="1206" height="2622" alt="Simulator Screenshot - iPhone 17 - 2026-01-14 at 16 42 40" src="https://github.com/user-attachments/assets/0e023ce2-f767-40a8-900f-1b1a00a127f5" /> ## Link to pull request in Documentation repository <!-- Pull requests that add, change or remove functionality must have a corresponding pull request in the Companion App Documentation repository (https://github.com/home-assistant/companion.home-assistant). Please add the number of this pull request after the "#" --> Documentation: home-assistant/companion.home-assistant# ## Any other notes <!-- If there is any other information of note, like if this Pull Request is part of a bigger change, please include it here. -->
1 parent 6f577eb commit 9ee8ac4

File tree

13 files changed

+537
-90
lines changed

13 files changed

+537
-90
lines changed

HomeAssistant.xcodeproj/project.pbxproj

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@
671671
422F88192D42989E00706A0A /* CustomWidgetPressButtonAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 422F88182D42989E00706A0A /* CustomWidgetPressButtonAppIntent.swift */; };
672672
422F881A2D42989E00706A0A /* CustomWidgetPressButtonAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 422F88182D42989E00706A0A /* CustomWidgetPressButtonAppIntent.swift */; };
673673
422F951F2CFDF7C5003B7514 /* HAApplicationShortcutItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 422F951E2CFDF7C5003B7514 /* HAApplicationShortcutItem.swift */; };
674+
422FB62F2F17E33800243A68 /* DomainSummaryCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 422FB62E2F17E33800243A68 /* DomainSummaryCard.swift */; };
674675
423179802D54FADD0037A8A4 /* AppIntentHaptics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4231797F2D54FADD0037A8A4 /* AppIntentHaptics.swift */; };
675676
423179812D54FADD0037A8A4 /* AppIntentHaptics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4231797F2D54FADD0037A8A4 /* AppIntentHaptics.swift */; };
676677
42333ADB2D0B1771001E8408 /* EntityRegistryListForDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42333ADA2D0B1771001E8408 /* EntityRegistryListForDisplay.swift */; };
@@ -782,6 +783,7 @@
782783
426BB0C72D394BFF0062D905 /* AssistPipelinePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426BB0C62D394BFF0062D905 /* AssistPipelinePicker.swift */; };
783784
426CBB6A2C9C543F003CA3AC /* ControlSwitchValueProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426CBB692C9C543F003CA3AC /* ControlSwitchValueProvider.swift */; };
784785
426CBB6C2C9C550D003CA3AC /* IntentSwitchEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426CBB6B2C9C550D003CA3AC /* IntentSwitchEntity.swift */; };
786+
426D2F032F17E8530062C359 /* HomeEntityTileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426D2F022F17E8530062C359 /* HomeEntityTileView.swift */; };
785787
426D9C742C9C60B000F278AF /* ControlEntityProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426D9C722C9C582F00F278AF /* ControlEntityProvider.swift */; };
786788
426D9C752C9C60B000F278AF /* ControlEntityProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426D9C722C9C582F00F278AF /* ControlEntityProvider.swift */; };
787789
426E02992EF98F5F008237D4 /* CameraListRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 426E02982EF98F5F008237D4 /* CameraListRow.swift */; };
@@ -923,10 +925,10 @@
923925
429BA2AF2C800CAB00A50996 /* SFSymbolEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429BA2AE2C800CAB00A50996 /* SFSymbolEntity.swift */; };
924926
429BEA1A2D102F3A00F070F9 /* ConnectionErrorDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429BEA192D102F3A00F070F9 /* ConnectionErrorDetailsView.swift */; };
925927
429BEA1D2D10315F00F070F9 /* SheetCloseButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429BEA1B2D1030EA00F070F9 /* SheetCloseButton.swift */; };
928+
429C33BF2F17989F0033EF5E /* EntityPickerViewModel.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429C33BC2F17986D0033EF5E /* EntityPickerViewModel.test.swift */; };
926929
429C33C22F17A7010033EF5E /* HAUsagePredictionCommonControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429C33C12F17A7010033EF5E /* HAUsagePredictionCommonControl.swift */; };
927930
429C33C32F17A7010033EF5E /* HAUsagePredictionCommonControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429C33C12F17A7010033EF5E /* HAUsagePredictionCommonControl.swift */; };
928931
429C33C52F17CE4C0033EF5E /* AreaGridButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429C33C42F17CE4C0033EF5E /* AreaGridButton.swift */; };
929-
429C33BF2F17989F0033EF5E /* EntityPickerViewModel.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429C33BC2F17986D0033EF5E /* EntityPickerViewModel.test.swift */; };
930932
429C72202B28D0EC00BCD558 /* Haptics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429C721F2B28D0EC00BCD558 /* Haptics.swift */; };
931933
429C82892DCCDB0F007B03AF /* HAProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42E4C9922DCC9A6600DF2813 /* HAProgressView.swift */; };
932934
429D51C52EFA0E750014AD0D /* ModernAssistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 429D51C42EFA0E750014AD0D /* ModernAssistView.swift */; };
@@ -2334,6 +2336,7 @@
23342336
422F88152D428E8300706A0A /* CustomWidgetActivateAppIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomWidgetActivateAppIntent.swift; sourceTree = "<group>"; };
23352337
422F88182D42989E00706A0A /* CustomWidgetPressButtonAppIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomWidgetPressButtonAppIntent.swift; sourceTree = "<group>"; };
23362338
422F951E2CFDF7C5003B7514 /* HAApplicationShortcutItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HAApplicationShortcutItem.swift; sourceTree = "<group>"; };
2339+
422FB62E2F17E33800243A68 /* DomainSummaryCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomainSummaryCard.swift; sourceTree = "<group>"; };
23372340
4231797F2D54FADD0037A8A4 /* AppIntentHaptics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIntentHaptics.swift; sourceTree = "<group>"; };
23382341
42333ADA2D0B1771001E8408 /* EntityRegistryListForDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityRegistryListForDisplay.swift; sourceTree = "<group>"; };
23392342
4236229F2F05587800391BD0 /* EntityIconColorProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityIconColorProvider.swift; sourceTree = "<group>"; };
@@ -2426,6 +2429,7 @@
24262429
426BB0C62D394BFF0062D905 /* AssistPipelinePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssistPipelinePicker.swift; sourceTree = "<group>"; };
24272430
426CBB692C9C543F003CA3AC /* ControlSwitchValueProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControlSwitchValueProvider.swift; sourceTree = "<group>"; };
24282431
426CBB6B2C9C550D003CA3AC /* IntentSwitchEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntentSwitchEntity.swift; sourceTree = "<group>"; };
2432+
426D2F022F17E8530062C359 /* HomeEntityTileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeEntityTileView.swift; sourceTree = "<group>"; };
24292433
426D9C722C9C582F00F278AF /* ControlEntityProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControlEntityProvider.swift; sourceTree = "<group>"; };
24302434
426E02982EF98F5F008237D4 /* CameraListRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraListRow.swift; sourceTree = "<group>"; };
24312435
426E029A2EF98F65008237D4 /* CameraSectionReorderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraSectionReorderView.swift; sourceTree = "<group>"; };
@@ -2565,9 +2569,9 @@
25652569
429BA2AE2C800CAB00A50996 /* SFSymbolEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFSymbolEntity.swift; sourceTree = "<group>"; };
25662570
429BEA192D102F3A00F070F9 /* ConnectionErrorDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionErrorDetailsView.swift; sourceTree = "<group>"; };
25672571
429BEA1B2D1030EA00F070F9 /* SheetCloseButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetCloseButton.swift; sourceTree = "<group>"; };
2572+
429C33BC2F17986D0033EF5E /* EntityPickerViewModel.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityPickerViewModel.test.swift; sourceTree = "<group>"; };
25682573
429C33C12F17A7010033EF5E /* HAUsagePredictionCommonControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HAUsagePredictionCommonControl.swift; sourceTree = "<group>"; };
25692574
429C33C42F17CE4C0033EF5E /* AreaGridButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AreaGridButton.swift; sourceTree = "<group>"; };
2570-
429C33BC2F17986D0033EF5E /* EntityPickerViewModel.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityPickerViewModel.test.swift; sourceTree = "<group>"; };
25712575
429C721F2B28D0EC00BCD558 /* Haptics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Haptics.swift; sourceTree = "<group>"; };
25722576
429D51C42EFA0E750014AD0D /* ModernAssistView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModernAssistView.swift; sourceTree = "<group>"; };
25732577
42A0B9352EBB82EB00E074BF /* StatusBarButtonsConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarButtonsConfigurator.swift; sourceTree = "<group>"; };
@@ -5389,6 +5393,14 @@
53895393
path = General;
53905394
sourceTree = "<group>";
53915395
};
5396+
429C33BE2F17988D0033EF5E /* EntityPicker */ = {
5397+
isa = PBXGroup;
5398+
children = (
5399+
429C33BC2F17986D0033EF5E /* EntityPickerViewModel.test.swift */,
5400+
);
5401+
path = EntityPicker;
5402+
sourceTree = "<group>";
5403+
};
53925404
429C33C02F17A6CF0033EF5E /* Models */ = {
53935405
isa = PBXGroup;
53945406
children = (
@@ -5397,14 +5409,6 @@
53975409
429C33C12F17A7010033EF5E /* HAUsagePredictionCommonControl.swift */,
53985410
);
53995411
path = Models;
5400-
sourceTree = "<group>";
5401-
};
5402-
429C33BE2F17988D0033EF5E /* EntityPicker */ = {
5403-
isa = PBXGroup;
5404-
children = (
5405-
429C33BC2F17986D0033EF5E /* EntityPickerViewModel.test.swift */,
5406-
);
5407-
path = EntityPicker;
54085412
sourceTree = "<group>";
54095413
};
54105414
42A2AB7E2C80750A00C5608D /* Control */ = {
@@ -5794,6 +5798,7 @@
57945798
4289FCB82F0BFF50005189AA /* HomeViewConfiguration.swift */,
57955799
420C914F2F0C6CAC005D04A6 /* HomeViewCustomizationView.swift */,
57965800
429C33C42F17CE4C0033EF5E /* AreaGridButton.swift */,
5801+
422FB62E2F17E33800243A68 /* DomainSummaryCard.swift */,
57975802
);
57985803
path = Home;
57995804
sourceTree = "<group>";
@@ -5804,6 +5809,7 @@
58045809
42DFE87C2EFB128B0058DADB /* EntityTileView.swift */,
58055810
4236229F2F05587800391BD0 /* EntityIconColorProvider.swift */,
58065811
42C60F902F07FB0F0071A6F6 /* MoreInfoDialog */,
5812+
426D2F022F17E8530062C359 /* HomeEntityTileView.swift */,
58075813
);
58085814
path = EntityTile;
58095815
sourceTree = "<group>";
@@ -9171,6 +9177,7 @@
91719177
42F5C0892F02BCDE00C50310 /* IntentFanEntity.swift in Sources */,
91729178
426BB0C52D393F0E0062D905 /* EntityPicker.swift in Sources */,
91739179
1112AEBB25F717E9007A541A /* LocationHistoryDetailViewController.swift in Sources */,
9180+
422FB62F2F17E33800243A68 /* DomainSummaryCard.swift in Sources */,
91749181
11BD7B4D25B53D7F001826F0 /* AppMacBridgeStatusItemConfiguration.swift in Sources */,
91759182
11F55EED25D3B088003977AC /* NotificationDebugNotificationsViewController.swift in Sources */,
91769183
42DFE8742EFAE33D0058DADB /* AssistWavesAnimation.swift in Sources */,
@@ -9296,6 +9303,7 @@
92969303
4273C48B2C8858470065A5B4 /* ControlOpenPageValueProvider.swift in Sources */,
92979304
427FEE072D9C03DE0047C00C /* OnboardingScanningInstanceRow.swift in Sources */,
92989305
420FE84B2B556BB100878E06 /* CarPlayActionsTemplate+Build.swift in Sources */,
9306+
426D2F032F17E8530062C359 /* HomeEntityTileView.swift in Sources */,
92999307
42DF6B2F2CCF918D00D7EC14 /* BluetoothPermissionView.swift in Sources */,
93009308
425573C72B5572AD00145217 /* CarPlayServerListTemplate+Build.swift in Sources */,
93019309
4238E8572EB0EA4A00BDF010 /* ConnectionSecurityLevelBlockViewModel.swift in Sources */,

Sources/App/Resources/en.lproj/Localizable.strings

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,15 @@
361361
"home_view.customization.areas_layout.title" = "Areas layout";
362362
"home_view.customization.areas_layout.list.title" = "List";
363363
"home_view.customization.areas_layout.grid.title" = "Grid";
364+
"home_view.customization.summaries.title" = "Summaries";
365+
"home_view.summaries.title" = "Summaries";
366+
"home_view.summaries.lights.title" = "Lights";
367+
"home_view.summaries.covers.title" = "Covers";
368+
"home_view.summaries.lights.all_off" = "All off";
369+
"home_view.summaries.lights.count_on" = "%d on";
370+
"home_view.summaries.covers.all_closed" = "All closed";
371+
"home_view.summaries.covers.count_open" = "%d open";
372+
"home_view.summaries.count_active" = "%d active";
364373
"improv.button.continue" = "Continue";
365374
"improv.connection_state.authorized" = "Setting up Wi-Fi";
366375
"improv.connection_state.provisioning" = "Connecting to Wi-Fi";
Lines changed: 100 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,48 @@
1-
import AppIntents
21
import HAKit
32
import Shared
43
import SwiftUI
54

5+
/// Pure UI component for displaying an entity tile
6+
/// This view is designed to be reusable across different contexts in the app
7+
///
8+
/// ## Usage Example
9+
/// ```swift
10+
/// // Simple usage with static data
11+
/// EntityTileView(
12+
/// entityName: "Living Room Light",
13+
/// entityState: "On",
14+
/// icon: .lightbulbIcon,
15+
/// iconColor: .yellow,
16+
/// isUnavailable: false,
17+
/// onIconTap: {
18+
/// // Handle icon tap action
19+
/// },
20+
/// onTileTap: {
21+
/// // Handle tile tap action
22+
/// }
23+
/// )
24+
///
25+
/// // Usage in a custom view
26+
/// struct CustomEntityList: View {
27+
/// let entities: [MyCustomEntity]
28+
///
29+
/// var body: some View {
30+
/// ForEach(entities) { entity in
31+
/// EntityTileView(
32+
/// entityName: entity.name,
33+
/// entityState: entity.status,
34+
/// icon: entity.icon,
35+
/// iconColor: entity.color,
36+
/// onIconTap: { performAction(on: entity) }
37+
/// )
38+
/// }
39+
/// }
40+
/// }
41+
/// ```
42+
///
43+
/// For Home Assistant entity integration, use `HomeEntityTileView` instead,
44+
/// which handles all the business logic like device class lookup, icon color
45+
/// computation, and AppIntents integration.
646
@available(iOS 26.0, *)
747
struct EntityTileView: View {
848
enum Constants {
@@ -15,20 +55,42 @@ struct EntityTileView: View {
1555
static let textVStackSpacing: CGFloat = 2
1656
}
1757

18-
let server: Server
19-
let haEntity: HAEntity
58+
// MARK: - Display Data
59+
60+
let entityName: String
61+
let entityState: String
62+
let icon: MaterialDesignIcons
63+
let iconColor: Color
64+
let isUnavailable: Bool
65+
let onIconTap: (() -> Void)?
66+
let onTileTap: (() -> Void)?
67+
68+
// MARK: - State
2069

21-
@Namespace private var namespace
2270
@State private var triggerHaptic = 0
23-
@State private var iconColor: Color = .secondary
24-
@State private var showMoreInfoDialog = false
25-
@State private var deviceClass: DeviceClass = .unknown
2671

27-
init(server: Server, haEntity: HAEntity) {
28-
self.server = server
29-
self.haEntity = haEntity
72+
// MARK: - Initializer
73+
74+
init(
75+
entityName: String,
76+
entityState: String,
77+
icon: MaterialDesignIcons,
78+
iconColor: Color,
79+
isUnavailable: Bool = false,
80+
onIconTap: (() -> Void)? = nil,
81+
onTileTap: (() -> Void)? = nil
82+
) {
83+
self.entityName = entityName
84+
self.entityState = entityState
85+
self.icon = icon
86+
self.iconColor = iconColor
87+
self.isUnavailable = isUnavailable
88+
self.onIconTap = onIconTap
89+
self.onTileTap = onTileTap
3090
}
3191

92+
// MARK: - Body
93+
3294
var body: some View {
3395
tileContent
3496
.frame(height: Constants.tileHeight)
@@ -38,27 +100,21 @@ struct EntityTileView: View {
38100
.clipShape(RoundedRectangle(cornerRadius: Constants.cornerRadius))
39101
.overlay(
40102
RoundedRectangle(cornerRadius: Constants.cornerRadius)
41-
.stroke(.tileBorder, lineWidth: Constants.borderLineWidth)
103+
.stroke(
104+
isUnavailable ? .gray : .tileBorder,
105+
style: isUnavailable ?
106+
StrokeStyle(lineWidth: Constants.borderLineWidth, dash: [5, 3]) :
107+
StrokeStyle(lineWidth: Constants.borderLineWidth)
108+
)
42109
)
43-
.onChange(of: haEntity) { _, _ in
44-
updateIconColor()
45-
}
46-
.onAppear {
47-
getDeviceClass()
48-
updateIconColor()
49-
}
50-
.matchedTransitionSource(id: haEntity.entityId, in: namespace)
110+
.opacity(isUnavailable ? 0.5 : 1.0)
51111
.onTapGesture {
52-
showMoreInfoDialog = true
53-
}
54-
.fullScreenCover(isPresented: $showMoreInfoDialog) {
55-
EntityMoreInfoDialogView(
56-
server: server, haEntity: haEntity
57-
)
58-
.navigationTransition(.zoom(sourceID: haEntity.entityId, in: namespace))
112+
onTileTap?()
59113
}
60114
}
61115

116+
// MARK: - View Components
117+
62118
private var tileContent: some View {
63119
VStack(alignment: .leading, spacing: DesignSystem.Spaces.one) {
64120
contentRow
@@ -82,42 +138,35 @@ struct EntityTileView: View {
82138
}
83139

84140
private var entityNameText: some View {
85-
Text(haEntity.attributes.friendlyName ?? haEntity.entityId)
141+
Text(entityName)
86142
.font(.footnote)
87143
.fontWeight(.semibold)
144+
#if os(iOS)
88145
.foregroundColor(Color(uiColor: .label))
146+
#else
147+
.foregroundColor(.primary)
148+
#endif
89149
.lineLimit(2)
90150
.multilineTextAlignment(.leading)
91151
}
92152

93153
private var entityStateText: some View {
94-
Text(
95-
Domain(entityId: haEntity.entityId)?.contextualStateDescription(for: haEntity) ?? haEntity.state
96-
)
97-
.font(.caption)
98-
.foregroundColor(Color(uiColor: .secondaryLabel))
99-
}
100-
101-
private func getDeviceClass() {
102-
deviceClass = DeviceClassProvider.deviceClass(
103-
for: haEntity.entityId,
104-
serverId: server.identifier.rawValue
105-
)
154+
Text(entityState)
155+
.font(.caption)
156+
#if os(iOS)
157+
.foregroundColor(Color(uiColor: .secondaryLabel))
158+
#else
159+
.foregroundColor(.secondary)
160+
#endif
161+
.lineLimit(1)
162+
.truncationMode(.tail)
106163
}
107164

108165
private var iconView: some View {
109-
let icon: MaterialDesignIcons
110-
if let entityIcon = haEntity.attributes.icon {
111-
icon = MaterialDesignIcons(serversideValueNamed: entityIcon)
112-
} else if let domain = Domain(entityId: haEntity.entityId) {
113-
let stateString = haEntity.state
114-
let domainState = Domain.State(rawValue: stateString) ?? .unknown
115-
icon = domain.icon(deviceClass: deviceClass.rawValue, state: domainState)
116-
} else {
117-
icon = .homeIcon
118-
}
119-
120-
return Button(intent: AppIntentProvider.intent(for: haEntity, server: server)) {
166+
Button {
167+
onIconTap?()
168+
triggerHaptic += 1
169+
} label: {
121170
VStack {
122171
Text(verbatim: icon.unicode)
123172
.font(.custom(MaterialDesignIcons.familyName, size: Constants.iconFontSize))
@@ -129,26 +178,6 @@ struct EntityTileView: View {
129178
.clipShape(Circle())
130179
}
131180
.buttonStyle(.plain)
132-
.simultaneousGesture(
133-
TapGesture().onEnded {
134-
triggerHaptic += 1
135-
}
136-
)
137181
.sensoryFeedback(.impact, trigger: triggerHaptic)
138182
}
139-
140-
private func updateIconColor() {
141-
let state = haEntity.state
142-
let colorMode = haEntity.attributes["color_mode"] as? String
143-
let rgbColor = haEntity.attributes["rgb_color"] as? [Int]
144-
let hsColor = haEntity.attributes["hs_color"] as? [Double]
145-
146-
iconColor = EntityIconColorProvider.iconColor(
147-
domain: Domain(entityId: haEntity.entityId) ?? .switch,
148-
state: state,
149-
colorMode: colorMode,
150-
rgbColor: rgbColor,
151-
hsColor: hsColor
152-
)
153-
}
154183
}

0 commit comments

Comments
 (0)