Documentation ¶
Index ¶
- Constants
- type Accessory
- func (a *Accessory) IsAlive() bool
- func (a *Accessory) IsLight() bool
- func (a *Accessory) IsRemote() bool
- func (a *Accessory) LastSeenTime() time.Time
- func (a *Accessory) Light() *Light
- func (o *Accessory) Observe(callback ObservableCallback)
- func (o *Accessory) ObserveFilter(filter []ObserveFilter, callback ObservableCallback)
- func (o *Accessory) OnChange(change []*ObservedChange)
- func (a *Accessory) SetColor(c color.Color)
- func (a *Accessory) SetColorCold()
- func (a *Accessory) SetColorNormal()
- func (a *Accessory) SetColorTemp(c string)
- func (a *Accessory) SetColorWarm()
- func (a *Accessory) SetDim(dim int)
- func (a *Accessory) SetName(name string)
- func (a *Accessory) SetOn(on bool)
- type BaseType
- type DeviceInfo
- type DeviceType
- type Dimmable
- type DiscoverCallback
- type Gateway
- type Group
- func (g *Group) MarshalJSON() ([]byte, error)
- func (o *Group) Observe(callback ObservableCallback)
- func (o *Group) ObserveFilter(filter []ObserveFilter, callback ObservableCallback)
- func (o *Group) OnChange(change []*ObservedChange)
- func (g *Group) SetDim(dim int)
- func (g *Group) SetName(name string)
- func (g *Group) SetOn(on bool)
- func (g *Group) UnmarshalJSON(b []byte) error
- type Instance
- type Light
- type LightSetting
- func (l *LightSetting) GetColorName() string
- func (l *LightSetting) HasColorTemperature() bool
- func (l *LightSetting) SetColor(color color.Color)
- func (l *LightSetting) SetColorCold()
- func (l *LightSetting) SetColorNormal()
- func (l *LightSetting) SetColorTemp(c string)
- func (l *LightSetting) SetColorWarm()
- type Notification
- type NotificationEvent
- type ObservableCallback
- type ObservableTransport
- type ObserveFilter
- type ObservedChange
- type Plug
- type Scene
- type Sensor
- type Switch
- type Transport
- type Tree
- type UpdatePriority
- type YesNo
Constants ¶
View Source
const ( DeviceEndpoint = "15001" GroupEndpoint = "15004" SceneEndpoint = "15005" NotificationEndpoint = "15006" GatewayEndpoint = "15011/15012" )
View Source
const ( Cold = "f5faf6" Normal = "f1e0b5" Warm = "efd275" )
View Source
const ( TypeRemote DeviceType = 0 TypeLight DeviceType = 2 No YesNo = 0 Yes YesNo = 1 PrioNormal UpdatePriority = 0 PrioCritical UpdatePriority = 1 PrioRequired UpdatePriority = 2 PrioForced UpdatePriority = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accessory ¶
type Accessory struct { BaseType Type DeviceType `json:"5750,omitempty"` DeviceInfo *DeviceInfo `json:"3,omitempty"` Alive YesNo `json:"9019,omitempty"` LastSeen int64 `json:"9020,omitempty"` Lights []*Light `json:"3311,omitempty"` Plugs []*Plug `json:"3312,omitempty"` Sensors []*Sensor `json:"3300,omitempty"` Switches []*Switch `json:"15009,omitempty"` OTAUpdate YesNo `json:"9054,omitempty"` // contains filtered or unexported fields }
func (*Accessory) LastSeenTime ¶
func (*Accessory) Observe ¶
func (o *Accessory) Observe(callback ObservableCallback)
func (*Accessory) ObserveFilter ¶
func (o *Accessory) ObserveFilter(filter []ObserveFilter, callback ObservableCallback)
func (*Accessory) OnChange ¶
func (o *Accessory) OnChange(change []*ObservedChange)
func (*Accessory) SetColorCold ¶
func (a *Accessory) SetColorCold()
func (*Accessory) SetColorNormal ¶
func (a *Accessory) SetColorNormal()
func (*Accessory) SetColorTemp ¶
func (*Accessory) SetColorWarm ¶
func (a *Accessory) SetColorWarm()
type BaseType ¶
type BaseType struct { sync.RWMutex Name string `json:"9001,omitempty"` CreatedAt int64 `json:"9002,omitempty"` InstanceID int `json:"9003,omitempty"` // contains filtered or unexported fields }
func (*BaseType) CreateTime ¶
func (*BaseType) GetInstanceID ¶
type DeviceInfo ¶
type DeviceInfo struct { Manufacturer string `json:"0"` Model string `json:"1"` SerialNumber string `json:"2"` Firmware string `json:"3"` Power int `json:"6"` Battery int `json:"9"` }
func (*DeviceInfo) IsRGBModel ¶
func (d *DeviceInfo) IsRGBModel() bool
type DeviceType ¶
type DeviceType uint8
type Dimmable ¶
func (*Dimmable) DimPercent ¶
type DiscoverCallback ¶
type Gateway ¶
type Gateway struct { // NTPServer that the gateway uses NTPServer string `json:"9023"` // Version of trådfri gateway Version string `json:"9029"` // UpdateState is set to 1 if the gateway is currently // updating its firmware? UpdateState int `json:"9054"` // UpdateProgress seems to be a percentage UpdateProgress int `json:"9055"` // UpdateURL links to details regarding the update UpdateURL string `json:"9056"` // Current time of the gateway in unix timestamp format Timestamp int64 `json:"9059"` // TimestampUtc is the current time of the gateway in the format 2017-08-20T23:13:42.006000Z TimestampUtc string `json:"9060"` // CommissioningMode ? CommissioningMode int `json:"9061"` // UpdatePriority ? UpdatePriority UpdatePriority `json:"9066"` // UpdateAcceptedTimestamp UpdateAcceptedTimestamp int64 `json:"9069"` // TimeSource ? TimeSource int `json:"9071"` // ForceCheckOTAUpdate ? // ForceCheckOTAUpdate string `json:"9032"` // Name Name string `json:"9035"` // Field* are unknown fields exposed by the gateway. // Do not depend on the names staying the same Field9060 int `json:"9060"` Field9062 int `json:"9062"` Field9072 int `json:"9072"` Field9073 int `json:"9073"` Field9074 int `json:"9074"` Field9075 int `json:"9075"` Field9076 int `json:"9076"` Field9077 int `json:"9077"` Field9078 int `json:"9078"` Field9079 int `json:"9079"` Field9080 int `json:"9080"` Field9081 string `json:"9081"` // contains filtered or unexported fields }
func (*Gateway) Observe ¶
func (o *Gateway) Observe(callback ObservableCallback)
func (*Gateway) ObserveFilter ¶
func (o *Gateway) ObserveFilter(filter []ObserveFilter, callback ObservableCallback)
func (*Gateway) OnChange ¶
func (o *Gateway) OnChange(change []*ObservedChange)
type Group ¶
type Group struct { BaseType Dimmable Scene *int `json:"9039,omitempty"` Members []int `json:"9018,omitempty"` Scenes map[int]*Scene `json:"-"` // contains filtered or unexported fields }
func (*Group) MarshalJSON ¶
func (*Group) Observe ¶
func (o *Group) Observe(callback ObservableCallback)
func (*Group) ObserveFilter ¶
func (o *Group) ObserveFilter(filter []ObserveFilter, callback ObservableCallback)
func (*Group) OnChange ¶
func (o *Group) OnChange(change []*ObservedChange)
func (*Group) UnmarshalJSON ¶
type LightSetting ¶
type LightSetting struct { BaseType Dimmable Color string `json:"5706,omitempty"` ColorX int `json:"5709,omitempty"` ColorY int `json:"5710,omitempty"` Field5707 int `json:"5707,omitempty"` Field5708 int `json:"5708,omitempty"` Field5711 int `json:"5711,omitempty"` }
func (*LightSetting) GetColorName ¶
func (l *LightSetting) GetColorName() string
func (*LightSetting) HasColorTemperature ¶
func (l *LightSetting) HasColorTemperature() bool
func (*LightSetting) SetColor ¶
func (l *LightSetting) SetColor(color color.Color)
func (*LightSetting) SetColorCold ¶
func (l *LightSetting) SetColorCold()
func (*LightSetting) SetColorNormal ¶
func (l *LightSetting) SetColorNormal()
func (*LightSetting) SetColorTemp ¶
func (l *LightSetting) SetColorTemp(c string)
func (*LightSetting) SetColorWarm ¶
func (l *LightSetting) SetColorWarm()
type Notification ¶
type Notification struct { BaseType Event NotificationEvent `json:"9015,omitempty"` Details []string `json:"9017,omitempty"` State int `json:"9014"` }
func (*Notification) EventString ¶
func (n *Notification) EventString() string
type NotificationEvent ¶
type NotificationEvent int
const ( EventNewFirmwareAvailable NotificationEvent = 1001 EventGatewayReboot NotificationEvent = 1003 EventInternetUnreachable NotificationEvent = 5001 )
type ObservableCallback ¶
type ObservableCallback func(change []*ObservedChange)
type ObservableTransport ¶
type ObserveFilter ¶
type ObserveFilter func(observation *ObservedChange) bool
type ObservedChange ¶
type Scene ¶
type Scene struct { BaseType Index int `json:"9057,omitempty"` IsPredefined YesNo `json:"9068,omitempty"` IsActive YesNo `json:"9058,omitempty"` LightSettings []*LightSetting `json:"15013,omitempty"` UseCurrentLightSettings YesNo `json:"9070,omitempty"` // contains filtered or unexported fields }
func (*Scene) Observe ¶
func (o *Scene) Observe(callback ObservableCallback)
func (*Scene) ObserveFilter ¶
func (o *Scene) ObserveFilter(filter []ObserveFilter, callback ObservableCallback)
func (*Scene) OnChange ¶
func (o *Scene) OnChange(change []*ObservedChange)
type Tree ¶
type Tree struct { sync.RWMutex Devices map[int]*Accessory Groups map[int]*Group Notifications []*Notification Gateway *Gateway // contains filtered or unexported fields }
func (*Tree) AddCallback ¶
func (t *Tree) AddCallback(callback DiscoverCallback)
type UpdatePriority ¶
type UpdatePriority uint8
func (UpdatePriority) String ¶
func (u UpdatePriority) String() string
Click to show internal directories.
Click to hide internal directories.