- Fix extract_packed_value regex to handle commas in entity names
by matching C++ string literals instead of [^,]+
- Only describe dc/uom/icon in comments when their index is actually
non-zero, so comment matches what was packed
Tests now verify packed values via comment strings and non-zero
checks rather than decoding individual bit positions. This removes
the coupling to internal bit layout constants.
All internal-flag tests now extract the packed value and verify
bit 24 is set/clear for the correct entities, instead of just
checking configure_entity_() call presence.
All internal-flag tests now extract the packed value and verify
bit 24 is set/clear for the correct entities, instead of just
checking configure_entity_() call presence.
Tests now go through _setup_entity_impl + setup_device_class/
setup_unit_of_measurement + finalize_entity_strings using real
CONF_* keys instead of internal _KEY_* constants.
- Remove hardcoded _ENTITY_CATEGORY_NAMES dict, derive from cv.ENTITY_CATEGORIES keys
- Remove redundant local import re (already at top level)
- Remove last setup_test_environment noqa line
- Sensor and text_sensor device_class tests now extract and verify the
packed argument is non-zero instead of just checking call presence
- Remove useless setup_test_environment fixture references in unit tests
Move set_internal(), set_disabled_by_default(), set_entity_category(),
and set_device() to protected on EntityBase. These were codegen-only
setters never intended for runtime use.
internal, disabled_by_default, and entity_category are now packed into
the existing configure_entity_() uint32 parameter alongside string
indices, eliminating up to 3 separate function calls per entity.
set_device() is renamed to set_device_() per protected naming convention
and remains a separate call (pointer can't be packed).
Entity category integer mapping is derived from cv.ENTITY_CATEGORIES
to stay in sync with the C++ enum automatically.
Log functions call global_logger->log_vprintf_() without a null check.
The test main.cpp skips the generated setup() (which calls
Logger::pre_setup()), so set up a static Logger before running tests.
Call global_logger->log_vprintf_() directly without null-checking
global_logger on every log call. Logger::pre_setup() sets global_logger
before any other component is created in the generated setup() function,
so it is guaranteed to be valid by the time any log function is invoked.
Also removes the __FlashStringHelper* esp_log_vprintf_ overload which
was dead code (only called from esp_log_printf_, never directly).
Add a Python codegen test to verify the ordering invariant, and a
comment on App.pre_setup() documenting the constraint.