accessory

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 147

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
Television 31
Remote Control 32

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       uint64             `json:"aid"`
	Services []*service.Service `json:"services"`

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

Accessory is a HomeKit accessory.

An accessory contains services, which themselves contain 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) 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) UpdateIDs added in v1.1.0

func (a *Accessory) UpdateIDs()

UpdateIDs updates the service and characteirstic ids.

type AccessoryType

type AccessoryType uint8
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
	TypeTelevision         AccessoryType = 31
	TypeRemoteControl      AccessoryType = 32
)

type Bridge

type Bridge struct {
	*Accessory
}

func NewBridge

func NewBridge(info Info) *Bridge

NewBridge returns a bridge which implements model.Bridge.

type Camera added in v1.1.0

type Camera struct {
	*Accessory
	Control           *service.CameraControl
	StreamManagement1 *service.CameraRTPStreamManagement
	StreamManagement2 *service.CameraRTPStreamManagement
}

Camera provides RTP video streaming.

func NewCamera added in v1.1.0

func NewCamera(info Info) *Camera

NewCamera returns an IP camera accessory.

type ColoredLightbulb added in v1.2.1

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

func NewColoredLightbulb added in v1.2.1

func NewColoredLightbulb(info Info) *ColoredLightbulb

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

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) error

AddAccessory adds an accessory to the container. This method ensures that the accessory ids are valid and unique within 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
	FirmwareRevision string
	ID               uint64
}

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 Television

type Television struct {
	*Accessory
	Television *service.Television
	Speaker    *service.Speaker
}

func NewTelevision

func NewTelevision(info Info) *Television

NewTelevision returns a television accessory.

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.

type Windows added in v1.2.2

type Windows struct {
	*Accessory
	Window *service.Window
}

func NewWindow added in v1.2.2

func NewWindow(info Info, currentState int) *Windows

NewWindow returns a window which implements model.NewWindow.

Jump to

Keyboard shortcuts

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