HAEntityAttributes
public struct HAEntityAttributes
The attributes of the entity’s state
-
Convenience access to values inside of the dictionary
Declaration
Swift
public subscript(key: String) -> Any? { get } -
A dictionary representation of the attributes This contains all keys and values received, including those not parsed or handled otherwise
Declaration
Swift
public var dictionary: [String : Any] -
The value of the entity’s legacy
friendly_namestate attribute.Warning
Thefriendly_namestate attribute should no longer be used to display an entity’s name. It does not reflect the canonical display name, which is derived from the entity and device registries together with any user customizations. Resolve the display name from the entity registry display data provided by thelist_for_displayendpoint instead. That endpoint is not currently mapped in HAKit; refer to its definition and usage inhome-assistant/coreandhome-assistant/frontend.Declaration
Swift
@available(*, deprecated, message: "friendly_name should no longer be used to display an entity's name; it doesn't reflect the entity/device registry name or user customizations. Resolve the display name from the entity registry `list_for_display` endpoint instead (not yet mapped in HAKit — see home-assistant/core and home-assistant/frontend﹚.") public var friendlyName: String? { get } -
The icon of the entity, from the
iconattribute This will be in the formattype:name, e.g.mdi:maporhass:lineDeclaration
Swift
public var icon: String? { get } -
For a zone-type entity, this contains parsed attributes specific to the zone
Declaration
Swift
public var zone: HAEntityAttributesZone? -
Create attributes from individual values
domainis required here as it may inform the per-domain parsing.Throws
When the attributes are missing any required fields, domain-specificDeclaration
Swift
public init(domain: String, dictionary: [String : Any]) throwsParameters
domainThe domain of the entity whose attributes these are for
dictionaryThe dictionary representation of the
View on GitHub