diff --git a/esphome/const.py b/esphome/const.py
index 58a997352f..c2bf86d532 100644
--- a/esphome/const.py
+++ b/esphome/const.py
@@ -102,7 +102,7 @@ PLATFORM_RP2040 = Platform.RP2040
PLATFORM_RTL87XX = Platform.RTL87XX
-SOURCE_FILE_EXTENSIONS = {".cpp", ".hpp", ".h", ".c", ".tcc", ".ino", ".inc"}
+SOURCE_FILE_EXTENSIONS = {".cpp", ".hpp", ".h", ".c", ".tcc", ".ino"}
HEADER_FILE_EXTENSIONS = {".h", ".hpp", ".tcc"}
SECRETS_FILES = ("secrets.yaml", "secrets.yml")
diff --git a/esphome/core/application.h b/esphome/core/application.h
index 6e4cdbc346..317631d62c 100644
--- a/esphome/core/application.h
+++ b/esphome/core/application.h
@@ -119,13 +119,13 @@ class Application {
void set_current_component(Component *component) { this->current_component_ = component; }
Component *get_current_component() { return this->current_component_; }
-// Entity register methods (generated from entity_types.inc)
+// Entity register methods (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) \
void register_##singular(type *obj) { this->plural##_.push_back(obj); }
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) \
ENTITY_TYPE_(type, singular, plural, count, upper)
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
@@ -272,14 +272,14 @@ class Application {
#ifdef USE_AREAS
const auto &get_areas() { return this->areas_; }
#endif
-// Entity getter methods (generated from entity_types.inc)
+// Entity getter methods (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) \
auto &get_##plural() const { return this->plural##_; } \
GET_ENTITY_METHOD(type, singular, plural)
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) \
ENTITY_TYPE_(type, singular, plural, count, upper)
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
@@ -463,12 +463,12 @@ class Application {
#ifdef USE_AREAS
StaticVector areas_{};
#endif
-// Entity StaticVector fields (generated from entity_types.inc)
+// Entity StaticVector fields (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) StaticVector plural##_{};
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) \
ENTITY_TYPE_(type, singular, plural, count, upper)
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
diff --git a/esphome/core/component_iterator.cpp b/esphome/core/component_iterator.cpp
index 9b5b8d1512..f4d3c05e19 100644
--- a/esphome/core/component_iterator.cpp
+++ b/esphome/core/component_iterator.cpp
@@ -33,7 +33,7 @@ void ComponentIterator::advance() {
}
break;
-// Entity iterator cases (generated from entity_types.inc)
+// Entity iterator cases (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) \
case IteratorState::upper: \
@@ -41,7 +41,7 @@ void ComponentIterator::advance() {
break;
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) \
ENTITY_TYPE_(type, singular, plural, count, upper)
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
diff --git a/esphome/core/component_iterator.h b/esphome/core/component_iterator.h
index f1e2fe4d52..9a1e5da351 100644
--- a/esphome/core/component_iterator.h
+++ b/esphome/core/component_iterator.h
@@ -28,12 +28,12 @@ class ComponentIterator {
void advance();
bool completed() const { return this->state_ == IteratorState::NONE; }
virtual bool on_begin();
-// Pure virtual entity callbacks (generated from entity_types.inc)
+// Pure virtual entity callbacks (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) virtual bool on_##singular(type *obj) = 0;
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) \
ENTITY_TYPE_(type, singular, plural, count, upper)
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
@@ -52,11 +52,11 @@ class ComponentIterator {
enum class IteratorState : uint8_t {
NONE = 0,
BEGIN,
-// Entity iterator states (generated from entity_types.inc)
+// Entity iterator states (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) upper,
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) upper,
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
diff --git a/esphome/core/controller.h b/esphome/core/controller.h
index 4f3c8d3352..09975b465f 100644
--- a/esphome/core/controller.h
+++ b/esphome/core/controller.h
@@ -6,11 +6,11 @@ namespace esphome {
class Controller {
public:
-// Controller virtual methods (generated from entity_types.inc)
+// Controller virtual methods (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) // no controller callback
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) virtual void on_##callback(type *obj){};
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
diff --git a/esphome/core/controller_registry.h b/esphome/core/controller_registry.h
index b2122d3314..c6113116ff 100644
--- a/esphome/core/controller_registry.h
+++ b/esphome/core/controller_registry.h
@@ -36,12 +36,12 @@ class ControllerRegistry {
*/
static void register_controller(Controller *controller) { controllers.push_back(controller); }
-// Notify method declarations (generated from entity_types.inc)
+// Notify method declarations (generated from entity_types.h)
// NOLINTBEGIN(bugprone-macro-parentheses)
#define ENTITY_TYPE_(type, singular, plural, count, upper) // no controller callback
#define ENTITY_CONTROLLER_TYPE_(type, singular, plural, count, upper, callback) \
static void notify_##callback(type *obj);
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
@@ -72,7 +72,7 @@ namespace esphome {
controller->on_##callback(obj); \
} \
}
-#include "esphome/core/entity_types.inc"
+#include "esphome/core/entity_types.h"
#undef ENTITY_TYPE_
#undef ENTITY_CONTROLLER_TYPE_
// NOLINTEND(bugprone-macro-parentheses)
diff --git a/esphome/core/entity_types.inc b/esphome/core/entity_types.h
similarity index 82%
rename from esphome/core/entity_types.inc
rename to esphome/core/entity_types.h
index ff8b1eb065..3287a943a3 100644
--- a/esphome/core/entity_types.inc
+++ b/esphome/core/entity_types.h
@@ -14,7 +14,8 @@
// - serial_proxy: custom register logic, no by-key lookup
#ifdef USE_BINARY_SENSOR
-ENTITY_CONTROLLER_TYPE_(binary_sensor::BinarySensor, binary_sensor, binary_sensors, ESPHOME_ENTITY_BINARY_SENSOR_COUNT, BINARY_SENSOR, binary_sensor_update)
+ENTITY_CONTROLLER_TYPE_(binary_sensor::BinarySensor, binary_sensor, binary_sensors, ESPHOME_ENTITY_BINARY_SENSOR_COUNT,
+ BINARY_SENSOR, binary_sensor_update)
#endif
#ifdef USE_COVER
ENTITY_CONTROLLER_TYPE_(cover::Cover, cover, covers, ESPHOME_ENTITY_COVER_COUNT, COVER, cover_update)
@@ -35,7 +36,8 @@ ENTITY_CONTROLLER_TYPE_(switch_::Switch, switch, switches, ESPHOME_ENTITY_SWITCH
ENTITY_TYPE_(button::Button, button, buttons, ESPHOME_ENTITY_BUTTON_COUNT, BUTTON)
#endif
#ifdef USE_TEXT_SENSOR
-ENTITY_CONTROLLER_TYPE_(text_sensor::TextSensor, text_sensor, text_sensors, ESPHOME_ENTITY_TEXT_SENSOR_COUNT, TEXT_SENSOR, text_sensor_update)
+ENTITY_CONTROLLER_TYPE_(text_sensor::TextSensor, text_sensor, text_sensors, ESPHOME_ENTITY_TEXT_SENSOR_COUNT,
+ TEXT_SENSOR, text_sensor_update)
#endif
#ifdef USE_CLIMATE
ENTITY_CONTROLLER_TYPE_(climate::Climate, climate, climates, ESPHOME_ENTITY_CLIMATE_COUNT, CLIMATE, climate_update)
@@ -50,7 +52,8 @@ ENTITY_CONTROLLER_TYPE_(datetime::DateEntity, date, dates, ESPHOME_ENTITY_DATE_C
ENTITY_CONTROLLER_TYPE_(datetime::TimeEntity, time, times, ESPHOME_ENTITY_TIME_COUNT, DATETIME_TIME, time_update)
#endif
#ifdef USE_DATETIME_DATETIME
-ENTITY_CONTROLLER_TYPE_(datetime::DateTimeEntity, datetime, datetimes, ESPHOME_ENTITY_DATETIME_COUNT, DATETIME_DATETIME, datetime_update)
+ENTITY_CONTROLLER_TYPE_(datetime::DateTimeEntity, datetime, datetimes, ESPHOME_ENTITY_DATETIME_COUNT, DATETIME_DATETIME,
+ datetime_update)
#endif
#ifdef USE_TEXT
ENTITY_CONTROLLER_TYPE_(text::Text, text, texts, ESPHOME_ENTITY_TEXT_COUNT, TEXT, text_update)
@@ -65,13 +68,16 @@ ENTITY_CONTROLLER_TYPE_(lock::Lock, lock, locks, ESPHOME_ENTITY_LOCK_COUNT, LOCK
ENTITY_CONTROLLER_TYPE_(valve::Valve, valve, valves, ESPHOME_ENTITY_VALVE_COUNT, VALVE, valve_update)
#endif
#ifdef USE_MEDIA_PLAYER
-ENTITY_CONTROLLER_TYPE_(media_player::MediaPlayer, media_player, media_players, ESPHOME_ENTITY_MEDIA_PLAYER_COUNT, MEDIA_PLAYER, media_player_update)
+ENTITY_CONTROLLER_TYPE_(media_player::MediaPlayer, media_player, media_players, ESPHOME_ENTITY_MEDIA_PLAYER_COUNT,
+ MEDIA_PLAYER, media_player_update)
#endif
#ifdef USE_ALARM_CONTROL_PANEL
-ENTITY_CONTROLLER_TYPE_(alarm_control_panel::AlarmControlPanel, alarm_control_panel, alarm_control_panels, ESPHOME_ENTITY_ALARM_CONTROL_PANEL_COUNT, ALARM_CONTROL_PANEL, alarm_control_panel_update)
+ENTITY_CONTROLLER_TYPE_(alarm_control_panel::AlarmControlPanel, alarm_control_panel, alarm_control_panels,
+ ESPHOME_ENTITY_ALARM_CONTROL_PANEL_COUNT, ALARM_CONTROL_PANEL, alarm_control_panel_update)
#endif
#ifdef USE_WATER_HEATER
-ENTITY_CONTROLLER_TYPE_(water_heater::WaterHeater, water_heater, water_heaters, ESPHOME_ENTITY_WATER_HEATER_COUNT, WATER_HEATER, water_heater_update)
+ENTITY_CONTROLLER_TYPE_(water_heater::WaterHeater, water_heater, water_heaters, ESPHOME_ENTITY_WATER_HEATER_COUNT,
+ WATER_HEATER, water_heater_update)
#endif
#ifdef USE_INFRARED
ENTITY_TYPE_(infrared::Infrared, infrared, infrareds, ESPHOME_ENTITY_INFRARED_COUNT, INFRARED)
diff --git a/script/ci-custom.py b/script/ci-custom.py
index 1ec3eab3a9..6dce86924e 100755
--- a/script/ci-custom.py
+++ b/script/ci-custom.py
@@ -672,7 +672,7 @@ def lint_using_esp_idf_deprecated(fname, line, col, content):
)
-@lint_content_check(include=["*.h"])
+@lint_content_check(include=["*.h"], exclude=["esphome/core/entity_types.h"])
def lint_pragma_once(fname, content):
if "#pragma once" not in content:
return (