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 int) (model.Device, error)
- func (tc *Client) GetGroup(groupId int) (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) PutDeviceColor(deviceId int, x, y int) (model.Result, error)
- func (tc *Client) PutDeviceColorHSL(deviceId int, hue float64, saturation float64, lightness float64) (model.Result, error)
- func (tc *Client) PutDeviceColorHSLTimed(deviceId int, hue float64, saturation float64, lightness float64, ...) (model.Result, error)
- func (tc *Client) PutDeviceColorRGB(deviceId int, rgb string) (model.Result, error)
- func (tc *Client) PutDeviceColorRGBInt(deviceId int, r, g, b int) (model.Result, error)
- func (tc *Client) PutDeviceColorRGBIntTimed(deviceId int, r, g, b int, transitionTimeMS int) (model.Result, error)
- func (tc *Client) PutDeviceColorRGBTimed(deviceId int, rgb string, transitionTimeMS int) (model.Result, error)
- func (tc *Client) PutDeviceColorTimed(deviceId int, x, y int, transitionTimeMS int) (model.Result, error)
- func (tc *Client) PutDeviceDimming(deviceId int, dimming int) (model.Result, error)
- func (tc *Client) PutDevicePositioning(deviceId int, positioning float32) (model.Result, error)
- func (tc *Client) PutDevicePower(deviceId int, power int) (model.Result, error)
- func (tc *Client) PutDeviceState(deviceId int, power int, dimmer int) (model.Result, error)
Constants ¶
const ( /** A "normal" remote */ DeviceTypeRemote = iota /** * A remote which has been paired with another remote. * See https://www.reddit.com/r/tradfri/comments/6x1miq for details */ DeviceTypeSlaveRemote /** A lightbulb */ DeviceTypeLightbulb /** A smart plug */ DeviceTypePlug /** A motion sensor (currently unsupported) */ DeviceTypeMotionSensor /** A signal repeater */ DeviceTypeSignalRepeater /** A smart blind */ DeviceTypeBlind /** Symfonisk Remote */ DeviceTypeSoundRemote )
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) PutDeviceColor ¶
PutDeviceColor sets the CIE 1931 color space x/y color, x and y must be between 0-65536 but note that many combinations won't work. See CIE 1931 for more details. It is not recommended to use these values to set colors, as it is often not supported by the gateway and is intended for internal use.
func (*Client) PutDeviceColorHSL ¶
func (tc *Client) PutDeviceColorHSL(deviceId int, 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 int, 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) PutDeviceColorRGB ¶
PutDeviceColorRGB sets the color of the bulb using RGB hex string such as 8f2686 (purple). Note that It does not use the built in rgb hex parameter as that does not work reliably, so the rgb is converted to hsl and that is sent
func (*Client) PutDeviceColorRGBInt ¶
PutDeviceColorRGBInt does about the same as PutDeviceColorRGB except you can directly pass the rgb instead of a hex string
func (*Client) PutDeviceColorRGBIntTimed ¶
func (tc *Client) PutDeviceColorRGBIntTimed(deviceId int, r, g, b int, transitionTimeMS int) (model.Result, error)
PutDeviceColorRGBIntTimed does the same as PutDeviceColorRGBInt but it gives you the ability to change the speed at which the color changes
func (*Client) PutDeviceColorRGBTimed ¶
func (tc *Client) PutDeviceColorRGBTimed(deviceId int, rgb string, transitionTimeMS int) (model.Result, error)
PutDeviceColorRGBTimed does the same as PutDeviceColorRGB but it gives you the ability to change the speed at which the color changes
func (*Client) PutDeviceColorTimed ¶
func (tc *Client) PutDeviceColorTimed(deviceId int, x, y int, transitionTimeMS int) (model.Result, error)
PutDeviceColorTimed does the same as PutDeviceColor 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 to on (1) or off (0)