v0.7.2 Latest Latest

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 2



Package feature defines the basic requirements of a feature



This section is empty.


This section is empty.


This section is empty.


type Fake

type Fake struct {
	Err         error
	FeatureName string

func (*Fake) Exists

func (f *Fake) Exists() bool

func (*Fake) GetTopic

func (f *Fake) GetTopic() string

func (*Fake) Max

func (f *Fake) Max() int

func (*Fake) Min

func (f *Fake) Min() int

func (*Fake) Name

func (f *Fake) Name() string

func (*Fake) OnSet

func (f *Fake) OnSet() (chan string, error)

func (*Fake) OnSetFunc

func (f *Fake) OnSetFunc(func(string)) error

func (*Fake) OnUpdate

func (f *Fake) OnUpdate() (chan string, error)

func (*Fake) OnUpdateFunc

func (f *Fake) OnUpdateFunc(func(string)) error

func (*Fake) Set

func (f *Fake) Set(string) error

func (*Fake) SetTopic

func (f *Fake) SetTopic() string

func (*Fake) Step

func (f *Fake) Step() int

func (*Fake) Update

func (f *Fake) Update(string) error

func (*Fake) UpdateInfo

func (f *Fake) UpdateInfo(*Info) []*InfoUpdate

func (*Fake) Value

func (f *Fake) Value() string

type Feature

type Feature interface {
	Name() string
	Min() int
	Max() int
	Step() int
	Exists() bool
	Set(string) error
	OnUpdate() (chan string, error)
	OnUpdateFunc(func(string)) error
	Update(string) error
	OnSet() (chan string, error)
	OnSetFunc(func(string)) error
	Value() string
	UpdateInfo(*Info) []*InfoUpdate
	GetTopic() string
	SetTopic() string

Feature represents a feature of a device

func New

func New(name string, info *Info, transport Transport) Feature

New creates a new feature with the specified name and info and embeds the transport over which it can be interacted with

type Info

type Info struct {
	Min      int    `json:"min,omitempty"`
	Max      int    `json:"max,omitempty"`
	Step     int    `json:"step,omitempty"`
	GetTopic string `json:"getTopic,omitempty"`
	SetTopic string `json:"setTopic,omitempty"`

Info holds information about a feature

type InfoUpdate

type InfoUpdate struct {
	Name string
	Old  string
	New  string

InfoUpdate represents an update to the feature's current info

type Transport

type Transport interface {
	SubscribeFeature(string) chan []byte
	UpdateFeature(*Info, []byte)
	SetFeature(*Info, []byte)

Transport is the feature's transport

type Type

type Type string

Type is the type of the feature

const (
	AccessoryFlags                        Type = "accessoryFlags"
	AccessoryIdentifier                   Type = "accessoryIdentifier"
	Active                                Type = "active"
	AdministratorOnlyAccess               Type = "administratorOnlyAccess"
	AirParticulateDensity                 Type = "airParticulateDensity"
	AirParticulateSize                    Type = "airParticulateSize"
	AirQuality                            Type = "airQuality"
	AppMatchingIdentifier                 Type = "appMatchingIdentifier"
	AudioFeedback                         Type = "audioFeedback"
	BatteryLevel                          Type = "batteryLevel"
	Brightness                            Type = "brightness"
	CarbonDioxideDetected                 Type = "carbonDioxideDetected"
	CarbonDioxideLevel                    Type = "carbonDioxideLevel"
	CarbonDioxidePeakLevel                Type = "carbonDioxidePeakLevel"
	CarbonMonoxideDetected                Type = "carbonMonoxideDetected"
	CarbonMonoxideLevel                   Type = "carbonMonoxideLevel"
	CarbonMonoxidePeakLevel               Type = "carbonMonoxidePeakLevel"
	Category                              Type = "category"
	ChargingState                         Type = "chargingState"
	ColorTemperature                      Type = "colorTemperature"
	ConfigureBridgedAccessory             Type = "configureBridgedAccessory"
	ConfigureBridgedAccessoryStatus       Type = "configureBridgedAccessoryStatus"
	ContactSensorState                    Type = "contactSensorState"
	CoolingThresholdTemperature           Type = "coolingThresholdTemperature"
	CurrentAirPurifierState               Type = "currentAirPurifierState"
	CurrentAmbientLightLevel              Type = "currentAmbientLightLevel"
	CurrentDoorState                      Type = "currentDoorState"
	CurrentFanState                       Type = "currentFanState"
	CurrentHeaterCoolerState              Type = "currentHeaterCoolerState"
	CurrentHeatingCoolingState            Type = "currentHeatingCoolingState"
	CurrentHorizontalTiltAngle            Type = "currentHorizontalTiltAngle"
	CurrentHumidifierDehumidifierState    Type = "currentHumidifierDehumidifierState"
	CurrentPosition                       Type = "currentPosition"
	CurrentRelativeHumidity               Type = "currentRelativeHumidity"
	CurrentSlatState                      Type = "currentSlatState"
	CurrentTemperature                    Type = "currentTemperature"
	CurrentTiltAngle                      Type = "currentTiltAngle"
	CurrentTime                           Type = "currentTime"
	CurrentVerticalTiltAngle              Type = "currentVerticalTiltAngle"
	DayOfTheWeek                          Type = "dayOfTheWeek"
	DigitalZoom                           Type = "digitalZoom"
	DiscoverBridgedAccessories            Type = "discoverBridgedAccessories"
	DiscoveredBridgedAccessories          Type = "discoveredBridgedAccessories"
	FilterChangeIndication                Type = "filterChangeIndication"
	FilterLifeLevel                       Type = "filterLifeLevel"
	FirmwareRevision                      Type = "firmwareRevision"
	HardwareRevision                      Type = "hardwareRevision"
	HeatingThresholdTemperature           Type = "heatingThresholdTemperature"
	HoldPosition                          Type = "holdPosition"
	Hue                                   Type = "hue"
	Identify                              Type = "identify"
	ImageMirroring                        Type = "imageMirroring"
	ImageRotation                         Type = "imageRotation"
	InUse                                 Type = "inUse"
	IsConfigured                          Type = "isConfigured"
	LeakDetected                          Type = "leakDetected"
	LinkQuality                           Type = "linkQuality"
	LockControlPoint                      Type = "lockControlPoint"
	LockCurrentState                      Type = "lockCurrentState"
	LockLastKnownAction                   Type = "lockLastKnownAction"
	LockManagementAutoSecurityTimeout     Type = "lockManagementAutoSecurityTimeout"
	LockPhysicalControls                  Type = "lockPhysicalControls"
	LockTargetState                       Type = "lockTargetState"
	Logs                                  Type = "logs"
	Manufacturer                          Type = "manufacturer"
	Model                                 Type = "model"
	MotionDetected                        Type = "motionDetected"
	Mute                                  Type = "mute"
	Name                                  Type = "name"
	NightVision                           Type = "nightVision"
	NitrogenDioxideDensity                Type = "nitrogenDioxideDensity"
	ObstructionDetected                   Type = "obstructionDetected"
	OccupancyDetected                     Type = "occupancyDetected"
	On                                    Type = "on"
	OpticalZoom                           Type = "opticalZoom"
	OutletInUse                           Type = "outletInUse"
	OzoneDensity                          Type = "ozoneDensity"
	PairSetup                             Type = "pairSetup"
	PairVerify                            Type = "pairVerify"
	PairingFeatures                       Type = "pairingFeatures"
	PairingPairings                       Type = "pairingPairings"
	PM10Density                           Type = "pm10Density"
	PM2_5Density                          Type = "pm2_5Density"
	PositionState                         Type = "positionState"
	ProgrammableSwitchEvent               Type = "programmableSwitchEvent"
	ProgrammableSwitchOutputState         Type = "programmableSwitchOutputState"
	ProgramMode                           Type = "programMode"
	Reachable                             Type = "reachable"
	RelativeHumidityDehumidifierThreshold Type = "relativeHumidityDehumidifierThreshold"
	RelativeHumidityHumidifierThreshold   Type = "relativeHumidityHumidifierThreshold"
	RemainingDuration                     Type = "remainingDuration"
	ResetFilterIndication                 Type = "resetFilterIndication"
	RotationDirection                     Type = "rotationDirection"
	RotationSpeed                         Type = "rotationSpeed"
	Saturation                            Type = "saturation"
	SecuritySystemAlarmType               Type = "securitySystemAlarmType"
	SecuritySystemCurrentState            Type = "securitySystemCurrentState"
	SecuritySystemTargetState             Type = "securitySystemTargetState"
	SelectedRTPStreamConfiguration        Type = "selectedRTPStreamConfiguration"
	SelectedStreamConfiguration           Type = "selectedStreamConfiguration"
	SerialNumber                          Type = "serialNumber"
	ServiceLabelIndex                     Type = "serviceLabelIndex"
	ServiceLabelNamespace                 Type = "serviceLabelNamespace"
	SetDuration                           Type = "setDuration"
	SetupEndpoints                        Type = "setupEndpoints"
	SlatType                              Type = "slatType"
	SmokeDetected                         Type = "smokeDetected"
	SoftwareRevision                      Type = "softwareRevision"
	StatusActive                          Type = "statusActive"
	StatusFault                           Type = "statusFault"
	StatusJammed                          Type = "statusJammed"
	StatusLowBattery                      Type = "statusLowBattery"
	StatusTampered                        Type = "statusTampered"
	StreamingStatus                       Type = "streamingStatus"
	SulphurDioxideDensity                 Type = "sulphurDioxideDensity"
	SupportedAudioStreamConfiguration     Type = "supportedAudioStreamConfiguration"
	SupportedRTPConfiguration             Type = "supportedRTPConfiguration"
	SupportedVideoStreamConfiguration     Type = "supportedVideoStreamConfiguration"
	SwingMode                             Type = "swingMode"
	TargetAirPurifierState                Type = "targetAirPurifierState"
	TargetAirQuality                      Type = "targetAirQuality"
	TargetDoorState                       Type = "targetDoorState"
	TargetFanState                        Type = "targetFanState"
	TargetHeaterCoolerState               Type = "targetHeaterCoolerState"
	TargetHeatingCoolingState             Type = "targetHeatingCoolingState"
	TargetHorizontalTiltAngle             Type = "targetHorizontalTiltAngle"
	TargetHumidifierDehumidifierState     Type = "targetHumidifierDehumidifierState"
	TargetPosition                        Type = "targetPosition"
	TargetRelativeHumidity                Type = "targetRelativeHumidity"
	TargetSlatState                       Type = "targetSlatState"
	TargetTemperature                     Type = "targetTemperature"
	TargetTiltAngle                       Type = "targetTiltAngle"
	TargetVerticalTiltAngle               Type = "targetVerticalTiltAngle"
	TemperatureDisplayUnits               Type = "temperatureDisplayUnits"
	TimeUpdate                            Type = "timeUpdate"
	TunnelConnectionTimeout               Type = "tunnelConnectionTimeout"
	TunneledAccessoryAdvertising          Type = "tunneledAccessoryAdvertising"
	TunneledAccessoryConnected            Type = "tunneledAccessoryConnected"
	TunneledAccessoryStateNumber          Type = "tunneledAccessoryStateNumber"
	ValveType                             Type = "valveType"
	Version                               Type = "version"
	VOCDensity                            Type = "vocDensity"
	Volume                                Type = "volume"
	WaterLevel                            Type = "waterLevel"

	CurrentPower   Type = "currentPower"
	CurrentVoltage Type = "currentVoltage"
	CurrentAmpere  Type = "currentAmpere"
	EnergyUsed     Type = "energyUsed"

All feature types

func (Type) Equal

func (t Type) Equal(y Type) bool

Equal checks if two types are equal

func (Type) String

func (t Type) String() string

String returns the string representation of the feature

Jump to

Keyboard shortcuts

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