Beispiel #1
0
func (l *Lights) RenameLight(light_id int, light_name string) []util.ApiResponse {
	url := fmt.Sprintf(get_light_url, l.Hostname, l.Username, light_id)
	data := fmt.Sprintf("{\"name\": \"%s\"}", light_name)
	response := util.HttpPut(url, data, "application/json")
	var api_response []util.ApiResponse
	json.Unmarshal(response, &api_response)
	return api_response
}
Beispiel #2
0
func (g *Groups) SetGroupState(group_number int, group_state lights.State) []util.ApiResponse {
	url := fmt.Sprintf(set_group_state_url, g.Hostname, g.Username, group_number)
	group_state_json, _ := json.Marshal(&group_state)
	data := string(group_state_json)
	response := util.HttpPut(url, data, "application/json")
	var api_response []util.ApiResponse
	json.Unmarshal(response, &api_response)
	return api_response
}
Beispiel #3
0
func (l *Lights) SetLightState(light_id int, state State) []util.ApiResponse {
	url := fmt.Sprintf(set_light_state_url, l.Hostname, l.Username, light_id)
	state_json, _ := json.Marshal(&state)
	data := string(state_json)
	response := util.HttpPut(url, data, "application/json")
	var api_response []util.ApiResponse
	json.Unmarshal(response, &api_response)
	return api_response
}