Commit 25623076 authored by Sergey 'Jin' Bostandzhyan's avatar Sergey 'Jin' Bostandzhyan

Merge branch 'master' into testing

parents 75fd8495 358f9453
......@@ -299,7 +299,8 @@ netatmo_get_token()
json_object *jobj = json_tokener_parse(response->memory);
if (NULL == jobj) {
vdc_report(LOG_ERR, "network: parsing token response failed\n");
vdc_report(LOG_ERR, "network: parsing token response failed, length %d, data:\n%s\n",
response->size, response->memory);
free(response->memory);
free(response);
return NETATMO_AUTH_FAILED;
......@@ -323,11 +324,11 @@ netatmo_get_token()
netatmo.refresh_token = strdup(json_object_get_string(val));
configChanged = true;
}
} else if (!strcmp(key, "expire_in")) {
} else if (!strcmp(key, "expires_in")) {
if (type == json_type_int) {
int exp = json_object_get_int(val);
g_access_token_valid_until = time(NULL) + exp - 120; // 2 minutes before expiration
vdc_report(LOG_INFO, "network: token expire_in: %d -> valid until %ld\n", exp, g_access_token_valid_until);
vdc_report(LOG_INFO, "network: token expires_in: %d -> valid until %ld\n", exp, g_access_token_valid_until);
}
} else if (!strcmp(key, "scope")) {
// ignore
......@@ -454,7 +455,8 @@ int netatmo_get_devices()
json_object *jobj = json_tokener_parse(response->memory);
if (jobj == NULL) {
vdc_report(LOG_ERR, "network: parsing devicelist response failed\n");
vdc_report(LOG_ERR, "network: parsing devicelist response failed, length: %d, data:\n%s\n",
response->size, response->memory);
free(response->memory);
free(response);
return NETATMO_GETMEASURE_FAILED;
......@@ -733,7 +735,8 @@ netatmo_get_values(netatmo_module_t* mod)
json_object *jobj = json_tokener_parse(response->memory);
if (jobj == NULL) {
vdc_report(LOG_ERR, "network: parsing getmeasure response failed\n");
vdc_report(LOG_ERR, "network: parsing getmeasure response failed, length: %d, data:\n%s\n",
response->size, response->memory);
free(response->memory);
free(response);
return NETATMO_GETMEASURE_FAILED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment