Skip to content

v1.14.8: Test coverage for STATUS.XML binary sensors

Choose a tag to compare

@pvyleta pvyleta released this 19 Apr 19:53

Test coverage for STATUS.XML binary sensors

Added 8 comprehensive unit tests to prevent regressions of the binary_sensor bugs fixed in v1.14.6-v1.14.7.

Tests added

tests/test_binary_sensor_integration.py (4 tests):

  • Verifies XCCBinarySensor inherits from XCCEntity (not just CoordinatorEntity)
  • Verifies init signature matches other platforms (takes entity_data dict, not entity_id string)
  • Verifies async_setup_entry uses get_entities_by_type("binary_sensor") - singular, not plural
  • Verifies all BOOL fields in STATUS_XML_DESCRIPTOR have entity_type="binary_sensor"

tests/test_status_xml_simple.py (4 tests):

  • Verifies STATUS.XML sample data file exists and contains expected fields (SVYKON, SCHLAZENI, SOBEH0RUN, etc.)
  • Verifies STATUS_XML_DESCRIPTOR has all required fields with correct structure (entity_type, friendly_name, unit, writable)
  • Verifies all 26 BOOL fields (SCHLAZENI, STEPTUV, SOBEH0-9 RUN/VIS, etc.) are declared as binary_sensor
  • Regression test for the v1.14.6 routing fix - verifies binary_sensor entities route to binary_sensors bucket, not sensors

Why these tests matter

The bugs in v1.14.6 and v1.14.7 prevented ALL binary sensor entities from being created:

  • v1.14.6: Missing elif branch in coordinator routing sent binary_sensors to sensors bucket
  • v1.14.7: XCCBinarySensor inherited from wrong base class and crashed on init with AttributeError

These tests use source code inspection to catch such issues without requiring a full Home Assistant environment.

Related

  • v1.14.5: Added STATUS.XML scraping
  • v1.14.6: Fixed binary_sensor routing
  • v1.14.7: Fixed XCCBinarySensor initialization
  • v1.14.8: Added tests to prevent regressions