Problem
core/bess/ha_api_controller.py hardcodes the HA service domain "number" (number.set_value) at multiple call sites when writing setpoints to Home Assistant. If a user repoints one of these auto-discovered entities to an input_number.* helper (e.g. to tap into the value from a custom automation), the write fails because number.set_value is called against an input_number.* entity_id — that service is scoped to the number platform only.
Reported in #349: a user wants to route the VPP power setpoint through an input_number.vpp_power helper so a HA automation can read what BESS is about to write before it hits the inverter, but BESS Manager only supports number.*.
Affected call sites
All in core/bess/ha_api_controller.py, hardcoding "number" as the service domain:
- charge/discharge stop SOC and power rate (~lines 1141, 1156, 1171, 1186)
- SolaX active power / autorepeat duration (~lines 1631, 1638)
- SolaX battery min SOC (~line 1679)
- Growatt VPP power / VPP fallback time (~lines 1778, 1787)
Proposed fix
Add a single helper (e.g. _set_number_like(entity_id, value, ...)) that inspects the entity_id's domain and dispatches to number.set_value vs input_number.set_value accordingly, and use it at all 9 call sites — following the existing precedent in set_grid_charge (ha_api_controller.py:1201-1232), which already branches on entity_id.startswith("select.") vs the switch domain for an analogous problem.
Entity ID format validation (backend/api_dataclasses.py _ENTITY_ID_RE) already accepts any domain.object_id, so no config-layer change is needed — this is purely a write-path fix.
Problem
core/bess/ha_api_controller.pyhardcodes the HA service domain"number"(number.set_value) at multiple call sites when writing setpoints to Home Assistant. If a user repoints one of these auto-discovered entities to aninput_number.*helper (e.g. to tap into the value from a custom automation), the write fails becausenumber.set_valueis called against aninput_number.*entity_id — that service is scoped to thenumberplatform only.Reported in #349: a user wants to route the VPP power setpoint through an
input_number.vpp_powerhelper so a HA automation can read what BESS is about to write before it hits the inverter, but BESS Manager only supportsnumber.*.Affected call sites
All in
core/bess/ha_api_controller.py, hardcoding"number"as the service domain:Proposed fix
Add a single helper (e.g.
_set_number_like(entity_id, value, ...)) that inspects the entity_id's domain and dispatches tonumber.set_valuevsinput_number.set_valueaccordingly, and use it at all 9 call sites — following the existing precedent inset_grid_charge(ha_api_controller.py:1201-1232), which already branches onentity_id.startswith("select.")vs theswitchdomain for an analogous problem.Entity ID format validation (
backend/api_dataclasses.py_ENTITY_ID_RE) already accepts anydomain.object_id, so no config-layer change is needed — this is purely a write-path fix.