Skip to content

Publish EIC event-code and protection sensors for seplos_bms_v3_ble#235

Merged
syssi merged 1 commit into
mainfrom
feat/eic-event-code-sensors
Jun 4, 2026
Merged

Publish EIC event-code and protection sensors for seplos_bms_v3_ble#235
syssi merged 1 commit into
mainfrom
feat/eic-event-code-sensors

Conversation

@syssi

@syssi syssi commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

decode_eic_data_ parses the EIC status block (registers 0x2200–0x2248, function 0x01) but only published problem_code/problem_text. This publishes the remaining EIC entities — already defined in the schema, example YAML and header, but never fed:

Entity Type Source Meaning
system_state_code sensor data[0] (TB09) operating state
voltage_event_code sensor data[1] (TB02) voltage events
temperature_event_code sensor data[2]+data[3] (TB03+TB04) combined cell + ambient/power temperature events
current_event_code sensor data[4] (TB05) current events
voltage_protection binary_sensor data[1] != 0 voltage fault
temperature_protection binary_sensor data[2] != 0 || (data[3] & 0x3F) != 0 temperature fault (heating masked)
current_protection binary_sensor data[4] != 0 || data[5] != 0 current fault
system_fault binary_sensor data[9] != 0 hard fault (TB15)
heating binary_sensor data[3] & 0x40 low-temperature heating active (TB04 bit6)

TB03 + TB04 combined

The cell-temperature (TB03, data[2]) and ambient/power-temperature (TB04, data[3]) tables are merged into one temperature_event_code — TB03 in the high byte, TB04 in the low byte — so neither table is dropped and no extra sensor is needed. The "low temperature heating" bit (TB04 bit6) is kept in the raw code but masked out of temperature_protection, since heating is an operating state, not a fault — it instead drives a dedicated heating binary sensor.

Changes

  • seplos_bms_v3_ble.cpp: publish the four event-code sensors and four protection/fault binary sensors in decode_eic_data_; combine TB03+TB04; drop the now-redundant per-event ESP_LOGD (the values are published) and the unused name field on the lookup table
  • frames.h: new EIC_DATA_AMBIENT_TEMP capture (TB04 real fault bit, distinct from the heating status bit)
  • seplos_bms_v3_ble_test.cpp: tests for every event code and binary sensor, the combined temperature path, the heating-vs-fault distinction, and the null-sensor path

No test.host.yaml changes — sensors are exercised by the unit tests and the example YAML already lists every EIC entity.

Testing

  • pre-commit run --all-files — all hooks pass
  • ./run-cpp-tests.sh seplos_bms_v3_ble seplos_bms_v3_ble_pack — 36/36 pass, incl. 11 EIC tests

@syssi syssi force-pushed the feat/eic-event-code-sensors branch from c48a989 to b156370 Compare June 4, 2026 19:42
@syssi syssi changed the title Publish EIC event-code sensors and protection binary sensors for seplos_bms_v3_ble Publish EIC event-code and protection sensors for seplos_bms_v3_ble Jun 4, 2026
@syssi syssi force-pushed the feat/eic-event-code-sensors branch 2 times, most recently from 6e300dd to 88c46e7 Compare June 4, 2026 20:06
decode_eic_data_ only published problem_code/problem_text. Publish the
remaining EIC entities (already defined in the schema): the system state,
voltage, temperature and current event codes, the voltage, temperature,
current protection and system-fault binary sensors, plus a dedicated
heating binary sensor for the "low temperature heating" state.

The cell-temperature (TB03) and ambient/power-temperature (TB04) tables
are merged into a single temperature event code (TB03 high byte, TB04 low
byte) so no detail is lost. The heating status bit (TB04 bit6) drives the
heating binary sensor and stays in the raw code, but is masked out of the
temperature protection flag since heating is an operating state, not a
fault. problem_code is computed inline from the fault bytes; the per-event
debug log is dropped now that the values are published.

Covered by EIC tests for every code and binary sensor, including a new
EIC_DATA_AMBIENT_TEMP frame for the combined temperature path.
@syssi syssi force-pushed the feat/eic-event-code-sensors branch from 88c46e7 to 0731d23 Compare June 4, 2026 20:08
@syssi syssi merged commit c0e3cfa into main Jun 4, 2026
16 checks passed
@syssi syssi deleted the feat/eic-event-code-sensors branch June 15, 2026 19:57
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