Skip to content

Migration from pledou/enocean Chained Packet, Ventilairsec & EEP#35

Open
pledou wants to merge 8 commits into
ChristopheHD:masterfrom
pledou:migration-to-christophehd
Open

Migration from pledou/enocean Chained Packet, Ventilairsec & EEP#35
pledou wants to merge 8 commits into
ChristopheHD:masterfrom
pledou:migration-to-christophehd

Conversation

@pledou

@pledou pledou commented Jun 2, 2026

Copy link
Copy Markdown

Migration Notes: ChristopheHD + VentilAirSec Features

Overview

This branch (migration-to-christophehd) combines:

  • Base: ChristopheHD's fork with security fixes and enhancements
  • Added: VentilAirSec support and multi-frame telegram handling
  • Result: Secure, feature-rich EnOcean library

Migration Timeline

Date: June 2026
From: pledou/enocean master branch
To: ChristopheHD/enocean master + VentilAirSec features
Common Ancestor: commit 80a253b

Changes Applied

Commit History

  1. 46db671: Add ChainedPacket support for multi-frame MSC telegrams

    • Added RORG.CHAINED (0xC8) and RORG.CHAINED_VENTILAIRSEC (0x40)
    • Implemented 287-line ChainedPacket class with frame reassembly
    • Added global _CHAINED_STORAGE for buffering incomplete telegrams
    • Modified Packet.parse_msg() to detect and assemble multi-frame packets
  2. 23d82ae: Add eep_metadata module and EEP singleton pattern

    • New file: enocean/protocol/eep_metadata.py (157 lines)
    • Added get_eep() function for thread-safe singleton access
    • Added reload_eep() for forcing EEP.xml reload
    • Implemented field metadata utilities
  3. 9ec0725: Enhance RadioPacket with VLD and MSC command extraction

    • Added MSC manufacturer ID extraction (bits 0-11)
    • Added MSC command extraction (bits 12-15) for VentilAirSec
    • Enhanced RadioPacket.parse() with automatic field population
    • Added packet.manufacturer and packet.command attributes
  4. edb9695: Merge VentilAirSec and D2-01-12 profiles into EEP.xml

    • Added D2-01-12 Electronic Switch profile (351 lines, starting at line 2686)
    • Added VentilAirSec MSC telegram 0xD1079 (680 lines, starting at line 5810)
    • Total additions: +1031 lines to EEP.xml
  5. ce44a9e: Add comprehensive test suite for ChainedPacket and VentilAirSec

    • test_chained_packets.py: 12 tests for multi-frame reassembly
    • test_ventilairsec_regression.py: 2 regression tests
    • test_packet_parse_and_log.py: 3 parser tests
    • test_real_capture_sequence.py: 1 real-world capture test
    • conftest.py: pytest-asyncio compatibility
    • Total: 21 new tests, all passing

Integration Status

Tested With

  • enocean library tests: 21/21 passing
  • ha-enocean-repo tests: 81/81 passing
  • Home Assistant integration: Full compatibility

Known Compatible Projects

  • Home Assistant EnOcean Extended integration
  • VentilAirSec ventilation systems
  • D2-01-12 electronic switches

API Compatibility

Backward Compatible

All existing code using the library continues to work without changes:

  • Packet.parse_msg() still returns regular packets
  • ChainedPackets only appear when complete (transparent to existing code)
  • All existing RORG constants unchanged

New APIs

# New RORG constants
from enocean.protocol.constants import RORG
RORG.CHAINED              # 0xC8
RORG.CHAINED_VENTILAIRSEC # 0x40

# New packet type
from enocean.protocol.packet import ChainedPacket

# EEP singleton
from enocean.protocol.eep import get_eep, reload_eep
eep = get_eep()

# MSC packet attributes
packet.manufacturer  # Manufacturer ID (bits 0-11)
packet.command      # Command nibble (bits 12-15)

Performance Considerations

Memory Usage

  • _CHAINED_STORAGE: Stores incomplete telegrams (max ~10 concurrent)
  • Each incomplete telegram: ~50-200 bytes
  • Total overhead: <5KB under normal conditions

CPU Impact

  • Minimal: Frame matching is O(1) hash lookup
  • Telegram assembly: Only on multi-frame packets (<1% of traffic)
  • No performance degradation for standard packets

Pierre Leduc added 8 commits June 1, 2026 15:05
- Add RORG.CHAINED (0xC8) and RORG.CHAINED_VENTILAIRSEC (0x40) constants
- Add _CHAINED_STORAGE global for telegram reassembly
- Add ChainedPacket class (287 lines) to handle chained telegrams
- Update parse_msg() to detect and instantiate ChainedPacket
- Filter incomplete CHAINED packets from propagation
- Support both standard (0xC8) and VentilAirSec proprietary (0x40) chained formats
- Add eep_metadata.py (157 lines) for dynamic EEP field metadata
- Add get_eep() singleton function to eep.py to avoid repeated XML parsing
- Add reload_eep() function for forcing EEP reload
- Import threading.Lock for singleton thread-safety
- Add cmd attribute initialization in RadioPacket.parse()
- Add VLD command extraction from bits 8-11
- Add MSC manufacturer ID extraction from bits 0-11
- Add VentilAirSec-specific command extraction (4-bit at bits 12-15)
- Add fallback 8-bit command extraction for non-VentilAirSec MSC
- Maintain ChristopheHD's safe bounds checking
- Set contains_eep=False for MSC packets
- Add D2-01-12 (Electronic switch with Local Control) profile (351 lines)
  * Complete command set (13 commands)
  * Power failure detection, output control, measurement, pilot wire mode
  * External interface settings and status queries

- Add VentilAirSec MSC telegram (0xD1079) with profiles (680 lines)
  * Func 0x00, Type 0x00: Cyclic, Action, Awake, Clock, Test commands
  * Func 0x01, Type 0x00: Additional VentilAirSec functionality
  * Battery, temperature, humidity, CO2, VOC sensors
  * Bypass, boost, fan speed control
  * Comprehensive sensor and actuator support

Total: +1031 lines (5459 → 6490 lines)
EEP.xml structure validated and profiles load correctly
Test Coverage:
- test_chained_packets.py (520 lines, 12 tests)
  * CHAINED packet detection (0xC8 and 0x40)
  * Multi-frame telegram reassembly
  * Incomplete packet handling
  * Storage cleanup and independence
  * Out-of-order chunk handling

- test_ventilairsec_regression.py (242 lines, 2 tests)
  * Real VentilAirSec device capture sequences
  * 2-part and 3-part chained telegram tests

- test_packet_parse_and_log.py (391 lines, 3 tests)
  * Radio packet building and parsing
  * Real frame parsing from logs
  * Chained packet parsing validation

- test_real_capture_sequence.py (80 lines, 1 test)
  * Real device capture replay

- test_utils.py (30 lines, 3 tests)
  * Utility function tests (bit operations, hex conversion)

- conftest.py: Pytest configuration to prevent async fixture warnings

All 21 tests passing ✓
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant