send current state via WS
Some checks failed
ESP-IDF Build / build (esp32c6, release-v5.4) (push) Failing after 6m9s
ESP-IDF Build / build (esp32c6, release-v5.5) (push) Failing after 4m54s
ESP-IDF Build / build (esp32s3, release-v5.4) (push) Failing after 4m35s
ESP-IDF Build / build (esp32s3, release-v5.5) (push) Failing after 4m59s
Some checks failed
ESP-IDF Build / build (esp32c6, release-v5.4) (push) Failing after 6m9s
ESP-IDF Build / build (esp32c6, release-v5.5) (push) Failing after 4m54s
ESP-IDF Build / build (esp32s3, release-v5.4) (push) Failing after 4m35s
ESP-IDF Build / build (esp32s3, release-v5.5) (push) Failing after 4m59s
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -2,12 +2,17 @@
|
||||
#include <cJSON.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "persistence_manager.h"
|
||||
|
||||
// Gibt ein cJSON-Objekt with dem aktuellen Lichtstatus zurück
|
||||
cJSON *create_light_status_json(void)
|
||||
{
|
||||
persistence_manager_t pm;
|
||||
persistence_manager_init(&pm, "config");
|
||||
cJSON *json = cJSON_CreateObject();
|
||||
// TODO: Echte Werte einfügen, aktuell Dummy-Daten
|
||||
cJSON_AddBoolToObject(json, "on", false);
|
||||
|
||||
bool light_active = persistence_manager_get_bool(&pm, "light_active", false);
|
||||
cJSON_AddBoolToObject(json, "on", light_active);
|
||||
cJSON_AddBoolToObject(json, "thunder", false);
|
||||
cJSON_AddStringToObject(json, "mode", "day");
|
||||
cJSON_AddStringToObject(json, "schema", "schema_03.csv");
|
||||
@@ -16,5 +21,8 @@ cJSON *create_light_status_json(void)
|
||||
cJSON_AddNumberToObject(color, "g", 240);
|
||||
cJSON_AddNumberToObject(color, "b", 220);
|
||||
cJSON_AddItemToObject(json, "color", color);
|
||||
|
||||
persistence_manager_deinit(&pm);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user