Documentation
¶
Index ¶
- type ApiResponse
- type ApiResponseError
- type Deconz
- func (d *Deconz) GetAllGroups() ([]DeconzGroup, error)
- func (d *Deconz) GetAllLights() ([]DeconzLight, error)
- func (d *Deconz) GetAllSensors() ([]DeconzSensor, error)
- func (d *Deconz) GetDeviceByID(id int) (*DeconzDevice, error)
- func (d *Deconz) GetGroup(groupID int) (DeconzGroup, error)
- func (d *Deconz) GetLight(lightID int) (DeconzLight, error)
- func (d *Deconz) GetNewAPIKey(devicetype string) (string, error)
- func (d *Deconz) GetSensor(sensorID int) (DeconzSensor, error)
- func (d *Deconz) SetDeviceDiscoveredHandler(f func(*DeconzDevice))
- func (d *Deconz) SetDeviceRemoveHandler(f func(*DeconzDevice))
- func (d *Deconz) StartDiscovery(enableGroups bool)
- func (d *Deconz) StartandListenLoop()
- func (d *Deconz) Stop()
- type DeconzAPIKeyReqResponse
- type DeconzAPIKeyReqResponseData
- type DeconzDevice
- func (d *DeconzDevice) GetBrightness() uint
- func (d *DeconzDevice) GetColorTemp() int
- func (d *DeconzDevice) GetColorTempInPercent() int
- func (d *DeconzDevice) GetHueConverted() int
- func (d *DeconzDevice) GetID() int
- func (d *DeconzDevice) GetName() string
- func (d *DeconzDevice) GetSaturation() uint
- func (d *DeconzDevice) HasColor() bool
- func (d *DeconzDevice) IsOn() bool
- func (d *DeconzDevice) NewDeconzDevice(deconz *Deconz)
- func (d *DeconzDevice) SetBrightness(brightness float32) error
- func (d *DeconzDevice) SetColorTemp(ct float32) error
- func (d *DeconzDevice) SetGroupAttrs() ([]ApiResponse, error)
- func (d *DeconzDevice) SetGroupState() ([]ApiResponse, error)
- func (d *DeconzDevice) SetHandleChangeStateFunc(f func(state *DeconzState))
- func (d *DeconzDevice) SetHue(hue float32) error
- func (d *DeconzDevice) SetLightAttrs() ([]ApiResponse, error)
- func (d *DeconzDevice) SetLightState() ([]ApiResponse, error)
- func (d *DeconzDevice) SetSaturation(saturation float32) error
- func (d *DeconzDevice) Toggle() error
- func (d *DeconzDevice) TurnOff() error
- func (d *DeconzDevice) TurnOn() error
- func (d *DeconzDevice) UpdateSensor(sensorID int, sensorName string) ([]ApiResponse, error)
- type DeconzDeviceType
- type DeconzGroup
- type DeconzLight
- type DeconzLightAttribute
- type DeconzSensor
- type DeconzSensorConfig
- type DeconzState
- type DeconzWebSocketMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiResponse ¶
type ApiResponse struct { Success map[string]interface{} `json:"success"` Error *ApiResponseError `json:"error"` }
type ApiResponseError ¶
type Deconz ¶
type Deconz struct {
// contains filtered or unexported fields
}
func (*Deconz) GetAllGroups ¶
func (d *Deconz) GetAllGroups() ([]DeconzGroup, error)
Return all Groups from DeCONZ Rest API
func (*Deconz) GetAllLights ¶
func (d *Deconz) GetAllLights() ([]DeconzLight, error)
func (*Deconz) GetAllSensors ¶
func (d *Deconz) GetAllSensors() ([]DeconzSensor, error)
func (*Deconz) GetDeviceByID ¶
func (d *Deconz) GetDeviceByID(id int) (*DeconzDevice, error)
func (*Deconz) GetNewAPIKey ¶
Get a new API key from DeconZ
func (*Deconz) SetDeviceDiscoveredHandler ¶
func (d *Deconz) SetDeviceDiscoveredHandler(f func(*DeconzDevice))
Set the function that get called when a new Deconz Device is discovered
func (*Deconz) SetDeviceRemoveHandler ¶
func (d *Deconz) SetDeviceRemoveHandler(f func(*DeconzDevice))
Set the function that get called when a Deconz Device is no longer available anymore
func (*Deconz) StartDiscovery ¶
Get All Lights, all Groupd, all Sensors Add them to the available devices
func (*Deconz) StartandListenLoop ¶
func (d *Deconz) StartandListenLoop()
Connect to DeCONZ Websocket and start listening for events
type DeconzAPIKeyReqResponse ¶
type DeconzAPIKeyReqResponse struct {
Success DeconzAPIKeyReqResponseData `json:"success"`
}
type DeconzAPIKeyReqResponseData ¶
type DeconzAPIKeyReqResponseData struct {
Username string `json:"username"`
}
type DeconzDevice ¶
type DeconzDevice struct { Type DeconzDeviceType Light DeconzLight Group DeconzGroup Sensor DeconzSensor // contains filtered or unexported fields }
func (*DeconzDevice) GetBrightness ¶
func (d *DeconzDevice) GetBrightness() uint
func (*DeconzDevice) GetColorTemp ¶
func (d *DeconzDevice) GetColorTemp() int
func (*DeconzDevice) GetColorTempInPercent ¶
func (d *DeconzDevice) GetColorTempInPercent() int
func (*DeconzDevice) GetHueConverted ¶
func (d *DeconzDevice) GetHueConverted() int
func (*DeconzDevice) GetID ¶
func (d *DeconzDevice) GetID() int
Return the ID of the Device based on its type
func (*DeconzDevice) GetName ¶
func (d *DeconzDevice) GetName() string
Return the Name of the Device based on its type
func (*DeconzDevice) GetSaturation ¶
func (d *DeconzDevice) GetSaturation() uint
func (*DeconzDevice) HasColor ¶
func (d *DeconzDevice) HasColor() bool
func (*DeconzDevice) IsOn ¶
func (d *DeconzDevice) IsOn() bool
func (*DeconzDevice) NewDeconzDevice ¶
func (d *DeconzDevice) NewDeconzDevice(deconz *Deconz)
Call Tyoe specific functions Add Device to DeCONZ Client
func (*DeconzDevice) SetBrightness ¶
func (d *DeconzDevice) SetBrightness(brightness float32) error
func (*DeconzDevice) SetColorTemp ¶
func (d *DeconzDevice) SetColorTemp(ct float32) error
func (*DeconzDevice) SetGroupAttrs ¶
func (d *DeconzDevice) SetGroupAttrs() ([]ApiResponse, error)
func (*DeconzDevice) SetGroupState ¶
func (d *DeconzDevice) SetGroupState() ([]ApiResponse, error)
func (*DeconzDevice) SetHandleChangeStateFunc ¶
func (d *DeconzDevice) SetHandleChangeStateFunc(f func(state *DeconzState))
Set the function that is called when a Stage change event is receiverd from DeCONZ Websocket
func (*DeconzDevice) SetHue ¶
func (d *DeconzDevice) SetHue(hue float32) error
func (*DeconzDevice) SetLightAttrs ¶
func (d *DeconzDevice) SetLightAttrs() ([]ApiResponse, error)
func (*DeconzDevice) SetLightState ¶
func (d *DeconzDevice) SetLightState() ([]ApiResponse, error)
func (*DeconzDevice) SetSaturation ¶
func (d *DeconzDevice) SetSaturation(saturation float32) error
func (*DeconzDevice) Toggle ¶
func (d *DeconzDevice) Toggle() error
func (*DeconzDevice) TurnOff ¶
func (d *DeconzDevice) TurnOff() error
func (*DeconzDevice) TurnOn ¶
func (d *DeconzDevice) TurnOn() error
func (*DeconzDevice) UpdateSensor ¶
func (d *DeconzDevice) UpdateSensor(sensorID int, sensorName string) ([]ApiResponse, error)
type DeconzDeviceType ¶
type DeconzDeviceType string
const ( LightDeconzDeviceType DeconzDeviceType = "light" GroupDeconzDeviceType DeconzDeviceType = "group" SensorDeconzDeviceType DeconzDeviceType = "sensor" )
type DeconzGroup ¶
type DeconzGroup struct { ID int TID string `json:"id,omitempty"` ETag string `json:"etag,omitempty"` Name string `json:"name,omitempty"` Hidden bool `json:"hidden,omitempty"` Action DeconzState `json:"action,omitempty"` LightIDs []string `json:"lights,omitempty"` LightSequence []string `json:"lightsequence,omitempty"` MultiDeviceIDs []string `json:"multideviceids,omitempty"` DeviceMembership []string `json:"devicemembership,omitempty"` Scenes []scenes.Scene `json:"scenes,omitempty"` State DeconzState `json:"state,omitempty"` Lights []*DeconzDevice }
type DeconzLight ¶
type DeconzLight struct { Name string `json:"name"` ID int `json:"id,omitempty"` ETag string `json:"etag,omitempty"` State DeconzState `json:"state,omitempty"` HasColor bool `json:"hascolor,omitempty"` Type string `json:"type,omitempty"` ModelID string `json:"modelid,omitempty"` UniqueID string `json:"uniqueid,omitempty"` SWVersion string `json:"swversion,omitempty"` LastAnnounced string `json:"lastannounced,omitempty"` LastSeen string `json:"lastseen,omitempty"` ManufacturerName string `json:"manufacturername,omitempty"` ColorCapabilities int `json:"colorcapabilities,omitempty"` Ctmax int `json:"ctmax,omitempty"` Ctmin int `json:"ctmin,omitempty"` }
type DeconzLightAttribute ¶
type DeconzLightAttribute struct { Id string `json:"id,omitempty"` LastAnnounced string `json:"lastannounced,omitempty"` LastSeen string `json:"lastseen,omitempty"` ManufacturerName string `json:"manufacturername,omitempty"` ModelId string `json:"modelid,omitempty"` Name string `json:"name,omitempty"` SWVersion string `json:"swversion,omitempty"` Type string `json:"type,omitempty"` UniqueID string `json:"uniqueid,omitempty"` ColorCapabilities int `json:"colorcapabilities,omitempty"` Ctmax int `json:"ctmax,omitempty"` Ctmin int `json:"ctmin,omitempty"` }
type DeconzSensor ¶
type DeconzSensor struct { ID int Config DeconzSensorConfig `json:"config,omitempty"` Ep int `json:"ep,omitempty"` ETag string `json:"etag"` ManufacturerName string `json:"manufacturername,omitempty"` ModelID string `json:"modelid,omitempty"` Name string `json:"name"` State DeconzState `json:"state,omitempty"` SWVersion string `json:"swversion,omitempty"` Type string `json:"type,omitempty"` UniqueID string `json:"uniqueid,omitempty"` }
type DeconzSensorConfig ¶
type DeconzSensorConfig struct { On bool `json:"on"` Reachable bool `json:"reachable"` Battery int16 `json:"battery,omitempty"` Long string `json:"long,omitempty"` Lat string `json:"lat,omitempty"` SunriseOffset int16 `json:"sunriseoffset,omitempty"` SunsetOffset int16 `json:"sunsetoffset,omitempty"` }
type DeconzState ¶
type DeconzState struct { // Light & Group On *bool `json:"on,omitempty"` // Hue *uint16 `json:"hue,omitempty"` // Effect string `json:"effect,omitempty"` // Bri *uint8 `json:"bri,omitempty"` // min = 1, max = 254 Sat *uint8 `json:"sat,omitempty"` // CT *uint16 `json:"ct,omitempty"` // min = 154, max = 500 XY []float32 `json:"xy,omitempty"` Alert *string `json:"alert,omitempty"` // Light Reachable *bool `json:"reachable,omitempty"` ColorMode string `json:"colormode,omitempty"` ColorLoopSpeed *uint8 `json:"colorloopspeed,omitempty"` TransitionTime *uint16 `json:"transitiontime,omitempty"` // Group AllOn *bool `json:"all_on,omitempty"` AnyOn *bool `json:"any_on,omitempty"` // Sensor ButtonEvent *int `json:"buttonevent,omitempty"` Humidity *uint16 `json:"humidity,omitempty"` Temperature *int16 `json:"temperature,omitempty"` Pressure *int16 `json:"pressure,omitempty"` }
func (*DeconzState) SetCT ¶
func (state *DeconzState) SetCT(Bri int, CT int)
func (*DeconzState) SetOn ¶
func (state *DeconzState) SetOn(OnOff bool)
func (*DeconzState) SetXY ¶
func (state *DeconzState) SetXY(x, y float32)
type DeconzWebSocketMessage ¶
type DeconzWebSocketMessage struct { Type string `json:"t,omitempty"` Event string `json:"e,omitempty"` Resource string `json:"r,omitempty"` ID string `json:"id,omitempty"` UniqueID string `json:"uniqueid,omitempty"` GroupID string `json:"gid,omitempty"` SceneID string `json:"scid,omitempty"` Name string `json:"name,omitempty"` Attributes DeconzLightAttribute `json:"attr,omitempty"` State DeconzState `json:"state,omitempty"` }
Click to show internal directories.
Click to hide internal directories.