Exemplo n.º 1
0
func stateCmd(id string) {
	connection := config.ReadConfig()
	setState := &lights.SetStateValues{
		On:             on,
		Alert:          alert,
		Bri:            bri,
		Hue:            hue,
		Sat:            sat,
		XY:             xy,
		Ct:             ct,
		Effect:         effect,
		TransitionTime: transitionTime,
		BriInc:         briInc,
		SatInc:         satInc,
		HueInc:         hueInc,
		CtInc:          ctInc,
		XYInc:          xyInc,
	}
	result, errHUE, err := lights.SetState(connection, id, setState)
	internal.CheckErrors(err, errHUE)

	jsonStr, err := json.MarshalIndent(result, "", "  ")
	internal.Check(err)
	internal.FormatOutputDef(jsonStr)
}
Exemplo n.º 2
0
Arquivo: get.go Projeto: yesnault/ghue
func getCmd(id string) {
	connection := config.ReadConfig()
	result, errHUE, err := rules.GetRule(connection, id)
	internal.CheckErrors(err, errHUE)

	jsonStr, err := json.MarshalIndent(result, "", "  ")
	internal.Check(err)
	internal.FormatOutputDef(jsonStr)
}
Exemplo n.º 3
0
Arquivo: all.go Projeto: yesnault/ghue
func allCmd() {
	connection := config.ReadConfig()
	result, errHUE, err := groups.GetAllGroups(connection)
	internal.CheckErrors(err, errHUE)

	jsonStr, err := json.MarshalIndent(result, "", "  ")
	internal.Check(err)
	internal.FormatOutputDef(jsonStr)
}