Drop the redundant system mode sensor #86
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/drop-mode-sensor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CCS-HA-52. There were two representations of system mode on the bridge device: the "System mode" select and the diagnostic "System mode last known value" sensor. This drops the sensor.
No functionality moved over, because there was nothing to move: the select's
extra_state_attributesalready carried themodeword (including shutdown and values this build has no word for, which the select's owncurrent_optioncan't show), plusset_by,originandlatched. Retargeted the tests that read the sensor's state at the select'smodeattribute instead.CampervanModeEntityhad one subclass left after the sensor went, so it's folded intoCampervanSystemModedirectly rather than kept as a base class of one.The retired sensor entity will linger, disabled-looking but present, in the entity registry until someone deletes it by hand — nothing here purges it.
Checked the claim in the PR body against the code: the select's
extra_state_attributes["mode"]does carry the full mode word for bothshutdownand out-of-band values (0x7Fetc), same as the deleted sensor'snative_valuedid — nothing is lost. Theset_by/origin/latchedattributes and theasync_add_mode_listenerregistration moved across unchanged.No leftover references to
CampervanModeReading,CampervanModeEntity,SENSOR_KEYorreading_ofanywhere in the tree.The retargeted tests in
tests/test_modes.pystill assert the same facts the oldreading_of()ones did (shutdown reported whilecurrent_option/state stays unknown, unrecognised mode kept as0x.., mode belongs to the bridge device, confirmed shutdown broadcast) — just read offselect_of(hass)'smodeattribute instead of a separate entity. Nothing weakened.Folding
CampervanModeEntityintoCampervanSystemModeis the right call now it has one subclass — matches this repo's preference for deleting over keeping a one-implementation abstraction.ruff check,ruff format --checkand the fullpytestsuite (1207 passed, 3 skipped) all pass in the worktree.PR body is accurate, including the honest callout that the retired sensor will linger in the entity registry until removed by hand — worth knowing but not a reason to block this.
No findings to act on — this one's clean.