fix: use separate relay caches for status

This commit is contained in:
Tobias Reisinger 2020-08-25 12:39:43 +02:00
parent 0eef646fe0
commit f98a01f3f0
13 changed files with 49 additions and 38 deletions

View file

@ -40,7 +40,7 @@ api_v1_controllers_STR_relays_GET(struct mg_connection *nc, struct http_message
LOGGER_DEBUG("returning all relays for controller %s\n", args[0].value.v_str);
for(int i = 0; all_relays[i] != NULL; ++i)
{
cJSON *json_relay = relay_to_json(all_relays[i]);
cJSON *json_relay = relay_to_json(all_relays[i], 0);
cJSON_AddItemToArray(json, json_relay);
}

View file

@ -48,7 +48,7 @@ api_v1_controllers_STR_relays_INT_GET(struct mg_connection *nc, struct http_mess
}
LOGGER_DEBUG("returning relay %d for controller %s\n", args[1].value.v_int, args[0].value.v_str);
cJSON *json = relay_to_json(relay);
cJSON *json = relay_to_json(relay, 0);
endpoint_response_json(response, 200, json);
cJSON_Delete(json);
@ -268,7 +268,7 @@ api_v1_controllers_STR_relays_INT_PUT(struct mg_connection *nc, struct http_mess
}
cJSON_Delete(json);
json = relay_to_json(relay);
json = relay_to_json(relay, 0);
command_relay_schedules_set(relay);

View file

@ -20,7 +20,7 @@ api_v1_relays_GET(struct mg_connection *nc, struct http_message *hm, endpoint_ar
for(int i = 0; all_relays[i] != NULL; ++i)
{
cJSON *json_relay = relay_to_json(all_relays[i]);
cJSON *json_relay = relay_to_json(all_relays[i], 0);
cJSON_AddItemToArray(json, json_relay);
}

View file

@ -41,7 +41,7 @@ api_v1_relays_tag_STR_GET(struct mg_connection *nc, struct http_message *hm, end
LOGGER_DEBUG("failed to get relay %d for tag %s\n", relays_ids[i], args[0].value.v_str);
continue;
}
cJSON *json_relay = relay_to_json(relay);
cJSON *json_relay = relay_to_json(relay, 0);
cJSON_AddItemToArray(json, json_relay);

View file

@ -52,7 +52,7 @@ api_v1_tags_STR_GET(struct mg_connection *nc, struct http_message *hm, endpoint_
{
continue;
}
cJSON *json_relay = relay_to_json(relay);
cJSON *json_relay = relay_to_json(relay, 0);
cJSON_AddItemToArray(json_relays, json_relay);