Documentation
¶
Index ¶
- func Discover() ([]string, error)
- func PSK(address, id, code string) ([]byte, error)
- type DeviceInfo
- type DeviceSettings
- type DeviceType
- type DiscoveryInfo
- type GatewayInfo
- type GroupInfo
- type LightSettings
- type OutletSettings
- type PowerSource
- type SceneInfo
- type SpeakerSettings
- type SwitchSettings
- type Tradfri
- func (t *Tradfri) Close()
- func (t *Tradfri) Device(deviceID int) (*DeviceInfo, error)
- func (t *Tradfri) Devices() ([]int, error)
- func (t *Tradfri) GetAsJson(path string, out interface{}) error
- func (t *Tradfri) Group(groupID int) (*GroupInfo, error)
- func (t *Tradfri) Groups() ([]int, error)
- func (t *Tradfri) Info() (*GatewayInfo, error)
- func (t *Tradfri) MessageID() uint16
- func (t *Tradfri) PutJsonChange(path string, data interface{}) error
- func (t *Tradfri) RoundTrip(request coap.Message) (*coap.Message, error)
- func (t *Tradfri) Scene(groupID, sceneID int) (*SceneInfo, error)
- func (t *Tradfri) Scenes(groupID int) ([]int, error)
- func (t *Tradfri) UpdateDevice(deviceID int, settings DeviceSettings) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeviceInfo ¶
type DeviceInfo struct {
ID int `json:"9003"` // Device ID
Name string `json:"9001"` // Device Name
Type DeviceType `json:"5750"` // Application Type
Metadata struct {
Manufacturer string `json:"0"`
Model string `json:"1"`
Serial string `json:"2"`
Firmware string `json:"3"`
PowerSource PowerSource `json:"6"`
} `json:"3"`
Speaker *struct {
Devices []string `json:"9115"`
} `json:"15017"`
LightSettings []LightSettings `json:"3311"`
OutletSettings []OutletSettings `json:"3312"`
SwitchSettings []SwitchSettings `json:"15009"`
SpeakerSettings []SpeakerSettings `json:"15018"`
EpochCreated int64 `json:"9002"`
EpochUpdated int64 `json:"9020"`
}
func (*DeviceInfo) CreatedAt ¶
func (d *DeviceInfo) CreatedAt() time.Time
func (*DeviceInfo) UpdatedAt ¶
func (d *DeviceInfo) UpdatedAt() time.Time
type DeviceSettings ¶
type DeviceSettings struct {
LightSettings []LightSettings `json:"3311,omitempty"`
OutletSettings []OutletSettings `json:"3312,omitempty"`
}
type DeviceType ¶
type DeviceType int
const DeviceTypeBulb DeviceType = 2
const DeviceTypeControlOutlet DeviceType = 3
const DeviceTypeSoundRemote DeviceType = 8
const DeviceTypeSwitch DeviceType = 0
type DiscoveryInfo ¶
type GatewayInfo ¶
type GatewayInfo struct {
ID string `json:"9081"`
Firmware string `json:"9029"`
Time time.Time `json:"9060"`
TimeServer string `json:"9023"`
EpochNow int64 `json:"9059"`
EpochCreated int64 `json:"9069"`
}
func (*GatewayInfo) CreatedAt ¶
func (g *GatewayInfo) CreatedAt() time.Time
func (*GatewayInfo) Now ¶
func (g *GatewayInfo) Now() time.Time
type GroupInfo ¶
type LightSettings ¶
type LightSettings struct {
Power *int `json:"5850,omitempty"`
Dimmer *int `json:"5851,omitempty"`
ColorHue *int `json:"5707,omitempty"`
ColorSaturation *int `json:"5708,omitempty"`
ColorX *int `json:"5709,omitempty"`
ColorY *int `json:"5710,omitempty"`
Color *string `json:"5706,omitempty"`
//ColorTemperature *int `json:"5711,omitempty"`
Duration *int `json:"5712,omitempty"`
Device *int `json:"9003,omitempty"`
}
type OutletSettings ¶
type PowerSource ¶
type PowerSource int
const PowerSourceAC PowerSource = 6
const PowerSourceBattery PowerSource = 3
const PowerSourceBatteryExternal PowerSource = 2
const PowerSourceBatteryInternal PowerSource = 1
const PowerSourceDC PowerSource = 0
const PowerSourceEthernet PowerSource = 4
const PowerSourceSolar PowerSource = 7
const PowerSourceUSB PowerSource = 5
type SceneInfo ¶
type SceneInfo struct {
ID int `json:"9003"` // Group ID
Name string `json:"9001"` // Group Name
EpochCreated int64 `json:"9002"`
LightSettings []LightSettings `json:"15013"`
}
type SpeakerSettings ¶
type SpeakerSettings struct {
Device *int `json:"9003,omitempty"`
}
type SwitchSettings ¶
type SwitchSettings struct {
Device *int `json:"9003,omitempty"`
}
type Tradfri ¶
type Tradfri struct {
// contains filtered or unexported fields
}
func (*Tradfri) Info ¶
func (t *Tradfri) Info() (*GatewayInfo, error)
func (*Tradfri) PutJsonChange ¶
func (*Tradfri) UpdateDevice ¶
func (t *Tradfri) UpdateDevice(deviceID int, settings DeviceSettings) error
Click to show internal directories.
Click to hide internal directories.