properties

package
v0.0.0-...-bff5ac0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	On               = "on"
	Brightness       = "brightness"
	Hue              = "hue"
	ColorTemperature = "ct"
	ColorModel       = "color_mode"

	TypeString  = "string"
	TypeBoolean = "boolean"
	TypeInteger = "integer"
	TypeNumber  = "number"

	UnitHectopascal = "hectopascal"
	UnitKelvin      = "kelvin"
	UnitPercentage  = "percentage"
	UnitArcDegrees  = "arcdegrees"
	UnitCelsius     = "celsius"
	UnitLux         = "lux"
	UnitSeconds     = "seconds"
	UnitPPM         = "ppm"

	AlarmProperty              = "AlarmProperty"
	BarometricPressureProperty = "BarometricPressureProperty"
	//ColorProperty                    = "ColorProperty"
	//ColorTemperatureProperty         = "ColorTemperatureProperty"
	ConcentrationProperty            = "ConcentrationProperty"
	CurrentProperty                  = "CurrentProperty"
	DensityProperty                  = "DensityProperty"
	FrequencyProperty                = "FrequencyProperty"
	HeatingCoolingProperty           = "HeatingCoolingProperty"
	HumidityProperty                 = "HumidityProperty"
	ImageProperty                    = "ImageProperty"
	InstantaneousPowerFactorProperty = "InstantaneousPowerFactorProperty"
	InstantaneousPowerProperty       = "InstantaneousPowerProperty"
	LeakProperty                     = "LeakProperty"
	LevelProperty                    = "LevelProperty"
	LockedProperty                   = "LockedProperty"
	MotionProperty                   = "MotionProperty"

	OpenProperty              = "OpenProperty"
	PushedProperty            = "PushedProperty"
	SmokeProperty             = "SmokeProperty"
	TargetTemperatureProperty = "TargetTemperatureProperty"
	TemperatureProperty       = "TemperatureProperty"
	ThermostatModeProperty    = "ThermostatModeProperty"
	VideoProperty             = "VideoProperty"
	VoltageProperty           = "VoltageProperty"
)
View Source
const TypeBrightnessProperty = "BrightnessProperty"
View Source
const TypeColorModeProperty = "ColorModeProperty"
View Source
const TypeColorProperty = "ColorProperty"
View Source
const TypeColorTemperatureProperty = "ColorTemperatureProperty"
View Source
const TypeOnOffProperty = "OnOffProperty"

Variables

This section is empty.

Functions

This section is empty.

Types

type BooleanProperty

type BooleanProperty struct {
	*Property
}

func NewBooleanProperty

func NewBooleanProperty(typ string) *BooleanProperty

func (*BooleanProperty) GetValue

func (prop *BooleanProperty) GetValue() bool

GetValue returns the value as bool

func (*BooleanProperty) OnValueRemoteGet

func (prop *BooleanProperty) OnValueRemoteGet(fn func() bool)

OnValueRemoteGet calls fn when the value was read by a client.

func (*BooleanProperty) OnValueRemoteUpdate

func (prop *BooleanProperty) OnValueRemoteUpdate(fn func(bool))

OnValueRemoteUpdate calls fn when the value was updated by a client.

func (*BooleanProperty) SetBooleanValue

func (prop *BooleanProperty) SetBooleanValue(value bool)

SetValue sets a value

type BrightnessProperty

type BrightnessProperty struct {
	*IntegerProperty
}

func NewBrightnessProperty

func NewBrightnessProperty() *BrightnessProperty

type ColorModeProperty

type ColorModeProperty struct {
	*StringProperty
}

func NewColorModeProperty

func NewColorModeProperty() *ColorModeProperty

type ColorProperty

type ColorProperty struct {
	*StringProperty
}

func NewColorProperty

func NewColorProperty() *ColorProperty

type ColorTemperatureProperty

type ColorTemperatureProperty struct {
	*IntegerProperty
}

func NewColorTemperatureProperty

func NewColorTemperatureProperty() *ColorTemperatureProperty

type IntegerProperty

type IntegerProperty struct {
	*Property
}

func NewIntegerProperty

func NewIntegerProperty(typ string) *IntegerProperty

func (*IntegerProperty) GetValue

func (prop *IntegerProperty) GetValue() int

GetValue returns the value as bool

func (*IntegerProperty) OnValueRemoteGet

func (prop *IntegerProperty) OnValueRemoteGet(fn func() int)

OnValueRemoteGet calls fn when the value was read by a client.

func (*IntegerProperty) OnValueRemoteUpdate

func (prop *IntegerProperty) OnValueRemoteUpdate(fn func(int))

OnValueRemoteUpdate calls fn when the value was updated by a client.

func (*IntegerProperty) SetCachedValueAndNotify

func (prop *IntegerProperty) SetCachedValueAndNotify(value int)

SetValue sets a value

func (*IntegerProperty) SetMaxValue

func (prop *IntegerProperty) SetMaxValue(v int64)

func (*IntegerProperty) SetMinValue

func (prop *IntegerProperty) SetMinValue(v int64)

type NumberProperty

type NumberProperty struct {
	*Property
}

func NewNumberProperty

func NewNumberProperty(typ string) *NumberProperty

func (*NumberProperty) GetValue

func (prop *NumberProperty) GetValue() float64

GetValue returns the value as bool

func (*NumberProperty) OnValueRemoteGet

func (prop *NumberProperty) OnValueRemoteGet(fn func() float64)

OnValueRemoteGet calls fn when the value was read by a client.

func (*NumberProperty) OnValueRemoteUpdate

func (prop *NumberProperty) OnValueRemoteUpdate(fn func(float64))

OnValueRemoteUpdate calls fn when the value was updated by a client.

func (*NumberProperty) SetValue

func (prop *NumberProperty) SetValue(value float64)

SetValue sets a value

type OnOffProperty

type OnOffProperty struct {
	*BooleanProperty
}

func NewOnOffProperty

func NewOnOffProperty() *OnOffProperty

type Property

type Property struct {
	Name        string        `json:"name"`
	Title       string        `json:"title,omitempty"`
	Type        string        `json:"type"`
	AtType      string        `json:"@type,omitempty"`
	Unit        string        `json:"unit,omitempty"`
	Description string        `json:"description,omitempty"`
	Minimum     interface{}   `json:"minimum,omitempty"`
	Maximum     interface{}   `json:"maximum,omitempty"`
	Enum        []interface{} `json:"enum,omitempty"`
	ReadOnly    bool          `json:"readOnly"`
	MultipleOf  interface{}   `json:"multipleOf,omitempty"`
	Links       []*rpc.Link   `json:"links"`
	Value       interface{}   `json:"value"`
}

func NerPropertyFormString

func NerPropertyFormString(s string) *Property

func NewPropertyFormMessage

func NewPropertyFormMessage(p *rpc.Property) *Property

func (*Property) GetAtType

func (p *Property) GetAtType() string

func (*Property) GetDescription

func (p *Property) GetDescription() string

func (*Property) GetForms

func (p *Property) GetForms() []*rpc.Link

func (*Property) GetMaximum

func (p *Property) GetMaximum() interface{}

func (*Property) GetMinimum

func (p *Property) GetMinimum() interface{}

func (*Property) GetMultipleOf

func (p *Property) GetMultipleOf() interface{}

func (*Property) GetName

func (p *Property) GetName() string

func (*Property) GetTitle

func (p *Property) GetTitle() string

func (*Property) GetType

func (p *Property) GetType() string

func (*Property) GetUnit

func (p *Property) GetUnit() string

func (*Property) GetValue

func (p *Property) GetValue() interface{}

func (*Property) IsReadOnly

func (p *Property) IsReadOnly() bool

type StringProperty

type StringProperty struct {
	*Property
}

func NewStringProperty

func NewStringProperty(typ string) *StringProperty

func (*StringProperty) GetValue

func (prop *StringProperty) GetValue() string

GetValue returns the value as bool

func (*StringProperty) OnValueRemoteGet

func (prop *StringProperty) OnValueRemoteGet(fn func() string)

OnValueRemoteGet calls fn when the value was read by a client.

func (*StringProperty) OnValueRemoteUpdate

func (prop *StringProperty) OnValueRemoteUpdate(fn func(string))

OnValueRemoteUpdate calls fn when the value was updated by a client.

func (*StringProperty) SetValue

func (prop *StringProperty) SetValue(value string)

SetValue sets a value

Jump to

Keyboard shortcuts

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