SAFETY-118: read the peak forecast in its own unit
peak_forecast_entity is read through pv.watts() by its unit_of_measurement; the abs(raw) < 50 size rule is gone. No unit or a non-power unit means the forecast is not used, with one warning per cause. The validator no longer claims a kW sensor is taken as watts for this entity. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
780c1f67bb
commit
f0b4e68e49
@@ -105,6 +105,13 @@ class _Hass:
|
||||
return self.power(u)
|
||||
return None
|
||||
|
||||
async def state(self, e):
|
||||
"""SAFETY-118: the peak forecast is read as a state object; every
|
||||
number this rig serves is in watts."""
|
||||
v = await self.number(e)
|
||||
return None if v is None else {
|
||||
"state": str(v), "attributes": {"unit_of_measurement": "W"}}
|
||||
|
||||
async def set_number(self, e, v):
|
||||
self.cmd[e[-1]] = float(v)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user