mirror of
https://github.com/esphome/esphome.git
synced 2025-09-10 07:12:21 +01:00
Merge branch 'integration' into memory_api
This commit is contained in:
@@ -15,8 +15,8 @@ void log_binary_sensor(const char *tag, const char *prefix, const char *type, Bi
|
|||||||
|
|
||||||
ESP_LOGCONFIG(tag, "%s%s '%s'", prefix, type, obj->get_name().c_str());
|
ESP_LOGCONFIG(tag, "%s%s '%s'", prefix, type, obj->get_name().c_str());
|
||||||
|
|
||||||
if (!obj->get_device_class().empty()) {
|
if (!obj->get_device_class_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->get_device_class().c_str());
|
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->get_device_class_ref().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,8 +14,8 @@ void log_button(const char *tag, const char *prefix, const char *type, Button *o
|
|||||||
|
|
||||||
ESP_LOGCONFIG(tag, "%s%s '%s'", prefix, type, obj->get_name().c_str());
|
ESP_LOGCONFIG(tag, "%s%s '%s'", prefix, type, obj->get_name().c_str());
|
||||||
|
|
||||||
if (!obj->get_icon().empty()) {
|
if (!obj->get_icon_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon().c_str());
|
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon_ref().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ const extern float COVER_CLOSED;
|
|||||||
if (traits_.get_is_assumed_state()) { \
|
if (traits_.get_is_assumed_state()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
||||||
} \
|
} \
|
||||||
if (!(obj)->get_device_class().empty()) { \
|
if (!(obj)->get_device_class_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@ namespace datetime {
|
|||||||
#define LOG_DATETIME_DATE(prefix, type, obj) \
|
#define LOG_DATETIME_DATE(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@ namespace datetime {
|
|||||||
#define LOG_DATETIME_DATETIME(prefix, type, obj) \
|
#define LOG_DATETIME_DATETIME(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,8 +16,8 @@ namespace datetime {
|
|||||||
#define LOG_DATETIME_TIME(prefix, type, obj) \
|
#define LOG_DATETIME_TIME(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,11 +13,11 @@ namespace event {
|
|||||||
#define LOG_EVENT(prefix, type, obj) \
|
#define LOG_EVENT(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
if (!(obj)->get_device_class().empty()) { \
|
if (!(obj)->get_device_class_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,8 +15,8 @@ class Lock;
|
|||||||
#define LOG_LOCK(prefix, type, obj) \
|
#define LOG_LOCK(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
if ((obj)->traits.get_assumed_state()) { \
|
if ((obj)->traits.get_assumed_state()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
||||||
|
@@ -14,16 +14,16 @@ void log_number(const char *tag, const char *prefix, const char *type, Number *o
|
|||||||
|
|
||||||
ESP_LOGCONFIG(tag, "%s%s '%s'", prefix, type, obj->get_name().c_str());
|
ESP_LOGCONFIG(tag, "%s%s '%s'", prefix, type, obj->get_name().c_str());
|
||||||
|
|
||||||
if (!obj->get_icon().empty()) {
|
if (!obj->get_icon_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon().c_str());
|
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon_ref().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj->traits.get_unit_of_measurement().empty()) {
|
if (!obj->traits.get_unit_of_measurement_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Unit of Measurement: '%s'", prefix, obj->traits.get_unit_of_measurement().c_str());
|
ESP_LOGCONFIG(tag, "%s Unit of Measurement: '%s'", prefix, obj->traits.get_unit_of_measurement_ref().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj->traits.get_device_class().empty()) {
|
if (!obj->traits.get_device_class_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->traits.get_device_class().c_str());
|
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->traits.get_device_class_ref().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,8 +12,8 @@ namespace select {
|
|||||||
#define LOG_SELECT(prefix, type, obj) \
|
#define LOG_SELECT(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,14 +18,14 @@ void log_sensor(const char *tag, const char *prefix, const char *type, Sensor *o
|
|||||||
"%s Unit of Measurement: '%s'\n"
|
"%s Unit of Measurement: '%s'\n"
|
||||||
"%s Accuracy Decimals: %d",
|
"%s Accuracy Decimals: %d",
|
||||||
prefix, type, obj->get_name().c_str(), prefix, state_class_to_string(obj->get_state_class()).c_str(),
|
prefix, type, obj->get_name().c_str(), prefix, state_class_to_string(obj->get_state_class()).c_str(),
|
||||||
prefix, obj->get_unit_of_measurement().c_str(), prefix, obj->get_accuracy_decimals());
|
prefix, obj->get_unit_of_measurement_ref().c_str(), prefix, obj->get_accuracy_decimals());
|
||||||
|
|
||||||
if (!obj->get_device_class().empty()) {
|
if (!obj->get_device_class_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->get_device_class().c_str());
|
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->get_device_class_ref().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj->get_icon().empty()) {
|
if (!obj->get_icon_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon().c_str());
|
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon_ref().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->get_force_update()) {
|
if (obj->get_force_update()) {
|
||||||
@@ -128,7 +128,7 @@ void Sensor::internal_send_state_to_frontend(float state) {
|
|||||||
this->set_has_state(true);
|
this->set_has_state(true);
|
||||||
this->state = state;
|
this->state = state;
|
||||||
ESP_LOGD(TAG, "'%s': Sending state %.5f %s with %d decimals of accuracy", this->get_name().c_str(), state,
|
ESP_LOGD(TAG, "'%s': Sending state %.5f %s with %d decimals of accuracy", this->get_name().c_str(), state,
|
||||||
this->get_unit_of_measurement().c_str(), this->get_accuracy_decimals());
|
this->get_unit_of_measurement_ref().c_str(), this->get_accuracy_decimals());
|
||||||
this->callback_.call(state);
|
this->callback_.call(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,8 +91,8 @@ void log_switch(const char *tag, const char *prefix, const char *type, Switch *o
|
|||||||
LOG_STR_ARG(onoff));
|
LOG_STR_ARG(onoff));
|
||||||
|
|
||||||
// Add optional fields separately
|
// Add optional fields separately
|
||||||
if (!obj->get_icon().empty()) {
|
if (!obj->get_icon_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon().c_str());
|
ESP_LOGCONFIG(tag, "%s Icon: '%s'", prefix, obj->get_icon_ref().c_str());
|
||||||
}
|
}
|
||||||
if (obj->assumed_state()) {
|
if (obj->assumed_state()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Assumed State: YES", prefix);
|
ESP_LOGCONFIG(tag, "%s Assumed State: YES", prefix);
|
||||||
@@ -100,8 +100,8 @@ void log_switch(const char *tag, const char *prefix, const char *type, Switch *o
|
|||||||
if (obj->is_inverted()) {
|
if (obj->is_inverted()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Inverted: YES", prefix);
|
ESP_LOGCONFIG(tag, "%s Inverted: YES", prefix);
|
||||||
}
|
}
|
||||||
if (!obj->get_device_class().empty()) {
|
if (!obj->get_device_class_ref().empty()) {
|
||||||
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->get_device_class().c_str());
|
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->get_device_class_ref().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,8 @@ namespace text {
|
|||||||
#define LOG_TEXT(prefix, type, obj) \
|
#define LOG_TEXT(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,11 +14,11 @@ namespace text_sensor {
|
|||||||
#define LOG_TEXT_SENSOR(prefix, type, obj) \
|
#define LOG_TEXT_SENSOR(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
|
||||||
if (!(obj)->get_device_class().empty()) { \
|
if (!(obj)->get_device_class_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
if (!(obj)->get_icon().empty()) { \
|
if (!(obj)->get_icon_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ const extern float VALVE_CLOSED;
|
|||||||
if (traits_.get_is_assumed_state()) { \
|
if (traits_.get_is_assumed_state()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \
|
||||||
} \
|
} \
|
||||||
if (!(obj)->get_device_class().empty()) { \
|
if (!(obj)->get_device_class_ref().empty()) { \
|
||||||
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class().c_str()); \
|
ESP_LOGCONFIG(TAG, "%s Device Class: '%s'", prefix, (obj)->get_device_class_ref().c_str()); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user