Documentation ¶
Index ¶
- Constants
- type Client
- func (tc *Client) AuthExchange(clientID string) (model.TokenExchange, error)
- func (tc *Client) Call(msg coap.Message) (coap.Message, error)
- func (tc *Client) Get(id string) (coap.Message, error)
- func (tc *Client) GetDevice(deviceID string) (model.Device, error)
- func (tc *Client) GetGroup(groupID string) (model.Group, error)
- func (tc *Client) ListDeviceIds() ([]int, error)
- func (tc *Client) ListDevices() ([]model.Device, error)
- func (tc *Client) ListGroups() ([]model.Group, error)
- func (tc *Client) Put(id string, payload string) (coap.Message, error)
- func (tc *Client) PutDeviceColorHSL(deviceID string, hue float64, saturation float64, lightness float64) (model.Result, error)
- func (tc *Client) PutDeviceColorHSLTimed(deviceID string, hue float64, saturation float64, lightness float64, ...) (model.Result, error)
- func (tc *Client) PutDeviceDimming(deviceID string, dimming int) (model.Result, error)
- func (tc *Client) PutDevicePositioning(deviceID string, positioning float32) (model.Result, error)
- func (tc *Client) PutDevicePower(deviceID string, power bool) (model.Result, error)
- func (tc *Client) PutDeviceState(deviceID string, power bool, dimmer int) (model.Result, error)
- type DevicePlatform
- func (tdp DevicePlatform) AddAccessory(a *tfaccessory.TFAccessory)
- func (tdp DevicePlatform) Background()
- func (tdp DevicePlatform) GetAccessory(name string) (*tfaccessory.TFAccessory, bool)
- func (tdp DevicePlatform) Shutdown() platform.Control
- func (tdp DevicePlatform) Startup(c *config.Config) platform.Control
- type Platform
Constants ¶
const ( DeviceTypeRemote = iota DeviceTypeSlaveRemote DeviceTypeLightbulb DeviceTypePlug DeviceTypeMotionSensor DeviceTypeSignalRepeater DeviceTypeBlind DeviceTypeSoundRemote )
most of this is stolen shamelessly from eriklupander/tradfri-go/tradfri and adjusted for my needs
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a declarative API for sending CoAP messages to the gateway over DTLS.
func NewTradfriClient ¶
NewTradfriClient creates a new instance of Client, including initiating the DTLS client.
func (*Client) AuthExchange ¶
func (tc *Client) AuthExchange(clientID string) (model.TokenExchange, error)
AuthExchange performs the initial PSK exchange. see ref: https://community.openhab.org/t/ikea-tradfri-gateway/26135/148?u=kai
func (*Client) ListDeviceIds ¶
ListDeviceIds gives you a list of all connected device id's
func (*Client) ListDevices ¶
ListDevices gives you a list of all devices
func (*Client) ListGroups ¶
ListGroups lists all groups
func (*Client) PutDeviceColorHSL ¶
func (tc *Client) PutDeviceColorHSL(deviceID string, hue float64, saturation float64, lightness float64) (model.Result, error)
PutDeviceColorHSL sets the color of the bulb using the HSL color notation This is more effictive than RGB because RGB is always at full brightness, ("000000" is the same as "ffffff")
func (*Client) PutDeviceColorHSLTimed ¶
func (tc *Client) PutDeviceColorHSLTimed(deviceID string, hue float64, saturation float64, lightness float64, transitionTimeMS int) (model.Result, error)
PutDeviceColorHSLTimed does the same as PutDeviceColorHSL but it gives you the ability to change the speed at which the color changes
func (*Client) PutDeviceDimming ¶
PutDeviceDimming sets the dimming property (0-255) of the specified device. The device must be a bulb supporting dimming, otherwise the call if ineffectual.
func (*Client) PutDevicePositioning ¶
PutDevicePositioning sets the positioning property (0-100) of the specified device.
func (*Client) PutDevicePower ¶
PutDevicePower switches the power state of the specified device
type DevicePlatform ¶
type DevicePlatform struct {
Running bool
}
DevicePlatform is the handle to the devices on the bridge
func (DevicePlatform) AddAccessory ¶
func (tdp DevicePlatform) AddAccessory(a *tfaccessory.TFAccessory)
AddAccessory is called to add individual accessories -- do not use directly
func (DevicePlatform) Background ¶
func (tdp DevicePlatform) Background()
Background runs the TradfriDevice status pollers
func (DevicePlatform) GetAccessory ¶
func (tdp DevicePlatform) GetAccessory(name string) (*tfaccessory.TFAccessory, bool)
GetAccessory returns a Tradfri Device accessory by name
func (DevicePlatform) Shutdown ¶
func (tdp DevicePlatform) Shutdown() platform.Control
Shutdown the TradfriDevicePlatform -- never actually called
type Platform ¶
type Platform struct {
Running bool
}
Platform is the handle to the bridge
func (Platform) AddAccessory ¶
func (tp Platform) AddAccessory(a *tfaccessory.TFAccessory)
AddAccessory is called to add a Tradfri bridge/gateway -- devices are enumerated automatically from it
func (Platform) Background ¶
func (tp Platform) Background()
Background runs the background tasks for the bridges (none)
func (Platform) GetAccessory ¶
func (tp Platform) GetAccessory(ip string) (*tfaccessory.TFAccessory, bool)
GetAccessory gets the bridge by IP address