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_name state attribute.

    Warning

    The friendly_name state 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 the list_for_display endpoint instead. That endpoint is not currently mapped in HAKit; refer to its definition and usage in home-assistant/core and home-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 icon attribute This will be in the format type:name, e.g. mdi:map or hass:line

    Declaration

    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

    domain is required here as it may inform the per-domain parsing.

    Throws

    When the attributes are missing any required fields, domain-specific

    Declaration

    Swift

    public init(domain: String, dictionary: [String : Any]) throws

    Parameters

    domain

    The domain of the entity whose attributes these are for

    dictionary

    The dictionary representation of the