accessory

package
v0.1.0-fern-001 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

README

Accessory Category
Unknown 0
Other 1
Bridge 2
Fan 3
Garage Door Opener 4
Lightbulb 5
Door Lock 6
Outlet 7
Switch 8
Thermostat 9
Sensor 10
Security System 11
Door 12
Window 13
Window Covering 14
Programmable Switch 15
IP Camera 17
Video Doorbell 18
Air Purifier 19
Heater 20
Air Conditioner 21
Humidifier 22
Dehumidifier 23
Sprinklers 28
Faucets 29
Shower Systems 30

Documentation

Overview

THIS FILE IS AUTO-GENERATED

Package accessory implements the HomeKit accessories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessory

type Accessory struct {
	ID       int64              `json:"aid"`
	Services []*service.Service `json:"services"`

	Type AccessoryType                 `json:"-"`
	Info *service.AccessoryInformation `json:"-"`
	// contains filtered or unexported fields
}

Accessory implements the model.Accessory interface and contains the data structures to communicate with HomeKit.

An accessory in consists of services, which consists of characteristics. Every accessory has the "accessory info" service by default which consists of characteristics to identify the accessory: name, model, manufacturer,...

func New

func New(info Info, typ AccessoryType) *Accessory

New returns an accessory which implements model.Accessory.

func (*Accessory) AddService

func (a *Accessory) AddService(s *service.Service)

Adds a service to the accessory and updates the ids of the service and the corresponding characteristics

func (*Accessory) Equal

func (a *Accessory) Equal(other interface{}) bool

Equal returns true when receiver has the same services and id as the argument.

func (*Accessory) GetID

func (a *Accessory) GetID() int64

func (*Accessory) GetServices

func (a *Accessory) GetServices() []*service.Service

func (*Accessory) Identify

func (a *Accessory) Identify()

func (*Accessory) OnIdentify

func (a *Accessory) OnIdentify(fn func())

func (*Accessory) SetID

func (a *Accessory) SetID(id int64)

type AccessoryType

type AccessoryType int
const (
	TypeUnknown            AccessoryType = 0
	TypeOther              AccessoryType = 1
	TypeBridge             AccessoryType = 2
	TypeFan                AccessoryType = 3
	TypeGarageDoorOpener   AccessoryType = 4
	TypeLightbulb          AccessoryType = 5
	TypeDoorLock           AccessoryType = 6
	TypeOutlet             AccessoryType = 7
	TypeSwitch             AccessoryType = 8
	TypeThermostat         AccessoryType = 9
	TypeSensor             AccessoryType = 10
	TypeSecuritySystem     AccessoryType = 11
	TypeDoor               AccessoryType = 12
	TypeWindow             AccessoryType = 13
	TypeWindowCovering     AccessoryType = 14
	TypeProgrammableSwitch AccessoryType = 15
	TypeIPCamera           AccessoryType = 17
	TypeVideoDoorbell      AccessoryType = 18
	TypeAirPurifier        AccessoryType = 19
	TypeHeater             AccessoryType = 20
	TypeAirConditioner     AccessoryType = 21
	TypeHumidifier         AccessoryType = 22
	TypeDehumidifier       AccessoryType = 23
	TypeSprinklers         AccessoryType = 28
	TypeFaucets            AccessoryType = 29
	TypeShowerSystems      AccessoryType = 30
)

type Bridge

type Bridge struct {
	*Accessory
}

func NewBridge

func NewBridge(info Info) *Bridge

NewBridge returns a bridge which implements model.Bridge.

type Container

type Container struct {
	Accessories []*Accessory `json:"accessories"`
	// contains filtered or unexported fields
}

Container manages a list of accessories.

func NewContainer

func NewContainer() *Container

NewContainer returns a container.

func (*Container) AccessoryType

func (m *Container) AccessoryType() AccessoryType

AccessoryType returns the accessory type identifier for the accessories inside the container.

func (*Container) AddAccessory

func (m *Container) AddAccessory(a *Accessory)

AddAccessory adds an accessory to the container. This method ensures that the accessory ids are valid and unique withing the container.

func (*Container) ContentHash

func (m *Container) ContentHash() []byte

ContentHash returns a hash of the content (ignoring the value field).

func (*Container) Equal

func (m *Container) Equal(other interface{}) bool

Equal returns true when receiver has the same accessories as the argument.

func (*Container) RemoveAccessory

func (m *Container) RemoveAccessory(a *Accessory)

RemoveAccessory removes an accessory from the container.

type Info

type Info struct {
	Name         string
	SerialNumber string
	Manufacturer string
	Model        string
}

type Lightbulb

type Lightbulb struct {
	*Accessory
	Lightbulb *service.Lightbulb
}

func NewLightbulb

func NewLightbulb(info Info) *Lightbulb

NewLightbulb returns an light bulb accessory which one light bulb service.

type Outlet

type Outlet struct {
	*Accessory
	Outlet *service.Outlet
}

func NewOutlet

func NewOutlet(info Info) *Outlet

NewOutlet returns an outlet accessory containing one outlet service.

type Switch

type Switch struct {
	*Accessory
	Switch *service.Switch
}

func NewSwitch

func NewSwitch(info Info) *Switch

NewSwitch returns a switch which implements model.Switch.

type Thermometer

type Thermometer struct {
	*Accessory

	TempSensor *service.TemperatureSensor
}

func NewTemperatureSensor

func NewTemperatureSensor(info Info, temp, min, max, steps float64) *Thermometer

NewTemperatureSensor returns a Thermometer which implements model.Thermometer.

type Thermostat

type Thermostat struct {
	*Accessory

	Thermostat *service.Thermostat
}

func NewThermostat

func NewThermostat(info Info, temp, min, max, steps float64) *Thermostat

NewThermostat returns a Thermostat which implements model.Thermostat.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL