Documentation ¶
Index ¶
- Constants
- func Connx(ctx context.Context, IPAddr, token string)
- type AvailableLight
- type Bridge
- type BridgeConfig
- type BridgeFetch
- type BridgeOptions
- type DiscoverModel
- type Error
- type Group
- type Light
- func (l *Light) Alarm(ch chan error, duration time.Duration) error
- func (l *Light) Rename(name string) error
- func (l *Light) SetAlert(alert string) error
- func (l *Light) SetBrightness(bri uint8) error
- func (l *Light) SetColorCIE(x, y float64) error
- func (l *Light) SetColorHEX(hex string) error
- func (l *Light) SetColorRGB(r, g, b float64) error
- func (l *Light) SetColorTemperature(ct uint16) error
- func (l *Light) SetEffect(effect string) error
- func (l *Light) SetHue(hue uint16) error
- func (l *Light) SetSaturation(sat uint8) error
- func (l *Light) Toggle(on bool) error
- type Sensor
Constants ¶
const ( DebugNone = 0 DebugInfo = 1 DebugError = 2 DebugAll = 3 )
const ( AlertNone = "none" AlertCycle = "select" AlertCycle15Sec = "lselect" EffectNone = "none" EffectColorLoop = "colorloop" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AvailableLight ¶
type Bridge ¶
type Bridge struct { IPAddr string `json:"ip_addr"` Token string `json:"token"` Lights map[string]*Light `json:"lights,omitempty"` Groups map[string]*Group `json:"groups,omitempty"` Sensors map[string]*Sensor `json:"sensors,omitempty"` Fetch BridgeFetch Config *BridgeConfig }
func (*Bridge) SearchNewLights ¶
The bridge will open the network for 40s and search all available devices, send multiple time append 40s. For show new devices, you need to use ShowNewLights.
func (*Bridge) ShowNewLights ¶
func (b *Bridge) ShowNewLights() (list []AvailableLight, err error)
Gets a list of lights that were discovered the last time a search for new lights was performed. The list of new lights is always deleted when a new search is started. If you miss one light, you can find it in group "0"
type BridgeConfig ¶
type BridgeConfig struct { Name string `json:"name"` Zigbeechannel int `json:"zigbeechannel"` Bridgeid string `json:"bridgeid"` Mac string `json:"mac"` Dhcp bool `json:"dhcp"` Ipaddress string `json:"ipaddress"` Netmask string `json:"netmask"` Gateway string `json:"gateway"` Proxyaddress string `json:"proxyaddress"` Proxyport int `json:"proxyport"` UTC string `json:"UTC"` Localtime string `json:"localtime"` Timezone string `json:"timezone"` Modelid string `json:"modelid"` Datastoreversion string `json:"datastoreversion"` Swversion string `json:"swversion"` Apiversion string `json:"apiversion"` Swupdate struct { Updatestate int `json:"updatestate"` Checkforupdate bool `json:"checkforupdate"` Devicetypes struct { Bridge bool `json:"bridge"` Lights []interface{} `json:"lights"` Sensors []interface{} `json:"sensors"` } `json:"devicetypes"` URL string `json:"url"` Text string `json:"text"` Notify bool `json:"notify"` } `json:"swupdate"` Swupdate2 struct { Checkforupdate bool `json:"checkforupdate"` Lastchange string `json:"lastchange"` Bridge struct { State string `json:"state"` Lastinstall string `json:"lastinstall"` } `json:"bridge"` State string `json:"state"` Autoinstall struct { Updatetime string `json:"updatetime"` On bool `json:"on"` } `json:"autoinstall"` } `json:"swupdate2"` Portalservices bool `json:"portalservices"` Portalconnection string `json:"portalconnection"` Portalstate struct { Signedon bool `json:"signedon"` Incoming bool `json:"incoming"` Outgoing bool `json:"outgoing"` Communication string `json:"communication"` } `json:"portalstate"` Internetservices struct { Internet string `json:"internet"` Remoteaccess string `json:"remoteaccess"` Time string `json:"time"` Swupdate string `json:"swupdate"` } `json:"internetservices"` Factorynew bool `json:"factorynew"` Replacesbridgeid interface{} `json:"replacesbridgeid"` Backup struct { Status string `json:"status"` Errorcode int `json:"errorcode"` } `json:"backup"` Starterkitid string `json:"starterkitid"` Whitelist map[string]struct { LastUseDate string `json:"last use date"` CreateDate string `json:"create date"` Name string `json:"name"` } `json:"whitelist"` }
type BridgeFetch ¶
type BridgeFetch struct {
// contains filtered or unexported fields
}
func (*BridgeFetch) Bridge ¶
func (b *BridgeFetch) Bridge() error
func (*BridgeFetch) Lights ¶
func (b *BridgeFetch) Lights() error
type BridgeOptions ¶
type DiscoverModel ¶
type DiscoverModel struct { ID string `json:"id"` Internalipaddress string `json:"internalipaddress"` }
func Discover ¶
func Discover() (dm DiscoverModel, err error)
func DiscoverAll ¶
func DiscoverAll() (dm []DiscoverModel, err error)
type Group ¶
type Group struct { Name string `json:"name"` Lights []string `json:"lights"` Sensors []interface{} `json:"sensors"` Type string `json:"type"` State struct { AllOn bool `json:"all_on"` AnyOn bool `json:"any_on"` } `json:"state"` Recycle bool `json:"recycle"` Class string `json:"class"` Action struct { On bool `json:"on"` Bri int `json:"bri"` Hue int `json:"hue"` Sat int `json:"sat"` Effect string `json:"effect"` Xy []float64 `json:"xy"` Ct int `json:"ct"` Alert string `json:"alert"` Colormode string `json:"colormode"` } `json:"action"` }
type Light ¶
type Light struct { Key string Bridge *Bridge // Philips Hue API State struct { On bool `json:"on,omitempty"` Bri uint8 `json:"bri,omitempty"` Hue uint16 `json:"hue,omitempty"` Sat uint8 `json:"sat,omitempty"` Effect string `json:"effect,omitempty"` Xy []float64 `json:"xy,omitempty"` Ct uint16 `json:"ct,omitempty"` Alert string `json:"alert,omitempty"` Colormode string `json:"colormode"` Mode string `json:"mode"` Reachable bool `json:"reachable"` } `json:"state"` Swupdate struct { State string `json:"state"` Lastinstall string `json:"lastinstall"` } `json:"swupdate"` Type string `json:"type"` Name string `json:"name"` Modelid string `json:"modelid"` Manufacturername string `json:"manufacturername"` Productname string `json:"productname"` Capabilities struct { Certified bool `json:"certified"` Control struct { Mindimlevel int `json:"mindimlevel"` Maxlumen int `json:"maxlumen"` Colorgamuttype string `json:"colorgamuttype"` Colorgamut [][]float64 `json:"colorgamut"` Ct struct { Min int `json:"min"` Max int `json:"max"` } `json:"ct"` } `json:"control"` Streaming struct { Renderer bool `json:"renderer"` Proxy bool `json:"proxy"` } `json:"streaming"` } `json:"capabilities"` Config struct { Archetype string `json:"archetype"` Function string `json:"function"` Direction string `json:"direction"` Startup struct { Mode string `json:"mode"` Configured bool `json:"configured"` } `json:"startup"` } `json:"config"` Uniqueid string `json:"uniqueid"` Swversion string `json:"swversion"` Swconfigid string `json:"swconfigid,omitempty"` Productid string `json:"productid,omitempty"` }
func (*Light) Rename ¶
Used to rename lights. A light can have its name changed when in any state, including when it is unreachable or off.
func (*Light) SetBrightness ¶
Set brightness to the light
func (*Light) SetColorCIE ¶
Allows you to set light color with CIE value
func (*Light) SetColorHEX ¶
Allows you to set light color with HEX value
func (*Light) SetColorRGB ¶
Allows you to set light color with RGB value
func (*Light) SetColorTemperature ¶
Allows you to set color temperature
func (*Light) SetSaturation ¶
Set saturation of the light
type Sensor ¶
type Sensor struct { State struct { Daylight bool `json:"daylight,omitempty"` Buttonevent int `json:"buttonevent,omitempty"` Lastupdated string `json:"lastupdated"` } `json:"state"` Swupdate struct { State string `json:"state"` Lastinstall string `json:"lastinstall"` } `json:"swupdate,omitempty"` Config struct { On bool `json:"on"` Configured bool `json:"configured,omitempty"` Sunriseoffset int `json:"sunriseoffset,omitempty"` Sunsetoffset int `json:"sunsetoffset,omitempty"` Battery int `json:"battery,omitempty"` Reachable bool `json:"reachable,omitempty"` Pending []interface{} `json:"pending,omitempty"` } `json:"config"` Name string `json:"name"` Type string `json:"type"` Modelid string `json:"modelid"` Manufacturername string `json:"manufacturername"` Productname string `json:"productname,omitempty"` Diversityid string `json:"diversityid,omitempty"` Swversion string `json:"swversion"` Uniqueid string `json:"uniqueid,omitempty"` Capabilities struct { Certified bool `json:"certified"` Primary bool `json:"primary"` Inputs []struct { Repeatintervals []int `json:"repeatintervals"` Events []struct { Buttonevent int `json:"buttonevent"` Eventtype string `json:"eventtype"` } `json:"events"` } `json:"inputs"` } `json:"capabilities,omitempty"` }