#include "esp_check.h" #include "relay.h" static const char *TAG = "relay"; int state = 0; char* relay_json(void) { char* resp = NULL; int rc = asprintf( &resp, "{" "\"ison\":%s," "\"has_timer\":false," "\"timer_started\":0," "\"timer_duration\":0," "\"timer_remaining\":0," "\"source\":\"http\"" "}", state ? "true" : "false" ); ESP_RETURN_ON_FALSE(resp && rc, NULL, TAG, "buffer alloc failed"); return resp; }