HAEntity
public struct HAEntity : HADataDecodable, Hashable
An entity in Home Assistant
-
The entity id, e.g.
sun.sunorlight.officeDeclaration
Swift
public var entityId: String -
The domain of the entity id, e.g.
lightinlight.officeDeclaration
Swift
public var domain: String -
The current state of the entity
Declaration
Swift
public var state: String -
When the entity was last changed
Declaration
Swift
public var lastChanged: Date -
When the entity was last updated
Declaration
Swift
public var lastUpdated: Date -
Attributes of the entity
Declaration
Swift
public var attributes: HAEntityAttributes -
Context of the entity’s last update
Declaration
Swift
public var context: HAResponseEvent.Context -
Create an entity from a data response
Throws
When the data is missing any required fieldsDeclaration
Swift
public init(data: HAData) throwsParameters
dataThe data to create from
-
Create an entity from individual items
Throws
When the attributes are missing any required fieldsDeclaration
Swift
public init( entityId: String, domain: String? = nil, state: String, lastChanged: Date, lastUpdated: Date, attributes: [String: Any], context: HAResponseEvent.Context ) throwsParameters
entityIdThe entity ID
domainThe domain of the entity ID (optional), when nil domain will be extracted from entityId
stateThe state
lastChangedThe date last changed
lastUpdatedThe date last updated
attributesThe attributes of the entity
contextThe context of the entity
-
Declaration
Swift
public func hash(into hasher: inout Hasher) -
Declaration
Swift
public static func == (lhs: HAEntity, rhs: HAEntity) -> Bool
View on GitHub