mirror of
https://github.com/esphome/esphome.git
synced 2026-05-27 11:56:11 +08:00
[climate] Use C++17 nested namespace syntax (#12194)
CI / Create common environment (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (macOS-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Run pytest (windows-latest, 3.11) (push) Has been cancelled
CI / Determine which jobs to run (push) Has been cancelled
CI / Run integration tests (push) Has been cancelled
CI / Run C++ unit tests (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / Run script/clang-tidy for ZEPHYR (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Test components batch (${{ matrix.components }}) (push) Has been cancelled
CI / pre-commit.ci lite (push) Has been cancelled
CI / Build target branch for memory impact (push) Has been cancelled
CI / Build PR branch for memory impact (push) Has been cancelled
CI / Comment memory impact (push) Has been cancelled
CI / CI Status (push) Has been cancelled
Synchronise Device Classes from Home Assistant / Sync Device Classes (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04-arm) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04-arm) (push) Has been cancelled
CI / Create common environment (push) Has been cancelled
CI / Check pylint (push) Has been cancelled
CI / Run script/ci-custom (push) Has been cancelled
CI / Run pytest (macOS-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.11) (push) Has been cancelled
CI / Run pytest (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Run pytest (windows-latest, 3.11) (push) Has been cancelled
CI / Determine which jobs to run (push) Has been cancelled
CI / Run integration tests (push) Has been cancelled
CI / Run C++ unit tests (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 IDF (push) Has been cancelled
CI / Run script/clang-tidy for ESP8266 (push) Has been cancelled
CI / Run script/clang-tidy for ZEPHYR (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Has been cancelled
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Has been cancelled
CI / Test components batch (${{ matrix.components }}) (push) Has been cancelled
CI / pre-commit.ci lite (push) Has been cancelled
CI / Build target branch for memory impact (push) Has been cancelled
CI / Build PR branch for memory impact (push) Has been cancelled
CI / Comment memory impact (push) Has been cancelled
CI / CI Status (push) Has been cancelled
Synchronise Device Classes from Home Assistant / Sync Device Classes (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (docker, ubuntu-24.04-arm) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04) (push) Has been cancelled
CI for docker images / Build docker containers (ha-addon, ubuntu-24.04-arm) (push) Has been cancelled
This commit is contained in:
@@ -3,8 +3,7 @@
|
|||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "climate.h"
|
#include "climate.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
template<typename... Ts> class ControlAction : public Action<Ts...> {
|
template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
@@ -58,5 +57,4 @@ class StateTrigger : public Trigger<Climate &> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
#include "esphome/core/controller_registry.h"
|
#include "esphome/core/controller_registry.h"
|
||||||
#include "esphome/core/macros.h"
|
#include "esphome/core/macros.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
static const char *const TAG = "climate";
|
static const char *const TAG = "climate";
|
||||||
|
|
||||||
@@ -762,5 +761,4 @@ void Climate::dump_traits_(const char *tag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
#include "climate_mode.h"
|
#include "climate_mode.h"
|
||||||
#include "climate_traits.h"
|
#include "climate_traits.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
#define LOG_CLIMATE(prefix, type, obj) \
|
#define LOG_CLIMATE(prefix, type, obj) \
|
||||||
if ((obj) != nullptr) { \
|
if ((obj) != nullptr) { \
|
||||||
@@ -345,5 +344,4 @@ class Climate : public EntityBase {
|
|||||||
const char *custom_preset_{nullptr};
|
const char *custom_preset_{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "climate_mode.h"
|
#include "climate_mode.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
const LogString *climate_mode_to_string(ClimateMode mode) {
|
const LogString *climate_mode_to_string(ClimateMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
@@ -107,5 +106,4 @@ const LogString *climate_preset_to_string(ClimatePreset preset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
/// Enum for all modes a climate device can be in.
|
/// Enum for all modes a climate device can be in.
|
||||||
/// NOTE: If adding values, update ClimateModeMask in climate_traits.h to use the new last value
|
/// NOTE: If adding values, update ClimateModeMask in climate_traits.h to use the new last value
|
||||||
@@ -132,5 +131,4 @@ const LogString *climate_swing_mode_to_string(ClimateSwingMode mode);
|
|||||||
/// Convert the given PresetMode to a human-readable string.
|
/// Convert the given PresetMode to a human-readable string.
|
||||||
const LogString *climate_preset_to_string(ClimatePreset preset);
|
const LogString *climate_preset_to_string(ClimatePreset preset);
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "climate_traits.h"
|
#include "climate_traits.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
int8_t ClimateTraits::get_target_temperature_accuracy_decimals() const {
|
int8_t ClimateTraits::get_target_temperature_accuracy_decimals() const {
|
||||||
return step_to_accuracy_decimals(this->visual_target_temperature_step_);
|
return step_to_accuracy_decimals(this->visual_target_temperature_step_);
|
||||||
@@ -11,5 +10,4 @@ int8_t ClimateTraits::get_current_temperature_accuracy_decimals() const {
|
|||||||
return step_to_accuracy_decimals(this->visual_current_temperature_step_);
|
return step_to_accuracy_decimals(this->visual_current_temperature_step_);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
#include "esphome/core/finite_set_mask.h"
|
#include "esphome/core/finite_set_mask.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::climate {
|
||||||
namespace climate {
|
|
||||||
|
|
||||||
// Type aliases for climate enum bitmasks
|
// Type aliases for climate enum bitmasks
|
||||||
// These replace std::set<EnumType> to eliminate red-black tree overhead
|
// These replace std::set<EnumType> to eliminate red-black tree overhead
|
||||||
@@ -292,5 +291,4 @@ class ClimateTraits {
|
|||||||
std::vector<const char *> supported_custom_presets_;
|
std::vector<const char *> supported_custom_presets_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace climate
|
} // namespace esphome::climate
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
Reference in New Issue
Block a user