mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-04 11:42:39 -06:00
Basic implementation of a native dashboard - WIP - [ ] Support more domains toggle action when tapping icon - [x] Light - [x] Cover - [x] Switch - [ ] Create the equivalent of "more info dialog" for each domain - [x] Light - [x] Cover - [x] Switch - [x] Add haptics - [ ] Add more cards such as a camera card - [ ] Find a way to display sensors information such as humidity and temperature - [ ] Allow customizing background - [x] Allow opening the native dashboard from iOS controls - [ ] Allow opening the native dashboard from Shortcuts - [ ] Add an advanced option somewhere in settings that allow user to see the native dashboard first instead of web UI - [ ] Add error state - [x] Add empty state - [x] Add loading state - [x] Allow reordering rooms - [x] Allow reordering cards <img width="1232" height="1158" alt="CleanShot 2026-01-05 at 16 19 59@2x" src="https://github.com/user-attachments/assets/84ae8748-ec40-430c-a820-fcb6a88a6270" /> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
28 lines
1021 B
Swift
28 lines
1021 B
Swift
import Foundation
|
|
import GRDB
|
|
|
|
/// Provides device class information for entities
|
|
public enum DeviceClassProvider {
|
|
/// Returns the device class for a given entity
|
|
/// - Parameters:
|
|
/// - entityId: The entity ID
|
|
/// - serverId: The server ID
|
|
/// - Returns: The device class for the entity, or `.unknown` if not found
|
|
public static func deviceClass(for entityId: String, serverId: String) -> DeviceClass {
|
|
do {
|
|
let entity = try Current.database().read { db in
|
|
try HAAppEntity
|
|
.filter(
|
|
Column(DatabaseTables.AppEntity.entityId.rawValue) == entityId &&
|
|
Column(DatabaseTables.AppEntity.serverId.rawValue) == serverId
|
|
)
|
|
.fetchOne(db)
|
|
}
|
|
return entity?.deviceClass ?? .unknown
|
|
} catch {
|
|
Current.Log.error("Failed to load device class for \(entityId): \(error)")
|
|
return .unknown
|
|
}
|
|
}
|
|
}
|