aboutsummaryrefslogtreecommitdiff
path: root/main/relay.cpp
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2024-04-22 16:26:50 +0200
committerJan200101 <sentrycraft123@gmail.com>2024-04-22 16:26:50 +0200
commit2da71ab755d1f444f2867b4dd75fe3e21e2c7395 (patch)
tree37ffdda6c59746dc9980b90b7bcab950e9577a47 /main/relay.cpp
parentaccf08f86a636f59dad3af110a8e914f12f59498 (diff)
downloadShelSP-2da71ab755d1f444f2867b4dd75fe3e21e2c7395.tar.gz
ShelSP-2da71ab755d1f444f2867b4dd75fe3e21e2c7395.zip
cleanup
Diffstat (limited to 'main/relay.cpp')
-rw-r--r--main/relay.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/relay.cpp b/main/relay.cpp
new file mode 100644
index 0000000..701701f
--- /dev/null
+++ b/main/relay.cpp
@@ -0,0 +1,29 @@
+#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;
+}