Index | Files

package feature

import ""

Package feature defines the basic requirements of a feature


Package Files

doc.go fake.go feature.go types.go

type Fake Uses

type Fake struct {
    Err         error
    FeatureName string

func (*Fake) Exists Uses

func (f *Fake) Exists() bool

func (*Fake) GetTopic Uses

func (f *Fake) GetTopic() string

func (*Fake) Max Uses

func (f *Fake) Max() int

func (*Fake) Min Uses

func (f *Fake) Min() int

func (*Fake) Name Uses

func (f *Fake) Name() string

func (*Fake) OnSet Uses

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

func (*Fake) OnSetFunc Uses

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

func (*Fake) OnUpdate Uses

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

func (*Fake) OnUpdateFunc Uses

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

func (*Fake) Set Uses

func (f *Fake) Set(string) error

func (*Fake) SetTopic Uses

func (f *Fake) SetTopic() string

func (*Fake) Step Uses

func (f *Fake) Step() int

func (*Fake) Update Uses

func (f *Fake) Update(string) error

func (*Fake) UpdateInfo Uses

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

func (*Fake) Value Uses

func (f *Fake) Value() string

type Feature Uses

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 Uses

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 Uses

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 Uses

type InfoUpdate struct {
    Name string
    Old  string
    New  string

InfoUpdate represents an update to the feature's current info

type Transport Uses

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

Transport is the feature's transport

type Type Uses

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 Uses

func (t Type) Equal(y Type) bool

Equal checks if two types are equal

func (Type) String Uses

func (t Type) String() string

String returns the string representation of the feature

Package feature imports 3 packages (graph) and is imported by 5 packages. Updated 2019-05-05. Refresh now. Tools for package owners.