mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
also remove references from JsonObjectConst and JsonArray
This commit is contained in:
@@ -987,7 +987,7 @@ void EMSdevice::generate_values_web(JsonObject output) {
|
|||||||
|
|
||||||
// as generate_values_web() but stripped down to only show all entities and their state
|
// as generate_values_web() but stripped down to only show all entities and their state
|
||||||
// this is used only for WebCustomizationService::device_entities()
|
// this is used only for WebCustomizationService::device_entities()
|
||||||
void EMSdevice::generate_values_web_customization(JsonArray & output) {
|
void EMSdevice::generate_values_web_customization(JsonArray output) {
|
||||||
for (auto & dv : devicevalues_) {
|
for (auto & dv : devicevalues_) {
|
||||||
// also show commands and entities that have an empty full name
|
// also show commands and entities that have an empty full name
|
||||||
JsonObject obj = output.add<JsonObject>();
|
JsonObject obj = output.add<JsonObject>();
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class EMSdevice {
|
|||||||
enum OUTPUT_TARGET : uint8_t { API_VERBOSE, API_SHORTNAMES, MQTT, CONSOLE };
|
enum OUTPUT_TARGET : uint8_t { API_VERBOSE, API_SHORTNAMES, MQTT, CONSOLE };
|
||||||
bool generate_values(JsonObject output, const uint8_t tag_filter, const bool nested, const uint8_t output_target);
|
bool generate_values(JsonObject output, const uint8_t tag_filter, const bool nested, const uint8_t output_target);
|
||||||
void generate_values_web(JsonObject output);
|
void generate_values_web(JsonObject output);
|
||||||
void generate_values_web_customization(JsonArray & output);
|
void generate_values_web_customization(JsonArray output);
|
||||||
|
|
||||||
void add_device_value(uint8_t tag,
|
void add_device_value(uint8_t tag,
|
||||||
void * value_p,
|
void * value_p,
|
||||||
|
|||||||
12
src/mqtt.cpp
12
src/mqtt.cpp
@@ -668,12 +668,12 @@ bool Mqtt::queue_publish(const char * topic, const std::string & payload) {
|
|||||||
return queue_publish_message((topic), payload, mqtt_retain_);
|
return queue_publish_message((topic), payload, mqtt_retain_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mqtt::queue_publish(const char * topic, const JsonObjectConst & payload) {
|
bool Mqtt::queue_publish(const char * topic, const JsonObjectConst payload) {
|
||||||
return queue_publish_retain(topic, payload, mqtt_retain_);
|
return queue_publish_retain(topic, payload, mqtt_retain_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish json doc, only if its not empty
|
// publish json doc, only if its not empty
|
||||||
bool Mqtt::queue_publish(const std::string & topic, const JsonObjectConst & payload) {
|
bool Mqtt::queue_publish(const std::string & topic, const JsonObjectConst payload) {
|
||||||
return queue_publish_retain(topic, payload, mqtt_retain_);
|
return queue_publish_retain(topic, payload, mqtt_retain_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,11 +683,11 @@ bool Mqtt::queue_publish_retain(const char * topic, const std::string & payload,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish json doc, only if its not empty, using the retain flag
|
// publish json doc, only if its not empty, using the retain flag
|
||||||
bool Mqtt::queue_publish_retain(const std::string & topic, const JsonObjectConst & payload, const bool retain) {
|
bool Mqtt::queue_publish_retain(const std::string & topic, const JsonObjectConst payload, const bool retain) {
|
||||||
return queue_publish_retain(topic.c_str(), payload, retain);
|
return queue_publish_retain(topic.c_str(), payload, retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mqtt::queue_publish_retain(const char * topic, const JsonObjectConst & payload, const bool retain) {
|
bool Mqtt::queue_publish_retain(const char * topic, const JsonObjectConst payload, const bool retain) {
|
||||||
if (payload.size()) {
|
if (payload.size()) {
|
||||||
std::string payload_text;
|
std::string payload_text;
|
||||||
payload_text.reserve(measureJson(payload) + 1);
|
payload_text.reserve(measureJson(payload) + 1);
|
||||||
@@ -707,7 +707,7 @@ bool Mqtt::queue_remove_topic(const char * topic) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// queue a Home Assistant config topic and payload, with retain flag off.
|
// queue a Home Assistant config topic and payload, with retain flag off.
|
||||||
bool Mqtt::queue_ha(const char * topic, const JsonObjectConst & payload) {
|
bool Mqtt::queue_ha(const char * topic, const JsonObjectConst payload) {
|
||||||
if (!enabled()) {
|
if (!enabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -802,7 +802,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSd
|
|||||||
const int16_t dv_set_min,
|
const int16_t dv_set_min,
|
||||||
const uint32_t dv_set_max,
|
const uint32_t dv_set_max,
|
||||||
const int8_t num_op,
|
const int8_t num_op,
|
||||||
const JsonObjectConst & dev_json) {
|
const JsonObjectConst dev_json) {
|
||||||
// ignore if name (fullname) is empty
|
// ignore if name (fullname) is empty
|
||||||
if (!fullname || !en_name) {
|
if (!fullname || !en_name) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
12
src/mqtt.h
12
src/mqtt.h
@@ -67,13 +67,13 @@ class Mqtt {
|
|||||||
|
|
||||||
static bool queue_publish(const std::string & topic, const std::string & payload);
|
static bool queue_publish(const std::string & topic, const std::string & payload);
|
||||||
static bool queue_publish(const char * topic, const char * payload);
|
static bool queue_publish(const char * topic, const char * payload);
|
||||||
static bool queue_publish(const std::string & topic, const JsonObjectConst & payload);
|
static bool queue_publish(const std::string & topic, const JsonObjectConst payload);
|
||||||
static bool queue_publish(const char * topic, const JsonObjectConst & payload);
|
static bool queue_publish(const char * topic, const JsonObjectConst payload);
|
||||||
static bool queue_publish(const char * topic, const std::string & payload);
|
static bool queue_publish(const char * topic, const std::string & payload);
|
||||||
static bool queue_publish_retain(const std::string & topic, const JsonObjectConst & payload, const bool retain);
|
static bool queue_publish_retain(const std::string & topic, const JsonObjectConst payload, const bool retain);
|
||||||
static bool queue_publish_retain(const char * topic, const std::string & payload, const bool retain);
|
static bool queue_publish_retain(const char * topic, const std::string & payload, const bool retain);
|
||||||
static bool queue_publish_retain(const char * topic, const JsonObjectConst & payload, const bool retain);
|
static bool queue_publish_retain(const char * topic, const JsonObjectConst payload, const bool retain);
|
||||||
static bool queue_ha(const char * topic, const JsonObjectConst & payload);
|
static bool queue_ha(const char * topic, const JsonObjectConst payload);
|
||||||
static bool queue_remove_topic(const char * topic);
|
static bool queue_remove_topic(const char * topic);
|
||||||
|
|
||||||
static bool publish_ha_sensor_config(DeviceValue & dv, const char * model, const char * brand, const bool remove, const bool create_device_config = false);
|
static bool publish_ha_sensor_config(DeviceValue & dv, const char * model, const char * brand, const bool remove, const bool create_device_config = false);
|
||||||
@@ -91,7 +91,7 @@ class Mqtt {
|
|||||||
const int16_t dv_set_min,
|
const int16_t dv_set_min,
|
||||||
const uint32_t dv_set_max,
|
const uint32_t dv_set_max,
|
||||||
const int8_t num_op,
|
const int8_t num_op,
|
||||||
const JsonObjectConst & dev_json);
|
const JsonObjectConst dev_json);
|
||||||
|
|
||||||
static bool publish_system_ha_sensor_config(uint8_t type, const char * name, const char * entity, const uint8_t uom);
|
static bool publish_system_ha_sensor_config(uint8_t type, const char * name, const char * entity, const uint8_t uom);
|
||||||
static bool publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, const bool remove = false, const int16_t min = 5, const uint32_t max = 30);
|
static bool publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, const bool remove = false, const int16_t min = 5, const uint32_t max = 30);
|
||||||
|
|||||||
Reference in New Issue
Block a user