Documentation ¶
Index ¶
- Constants
- Variables
- func ConnectGateway(ctx context.Context, cfg GatewayConfig, onConnect func(), onDisconnect func(), ...) (coap.CoapDTLSConnection, error)
- func Discover(force bool)
- func GetLevelForHex(ColorSpace, hex string) (int, error)
- func GetNewPSK(gateway string, key string, handler func(ident string, key string, err error))
- func Level(deviceID int, state int)
- func ListColorsInMap(colorMap ColorMap)
- func Observe()
- func RebootGateway()
- func SendConfigObject(msg []byte)
- func SendState(msg []byte) error
- func SetBlind(deviceID int, position int)
- func SetConnecion(conn coap.CoapDTLSConnection)
- func SetHex(deviceID int, hex string)
- func SetRGB(id int64, rgb string) error
- func SetXY(deviceID int, x int, y int)
- func Start(wg *sync.WaitGroup, status_channel chan (error))
- func State(deviceID int, state int)
- func Stop()
- func Test()
- type BlindConfig
- type ColorDefinition
- type ColorMap
- type DeviceInfo
- type DeviceList
- type DimmerConfig
- type GatewayConfig
- type MQTTLightMessage
- type MQTTboolMessage
- type MQTTmessage
- type SwitchConfig
- type TradfriBlind
- type TradfriBlinds
- type TradfriDevice
- func (d *TradfriDevice) SetBlind(position int) (string, string, error)
- func (d *TradfriDevice) SetHex(hex string) (string, string, error)
- func (d *TradfriDevice) SetLevel(level int) (string, string, error)
- func (d *TradfriDevice) SetState(state int) (string, string, error)
- func (d *TradfriDevice) SetXY(x int, y int) (string, string, error)
- type TradfriLight
- type TradfriPlug
- type TradfriPlugs
Constants ¶
View Source
const DefaultPort = "5684"
SERVER
Variables ¶
View Source
var ErrorNoBlindControl = errors.New("tradfri Error: device has no blind control")
View Source
var ErrorNoDimmerControl = errors.New("tradfri Error: device has no dimmer control")
View Source
var ErrorNoHexControl = errors.New("tradfri Error: device has no hex control")
View Source
var ErrorNoStateControl = errors.New("tradfri Error: device has no state control")
View Source
var ErrorTradfriConnectionRefused = errors.New("Tradfri Error: Connection refused")
View Source
var MQTTSendTopic func(string, []byte, bool) error
Functions ¶
func ConnectGateway ¶
func ConnectGateway(ctx context.Context, cfg GatewayConfig, onConnect func(), onDisconnect func(), onCanceled func(), onConnectionFailed func()) (coap.CoapDTLSConnection, error)
func GetLevelForHex ¶
func ListColorsInMap ¶
func ListColorsInMap(colorMap ColorMap)
func RebootGateway ¶
func RebootGateway()
func SendConfigObject ¶
func SendConfigObject(msg []byte)
func SetConnecion ¶
func SetConnecion(conn coap.CoapDTLSConnection)
Types ¶
type BlindConfig ¶
type BlindConfig struct { CommandTopic string `json:"command_topic"` PositionTopic string `json:"position_topic"` PositionTemplate string `json:"position_template"` SetPositionTopic string `json:"set_position_topic"` SetPositionTemplate string `json:"set_position_template"` PayloadOpen string `json:"payload_open"` PayloadClose string `json:"payload_close"` PayloadStop string `json:"payload_stop"` Device DeviceInfo `json:"device"` Name string `json:"name"` UniqueID string `json:"unique_id"` }
type ColorDefinition ¶
func (*ColorDefinition) ToFloat ¶
func (c *ColorDefinition) ToFloat() (float64, float64)
type ColorMap ¶
func GetColorMap ¶
type DeviceInfo ¶
type DeviceList ¶
type DeviceList struct {
// contains filtered or unexported fields
}
func (*DeviceList) GetDeviceInfo ¶
func (d *DeviceList) GetDeviceInfo(id int, handler func(*TradfriDevice, error))
func (*DeviceList) Init ¶
func (d *DeviceList) Init()
type DimmerConfig ¶
type DimmerConfig struct { Schema string `json:"schema"` CommandTopic string `json:"command_topic"` StateTopic string `json:"state_topic"` // StateValueTemplate string `json:"state_value_template"` // BrightnessCommandTopic string `json:"brightness_command_topic"` BrightnessScale int `json:"brightness_scale"` // BrightnessStateTopic string `json:"brightness_state_topic"` // BrightnessValueTemplate string `json:"brightness_value_template"` // OnCommandType string `json:"on_command_type"` Brightness bool `json:"brightness"` Device DeviceInfo `json:"device"` Name string `json:"name"` UniqueID string `json:"unique_id"` ColorMode bool `json:"color_mode"` SupportedColorModes []string `json:"supported_color_modes"` }
type GatewayConfig ¶
type MQTTLightMessage ¶
type MQTTboolMessage ¶
type MQTTboolMessage struct {
Value bool `json:"value"`
}
type MQTTmessage ¶
type MQTTmessage struct {
Value int `json:"value"`
}
type SwitchConfig ¶
type SwitchConfig struct { PayloadOff bool `json:"payload_off"` PayloadOn bool `json:"payload_on"` ValueTemplate string `json:"value_template"` CommandTopic string `json:"command_topic"` StateTopic string `json:"state_topic"` Device DeviceInfo `json:"device"` Name string `json:"name"` UniqueID string `json:"unique_id"` }
type TradfriBlind ¶
func ParseBlindInfo ¶
func ParseBlindInfo(aDevice []byte) (TradfriBlind, error)
func (TradfriBlind) Describe ¶
func (p TradfriBlind) Describe() string
type TradfriBlinds ¶
type TradfriBlinds []TradfriBlind
type TradfriDevice ¶
type TradfriDevice struct { DeviceInfo struct { Manufacturer string `json:"0"` Model string `json:"1"` Num2 string `json:"2"` FirmvareVersion string `json:"3"` Num6 int `json:"6"` Num7 int `json:"7"` Num8 int `json:"8"` BatteryStatus int `json:"9"` } `json:"3"` LightControl []struct { ColorHex string `json:"5706"` Num5707 int `json:"5707"` Num5708 int `json:"5708"` ColorX int `json:"5709"` ColorY int `json:"5710"` Num5849 int `json:"5849"` State int `json:"5850"` Dimmer int `json:"5851"` Num9003 int `json:"9003"` } `json:"3311"` PlugControl []struct { Num5849 int `json:"5849"` State int `json:"5850"` Num5851 int `json:"5851"` Num9003 int `json:"9003"` } `json:"3312"` BlindControl []struct { Position float64 `json:"5536"` Num9003 int `json:"9003"` } `json:"15015"` DeviceType int `json:"5750"` Name string `json:"9001"` Num9002 int `json:"9002"` Id int `json:"9003"` Num9019 int `json:"9019"` Num9020 int `json:"9020"` Num9054 int `json:"9054"` }
func (*TradfriDevice) SetBlind ¶
func (d *TradfriDevice) SetBlind(position int) (string, string, error)
func (*TradfriDevice) SetLevel ¶
func (d *TradfriDevice) SetLevel(level int) (string, string, error)
type TradfriLight ¶
type TradfriLight struct { Id int64 Name string StateDescription string State bool Dimmer int64 Manufacturer string Model string ColorSpace string ColorValues ColorDefinition Hex string }
func ParseLightInfo ¶
func ParseLightInfo(aDevice []byte) (TradfriLight, error)
type TradfriPlug ¶
type TradfriPlug struct { Id int64 Name string State bool StateDescription string Manufacturer string Model string }
func ParsePlugInfo ¶
func ParsePlugInfo(aDevice []byte) (TradfriPlug, error)
func (TradfriPlug) Describe ¶
func (p TradfriPlug) Describe() string
type TradfriPlugs ¶
type TradfriPlugs []TradfriPlug
Click to show internal directories.
Click to hide internal directories.