types

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WizMessage

type WizMessage struct {
	Method string `json:"method"`
	Id     int    `json:"id,omitempty"`

	Params WizMessageParams `json:"params,omitempty"`
}

WizMessage represent a message sent to the device

type WizMessageError

type WizMessageError struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

WizMessageError represent an error message received from the device

type WizMessageParams

type WizMessageParams map[string]interface{}

WizMessageParams represents the params field inside the message. Using interface{} instead structs as devices answer with errors if we send more fields than needed for selected method So it forces us to construct it dynamically

type WizMessageResponse

type WizMessageResponse struct {
	Method string `json:"method"`
	Id     int    `json:"id,omitempty"`
	Env    string `json:"env,omitempty"`

	Result WizMessageResult `json:"result,omitempty"`
	Error  WizMessageError  `json:"error,omitempty"`
}

WizMessageResponse represent a message received from the device

type WizMessageResult

type WizMessageResult struct {
	// Almost globally present
	Mac     string `json:"mac,omitempty"` // Mac from the bulb
	Src     string `json:"src,omitempty"` // Src of the state change
	Success bool   `json:"success,omitempty"`

	// Fields on getPilot
	Rssi       int  `json:"rssi,omitempty"`       // Rssi is WiFi signal strength, in negative dBm
	State      bool `json:"state,omitempty"`      // State is status of the Device : true if ON, false if OFF
	SceneId    int  `json:"sceneId,omitempty"`    // SceneId represents current scene by id
	SchdPsetId int  `json:"schdPsetId,omitempty"` // SchdPsetId represents current rhythm by id (another type of scene)
	R          int  `json:"r,omitempty"`          // (0-255)
	G          int  `json:"g,omitempty"`          // (0-255)
	B          int  `json:"b,omitempty"`          // (0-255)
	C          int  `json:"c,omitempty"`          // C represents the value of the cold white led (0-255)
	W          int  `json:"w,omitempty"`          // W represents the value of the warm white led (0-255)
	Dimming    int  `json:"dimming,omitempty"`    // Dimming set the value of the brightness (10-100)

	// Fields on getDevInfo
	DevMac string `json:"devMac,omitempty"`

	// Fields on getUserConfig
	FadeIn     int  `json:"fadeIn,omitempty"`
	FadeOut    int  `json:"fadeOut,omitempty"`
	DftDim     int  `json:"dftDim,omitempty"`
	OpMode     int  `json:"opMode,omitempty"`
	Po         bool `json:"po,omitempty"`
	MinDimming int  `json:"minDimming,omitempty"`
	TapSensor  int  `json:"tapSensor,omitempty"`

	// Fields on getSystemConfig
	HomeId     int    `json:"homeId,omitempty"`
	RoomId     int    `json:"roomId,omitempty"`
	Rgn        string `json:"rgn,omitempty"` // Rgn represents the region in the world. I.E: 'eu'
	ModuleName string `json:"moduleName,omitempty"`
	FwVersion  string `json:"fwVersion,omitempty"`
	GroupId    int    `json:"groupId,omitempty"`
	Ping       int    `json:"ping,omitempty"`
	DrvConf    []int  `json:"drvConf,omitempty"`

	// Fields on getModelConfig
	Ps           int   `json:"ps,omitempty"`
	PwmFreq      int   `json:"pwmFreq,omitempty"`
	PwmRange     []int `json:"pwmRange,omitempty"`
	Wcr          int   `json:"wcr,omitempty"`
	Nowc         int   `json:"nowc,omitempty"`
	CctRange     []int `json:"cctRange,omitempty"` // CctRange represents the white temperature range advertised to the user. Extended whiteRange property (new)
	ExtRange     []int `json:"extRange,omitempty"` // ExtRange represents the white temperature range advertised to the user. Extended whiteRange property (old)
	RenderFactor []int `json:"renderFactor,omitempty"`
	Wizc1        struct {
		Mode []int `json:"mode,omitempty"`
	} `json:"wizc1,omitempty"`
	Wizc2 struct {
		Mode []int `json:"mode,omitempty"`
	} `json:"wizc2,omitempty"`

	// TODO OTHER
	WhiteRange float64 `json:"whiteRange,omitempty"` // WhiteRange white temperature range supported by the light // TODO (where?)
	Temp       int     `json:"temp,omitempty"`       // Temp set the color temperature for the white led in the bulb // TODO (where?)
}

WizMessageResult represent the result field inside the message's response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL