2021-07-29 19:11:56 +02:00
|
|
|
#pragma once
|
|
|
|
|
2021-08-05 01:28:39 +02:00
|
|
|
#include "esphome/core/defines.h"
|
2021-07-29 19:11:56 +02:00
|
|
|
|
|
|
|
#ifdef USE_JSON
|
|
|
|
|
2021-08-05 01:28:39 +02:00
|
|
|
#include "esphome/components/json/json_util.h"
|
|
|
|
#include "light_call.h"
|
|
|
|
#include "light_state.h"
|
|
|
|
|
2021-07-29 19:11:56 +02:00
|
|
|
namespace esphome {
|
|
|
|
namespace light {
|
|
|
|
|
|
|
|
class LightJSONSchema {
|
|
|
|
public:
|
|
|
|
/// Dump the state of a light as JSON.
|
2022-01-01 10:31:43 +01:00
|
|
|
static void dump_json(LightState &state, JsonObject root);
|
2021-07-29 19:11:56 +02:00
|
|
|
/// Parse the JSON state of a light to a LightCall.
|
2022-01-01 10:31:43 +01:00
|
|
|
static void parse_json(LightState &state, LightCall &call, JsonObject root);
|
2021-07-29 19:11:56 +02:00
|
|
|
|
|
|
|
protected:
|
2022-01-01 10:31:43 +01:00
|
|
|
static void parse_color_json(LightState &state, LightCall &call, JsonObject root);
|
2021-07-29 19:11:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace light
|
|
|
|
} // namespace esphome
|
|
|
|
|
|
|
|
#endif
|