HAServiceDefinition

public struct HAServiceDefinition

A service definition

  • The domain of the service, for example light in light.turn_on

    Declaration

    Swift

    public var domain: HAServicesDomain
  • The service, for example turn_on in light.turn_on

    Declaration

    Swift

    public var service: HAServicesService
  • The pair of domain and service, for example light.turn_on

    Declaration

    Swift

    public var domainServicePair: String
  • The name of the service, for example “Turn On”

    Declaration

    Swift

    public var name: String
  • The description of the service

    Declaration

    Swift

    public var description: String
  • Available fields of the service call

    Declaration

    Swift

    public var fields: [String : [String : Any]]
  • Create with information

    Throws

    If any required keys are missing in the data

    Declaration

    Swift

    public init(domain: HAServicesDomain, service: HAServicesService, data: HAData) throws

    Parameters

    domain

    The domain

    service

    The service

    data

    The data for the definition

  • Create with information

    Declaration

    Swift

    public init(
        domain: HAServicesDomain,
        service: HAServicesService,
        name: String,
        description: String,
        fields: [String: [String: Any]]
    )

    Parameters

    domain

    The domain of the service

    service

    The service

    name

    The friendly name of the service

    description

    The description of the service

    fields

    Available fields in the service call