add: new commands to controller
This commit is contained in:
parent
b969ddd4ff
commit
dd9e533f22
12 changed files with 127 additions and 62 deletions
|
@ -147,7 +147,7 @@ api_v1_controllers_STR_PUT(struct mg_connection *nc, struct http_message *hm, en
|
|||
cJSON_Delete(json);
|
||||
json = controller_to_json(controller);
|
||||
|
||||
command_set_controller_name(controller);
|
||||
command_controller_name_set(controller);
|
||||
|
||||
endpoint_response_json(response, 200, json);
|
||||
cJSON_Delete(json);
|
||||
|
|
|
@ -271,7 +271,7 @@ api_v1_controllers_STR_relays_INT_PUT(struct mg_connection *nc, struct http_mess
|
|||
json = relay_to_json(relay);
|
||||
|
||||
LOGGER_DEBUG("commanding schedules");
|
||||
command_set_relay_schedule(relay);
|
||||
command_relay_schedules_set(relay);
|
||||
|
||||
endpoint_response_json(response, 200, json);
|
||||
cJSON_Delete(json);
|
||||
|
|
|
@ -62,7 +62,7 @@ api_v1_controllers_STR_relays_INT_pulse_POST(struct mg_connection *nc, struct ht
|
|||
}
|
||||
|
||||
LOGGER_DEBUG("commanding pulse to relay %d for controller %s\n", args[1].value.v_int, args[0].value.v_str);
|
||||
command_pulse(relay, duration);
|
||||
command_relay_pulse(relay, duration);
|
||||
|
||||
endpoint_response_text(response, 200, "", 0);
|
||||
relay_free(relay);
|
||||
|
|
|
@ -146,11 +146,7 @@ api_v1_schedules_STR_PUT(struct mg_connection *nc, struct http_message *hm, endp
|
|||
return;
|
||||
}
|
||||
|
||||
relay_t **relays = relay_get_with_schedule(schedule->id);
|
||||
for(int i = 0; relays[i] != NULL; ++i)
|
||||
{
|
||||
command_set_relay_schedule(relays[i]);
|
||||
}
|
||||
command_schedule_update(schedule);
|
||||
|
||||
cJSON *json_tag;
|
||||
cJSON *json_tags = cJSON_GetObjectItemCaseSensitive(json, "tags");
|
||||
|
@ -180,7 +176,6 @@ api_v1_schedules_STR_PUT(struct mg_connection *nc, struct http_message *hm, endp
|
|||
|
||||
endpoint_response_json(response, 200, json);
|
||||
cJSON_Delete(json);
|
||||
relay_free_list(relays);
|
||||
schedule_free(schedule);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue