Documentation
¶
Index ¶
- Constants
- type Boolean
- type BooleanEntity
- type BooleanProperty
- type BooleanPropertyDescription
- type BrightnessProperty
- type ColorModeProperty
- type ColorModePropertyEnum
- type ColorProperty
- type ColorTemperatureProperty
- type ColorTemperaturePropertyDescriptor
- type CurrentProperty
- type DeviceHandler
- type Entity
- type FrequencyProperty
- type HSL
- type HeatingCoolingProperty
- type InstantaneousPowerFactorProperty
- type InstantaneousPowerProperty
- func NewCurrentProperty(value Number, opts ...Option) *InstantaneousPowerProperty
- func NewFrequencyProperty(value Number, opts ...Option) *InstantaneousPowerProperty
- func NewInstantaneousPowerFactorProperty(value Number, opts ...Option) *InstantaneousPowerProperty
- func NewInstantaneousPowerProperty(value Number, opts ...Option) *InstantaneousPowerProperty
- func NewVoltageProperty(value Number, opts ...Option) *InstantaneousPowerProperty
- type Integer
- type IntegerEntity
- type IntegerProperty
- type IntegerPropertyDescription
- type LeakProperty
- type LevelProperty
- type MotionProperty
- type Number
- type NumberEntity
- type NumberProperty
- type NumberPropertyDescription
- type OnOff
- type OnOffProperty
- type OpenProperty
- type Option
- type Property
- func (p *Property) GetAtType() PropertyType
- func (p *Property) GetCachedValue() any
- func (p *Property) GetDescription() string
- func (p *Property) GetDevice() DeviceHandler
- func (p *Property) GetEnum() []any
- func (p *Property) GetMaximum() any
- func (p *Property) GetMinimum() any
- func (p *Property) GetMultipleOf() any
- func (p *Property) GetName() string
- func (p *Property) GetProperty() *Property
- func (p *Property) GetTitle() string
- func (p *Property) GetType() string
- func (p *Property) GetUnit() string
- func (p *Property) IsReadOnly() bool
- func (p Property) MarshalJSON() ([]byte, error)
- func (p *Property) NotifyChanged()
- func (p *Property) SetCachedValue(value any) bool
- func (p *Property) SetCachedValueAndNotify(value any)
- func (p *Property) SetDescription(d string) bool
- func (p *Property) SetHandler(h DeviceHandler)
- func (p *Property) SetPropertyValue(value any) error
- func (p *Property) SetTitle(t string) bool
- func (p *Property) ToDescription() PropertyDescription
- func (p *Property) ToMessage() messages.Property
- type PropertyDescription
- type PropertyLinkElem
- type PropertyType
- type RGB
- type SmokeProperty
- type StringEntity
- type StringProperty
- type StringPropertyDescription
- type TargetTemperatureProperty
- type TemperatureProperty
- type ThermostatModeEnum
- type ThermostatModeProperty
- type Type
- type Unit
- type VoltageProperty
Constants ¶
View Source
const ( Brightness = "brightness" Hue = "hue" ColorTemperature = "ct" ColorModel = "color_mode" TypeString Type = "string" TypeBoolean Type = "boolean" TypeInteger Type = "integer" TypeNumber Type = "number" UnitHectopascal Unit = "hectopascal" UnitKelvin Unit = "kelvin" UnitPercentage Unit = "percentage" UnitPercent Unit = "percent" UnitWatt Unit = "watt" UnitHertz Unit = "hertz" UnitVolt Unit = "volt" UnitArcDegrees Unit = "arcdegrees" UnitDegreeCelsius Unit = "degree celsius" UnitAmpere Unit = "ampere" UnitCelsius Unit = "celsius" UnitLux Unit = "lux" UnitSeconds Unit = "seconds" UnitPPM Unit = "ppm" TypeAlarmProperty PropertyType = "AlarmProperty" TypeBarometricPressureProperty PropertyType = "BarometricPressureProperty" TypeBooleanProperty PropertyType = "BooleanProperty" TypeBrightnessProperty PropertyType = "BrightnessProperty" TypeColorModeProperty PropertyType = "ColorModeProperty" TypeColorProperty PropertyType = "ColorProperty" TypeColorTemperatureProperty PropertyType = "ColorTemperatureProperty" TypeConcentrationProperty PropertyType = "ConcentrationProperty" TypeCurrentProperty PropertyType = "CurrentProperty" TypeDensityProperty PropertyType = "DensityProperty" TypeFrequencyProperty PropertyType = "FrequencyProperty" TypeHeatingCoolingProperty PropertyType = "HeatingCoolingProperty" TypeHumidityProperty PropertyType = "HumidityProperty" TypeImageProperty PropertyType = "ImageProperty" TypeInstantaneousPowerFactorProperty PropertyType = "InstantaneousPowerFactorProperty" TypeInstantaneousPowerProperty PropertyType = "InstantaneousPowerProperty" TypeLeakProperty PropertyType = "LeakProperty" TypeLevelProperty PropertyType = "LevelProperty" TypeLockedProperty PropertyType = "LockedProperty" TypeMotionProperty PropertyType = "MotionProperty" TypeOnOffProperty PropertyType = "OnOffProperty" TypeOpenProperty PropertyType = "OpenProperty" TypePushedProperty PropertyType = "PushedProperty" TypeSmokeProperty PropertyType = "SmokeProperty" TypeTargetTemperatureProperty PropertyType = "TargetTemperatureProperty" TypeTemperatureProperty PropertyType = "TemperatureProperty" TypeThermostatModeProperty PropertyType = "ThermostatModeProperty" TypeVideoProperty PropertyType = "VideoProperty" TypeVoltageProperty PropertyType = "VoltageProperty" )
View Source
const ColorModePropertyEnumColor = "color"
View Source
const ColorModePropertyEnumTemperature = "temperature"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Boolean ¶
type Boolean struct {
*Property
}
func NewBoolean ¶
func NewBoolean(description BooleanPropertyDescription, opts ...Option) *Boolean
func (*Boolean) CheckValue ¶
func (*Boolean) OnValueRemoteGet ¶
OnValueRemoteGet calls fn when the value was read by a client.
func (*Boolean) OnValueRemoteUpdate ¶
OnValueRemoteUpdate calls fn when the value was updated by a client.
type BooleanEntity ¶
type BooleanProperty ¶
type BooleanProperty struct {
*Boolean
}
func NewBooleanProperty ¶
func NewBooleanProperty(value bool, args ...string) *BooleanProperty
type BrightnessProperty ¶
type BrightnessProperty struct {
*IntegerProperty
}
func NewBrightnessProperty ¶
func NewBrightnessProperty(value Integer, opts ...Option) *BrightnessProperty
type ColorModeProperty ¶
type ColorModeProperty struct {
*StringProperty
}
func NewColorModeProperty ¶
func NewColorModeProperty(value ColorModePropertyEnum, opts ...Option) *ColorModeProperty
type ColorModePropertyEnum ¶
type ColorModePropertyEnum = string
type ColorProperty ¶
type ColorProperty struct {
*StringProperty
}
func NewColorProperty ¶
func NewColorProperty(value string, opts ...Option) *ColorProperty
func (*ColorProperty) SetValue ¶
func (c *ColorProperty) SetValue(v string)
type ColorTemperatureProperty ¶
type ColorTemperatureProperty struct {
*IntegerProperty
}
func NewColorTemperatureProperty ¶
func NewColorTemperatureProperty(value Integer, opts ...Option) *ColorTemperatureProperty
type CurrentProperty ¶
type CurrentProperty struct {
*NumberProperty
}
type DeviceHandler ¶
type DeviceHandler interface { GetId() string NotifyPropertyChanged(property PropertyDescription) }
type Entity ¶
type Entity interface { MarshalJSON() ([]byte, error) GetProperty() *Property GetType() Type GetTitle() string GetName() string GetUnit() string GetEnum() []any GetAtType() PropertyType GetDescription() string GetMinimum() any GetMaximum() any GetMultipleOf() any IsReadOnly() bool ToMessage() messages.Property ToDescription() PropertyDescription SetCachedValue(value any) bool SetCachedValueAndNotify(value any) SetTitle(s string) bool SetDescription(description string) bool SetHandler(d DeviceHandler) GetDevice() DeviceHandler NotifyChanged() GetCachedValue() any SetPropertyValue(value any) error }
type FrequencyProperty ¶
type FrequencyProperty struct {
*NumberProperty
}
type HeatingCoolingProperty ¶
type HeatingCoolingProperty struct {
*StringProperty
}
func NewHeatingCoolingProperty ¶
func NewHeatingCoolingProperty(value ThermostatModeEnum, opts ...Option) *HeatingCoolingProperty
type InstantaneousPowerFactorProperty ¶
type InstantaneousPowerFactorProperty struct {
*NumberProperty
}
type InstantaneousPowerProperty ¶
type InstantaneousPowerProperty struct {
*NumberProperty
}
func NewCurrentProperty ¶
func NewCurrentProperty(value Number, opts ...Option) *InstantaneousPowerProperty
func NewFrequencyProperty ¶
func NewFrequencyProperty(value Number, opts ...Option) *InstantaneousPowerProperty
func NewInstantaneousPowerFactorProperty ¶
func NewInstantaneousPowerFactorProperty(value Number, opts ...Option) *InstantaneousPowerProperty
func NewInstantaneousPowerProperty ¶
func NewInstantaneousPowerProperty(value Number, opts ...Option) *InstantaneousPowerProperty
func NewVoltageProperty ¶
func NewVoltageProperty(value Number, opts ...Option) *InstantaneousPowerProperty
type IntegerEntity ¶
type IntegerProperty ¶
type IntegerProperty struct {
*Property
}
func NewIntegerProperty ¶
func NewIntegerProperty(desc IntegerPropertyDescription, opts ...Option) *IntegerProperty
func (*IntegerProperty) CheckValue ¶
func (prop *IntegerProperty) CheckValue(v any) Integer
func (*IntegerProperty) GetValue ¶
func (prop *IntegerProperty) GetValue() Integer
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) SetValue ¶
func (prop *IntegerProperty) SetValue(v Integer) error
type IntegerPropertyDescription ¶
type IntegerPropertyDescription struct { Name string `json:"name,omitempty"` AtType string `json:"@type,omitempty"` Minimum Integer `json:"minimum,omitempty"` Maximum Integer `json:"maximum,omitempty"` Unit Unit `json:"unit"` Title string `json:"title,omitempty"` Enum []Integer `json:"enum,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` MultipleOf any `json:"multipleOf,omitempty"` Links []PropertyLinkElem `json:"links,omitempty"` Value Integer `json:"value,omitempty"` }
type LeakProperty ¶
type LeakProperty struct {
*Boolean
}
func NewLeakProperty ¶
func NewLeakProperty(value bool, opts ...Option) *LeakProperty
type LevelProperty ¶
type LevelProperty struct {
*NumberProperty
}
func NewLevelProperty ¶
func NewLevelProperty(value Number, min, max Number, opts ...Option) *LevelProperty
type MotionProperty ¶
type MotionProperty struct {
*Boolean
}
func NewMotionProperty ¶
func NewMotionProperty(value bool, opts ...Option) *MotionProperty
func NewOpenProperty ¶
func NewOpenProperty(value bool, opts ...Option) *MotionProperty
type NumberEntity ¶
type NumberProperty ¶
type NumberProperty struct {
*Property
}
func NewNumberProperty ¶
func NewNumberProperty(desc NumberPropertyDescription, opts ...Option) *NumberProperty
func (*NumberProperty) CheckValue ¶
func (prop *NumberProperty) CheckValue(v any) Number
func (*NumberProperty) GetValue ¶
func (prop *NumberProperty) GetValue() Number
func (*NumberProperty) SetValue ¶
func (prop *NumberProperty) SetValue(v Number) error
type NumberPropertyDescription ¶
type NumberPropertyDescription struct { Name string `json:"name,omitempty"` AtType PropertyType `json:"@type,omitempty"` Minimum any `json:"minimum,omitempty"` Maximum any `json:"maximum,omitempty"` Enum []Number `json:"enum,omitempty"` Title string `json:"title,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` MultipleOf any `json:"multipleOf,omitempty"` Unit string `json:"unit,omitempty"` Value Number `json:"value,omitempty"` }
type OnOff ¶
type OnOff interface { BooleanEntity }
type OnOffProperty ¶
type OnOffProperty struct {
*Boolean
}
func NewOnOffProperty ¶
func NewOnOffProperty(value bool, opts ...Option) *OnOffProperty
type OpenProperty ¶
type OpenProperty struct {
*Boolean
}
type Option ¶
type Option func(p *Property)
func WithDescription ¶
func WithReadOnly ¶
func WithReadOnly() Option
type Property ¶
type Property struct { Name string `json:"name"` Title string `json:"title,omitempty"` Type Type `json:"type"` AtType PropertyType `json:"@type,omitempty"` Unit Unit `json:"unit,omitempty"` Description string `json:"description,omitempty"` Minimum any `json:"minimum,omitempty"` Maximum any `json:"maximum,omitempty"` Enum []any `json:"enum,omitempty"` ReadOnly bool `json:"readOnly"` MultipleOf any `json:"multipleOf,omitempty"` Value any `json:"value"` // contains filtered or unexported fields }
func NewProperty ¶
func NewProperty(des PropertyDescription, opts ...Option) *Property
func (*Property) GetAtType ¶
func (p *Property) GetAtType() PropertyType
func (*Property) GetCachedValue ¶
func (*Property) GetDescription ¶
func (*Property) GetDevice ¶
func (p *Property) GetDevice() DeviceHandler
func (*Property) GetMaximum ¶
func (*Property) GetMinimum ¶
func (*Property) GetMultipleOf ¶
func (*Property) GetProperty ¶
func (*Property) IsReadOnly ¶
func (Property) MarshalJSON ¶
func (*Property) NotifyChanged ¶
func (p *Property) NotifyChanged()
func (*Property) SetCachedValue ¶
func (*Property) SetCachedValueAndNotify ¶
func (*Property) SetDescription ¶
func (*Property) SetHandler ¶
func (p *Property) SetHandler(h DeviceHandler)
func (*Property) SetPropertyValue ¶
func (*Property) ToDescription ¶
func (p *Property) ToDescription() PropertyDescription
type PropertyDescription ¶
type PropertyDescription struct { Name string `json:"name,omitempty"` AtType string `json:"@type,omitempty"` Title string `json:"title,omitempty"` Type string `json:"type,omitempty"` Unit string `json:"unit,omitempty"` Description string `json:"description,omitempty"` Minimum any `json:"minimum,omitempty"` Maximum any `json:"maximum,omitempty"` Enum []any `json:"enum,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` MultipleOf any `json:"multipleOf,omitempty"` Links []PropertyLinkElem `json:"links,omitempty"` Value any `json:"value,omitempty"` }
type PropertyLinkElem ¶
type PropertyLinkElem struct { }
type PropertyType ¶
type PropertyType = string
type RGB ¶
type RGB struct {
R, G, B float64
}
type SmokeProperty ¶
type SmokeProperty struct {
*Boolean
}
func NewSmokeProperty ¶
func NewSmokeProperty(value bool, opts ...Option) *SmokeProperty
type StringEntity ¶
type StringProperty ¶
type StringProperty struct {
*Property
}
func NewStringProperty ¶
func NewStringProperty(desc StringPropertyDescription, opts ...Option) *StringProperty
func (*StringProperty) CheckValue ¶
func (prop *StringProperty) CheckValue(v any) string
func (*StringProperty) GetValue ¶
func (prop *StringProperty) GetValue() string
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(v string) error
SetValue sets a value
type TargetTemperatureProperty ¶
type TargetTemperatureProperty struct {
*NumberProperty
}
func NewTargetTemperatureProperty ¶
func NewTargetTemperatureProperty(value Number, opts ...Option) *TargetTemperatureProperty
type TemperatureProperty ¶
type TemperatureProperty struct {
*NumberProperty
}
func NewTemperatureProperty ¶
func NewTemperatureProperty(value Number, opts ...Option) *TemperatureProperty
type ThermostatModeEnum ¶
type ThermostatModeEnum string
var ThermostatAuto ThermostatModeEnum = "auto"
var ThermostatCool ThermostatModeEnum = "cool"
var ThermostatDry ThermostatModeEnum = "dry"
var ThermostatHeat ThermostatModeEnum = "heat"
var ThermostatOff ThermostatModeEnum = "off"
var ThermostatWind ThermostatModeEnum = "wind"
type ThermostatModeProperty ¶
type ThermostatModeProperty struct {
*StringProperty
}
func NewThermostatModeProperty ¶
func NewThermostatModeProperty(value ThermostatModeEnum, opts ...Option) *ThermostatModeProperty
type VoltageProperty ¶
type VoltageProperty struct {
*NumberProperty
}
Source Files
¶
- boolean.go
- boolean_property.go
- brightness_property.go
- color_mode_property.go
- color_property.go
- color_temperature_property.go
- constant.go
- current_property.go
- frequency_property.go
- heating_cooling_property.go
- instantaneous_power_factorProperty.go
- instantaneous_power_property.go
- integer.go
- leak_property.go
- level_property.go
- motion_property.go
- number.go
- on_off_property.go
- open_property.go
- property.go
- smoke_property.go
- string.go
- target_temperature_property.go
- temperature_property.go
- thermostat_mode_property.go
- voltage_property.go
Click to show internal directories.
Click to hide internal directories.