EV-03 review: one power-unit table for the probe and the reading
POWER_UNITS is now derived from _W_PER, so the start-up probe and the reading cannot drift apart. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
af7e96e5e5
commit
d7b4298092
@@ -87,7 +87,9 @@ REQUIRED = ("current", "readback", "state", "power")
|
||||
_SETPOINT_RE = re.compile(r"^number\.(?P<x>.+)_" + SETPOINT_SUFFIX + "$")
|
||||
|
||||
_ROLE_ORDER = tuple(ROLES)
|
||||
POWER_UNITS = ("mW", "W", "kW", "MW") # every HA power unit, converted
|
||||
#: power unit -> W. The probe and the reading both use this one table.
|
||||
_W_PER = {"mW": 0.001, "W": 1.0, "kW": 1000.0, "MW": 1000000.0}
|
||||
POWER_UNITS = tuple(_W_PER)
|
||||
|
||||
|
||||
def census_key(entity) -> str:
|
||||
@@ -155,9 +157,6 @@ def _amps(obj):
|
||||
return None
|
||||
|
||||
|
||||
_W_PER = {"mW": 0.001, "W": 1.0, "kW": 1000.0, "MW": 1000000.0}
|
||||
|
||||
|
||||
def _watts(obj):
|
||||
"""Power in W, believed only in a power unit (its own copy of the rule: the
|
||||
PV channel's reader stays out of the charger's, test_pv.py part 6)."""
|
||||
|
||||
Reference in New Issue
Block a user