Skip to content

Commit 421bf61

Browse files
xchillxxclaude
andcommitted
No solar start/PV end in the battery line, no reason column in the device table (v3.1.22)
User 11.10.: both were shown twice on the dashboard - solar start / PV end are in the footer, the device reasons in the explanation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 127756d commit 421bf61

3 files changed

Lines changed: 9 additions & 16 deletions

File tree

‎custom_components/surplus_pilot/coordinator.py‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ def explain(self) -> list[str]:
941941

942942
def _battery_line(self, d: dict) -> str:
943943
"""Home battery: how long it lasts at the current draw down to the
944-
reserve, and when the PV starts (or ends, during the PV day)."""
944+
reserve, and at night whether that is enough until the PV start."""
945945
now = dt_util.now()
946946
soc = d["akku_soc"]
947947
reserve = float(self.cfg.get(CONF_BATTERY_MIN_SOC, DEFAULT_BATTERY_MIN_SOC))
@@ -952,22 +952,15 @@ def _battery_line(self, d: dict) -> str:
952952
def num(v: float) -> str:
953953
return f"{v:.1f}".replace(".", ",")
954954

955-
def until(t: datetime) -> str:
956-
return f"in {num(max(0.0, (t - now).total_seconds() / 3600))} h ({t.strftime('%H:%M')})"
957-
958-
# during the PV day the next solar start is tomorrow, after the PV end
959-
pv_day = now < end < start
955+
# solar start / PV end are in the dashboard footer: only the verdict here
960956
txt = f"Hausakku {soc:.0f} %"
961957
drain = self._battery_drain_kw
962958
if drain is None or drain < 0.05:
963-
if drain is not None and drain < -0.05:
964-
txt += " — wird geladen"
965-
return txt + (f" · PV-Ende {until(end)}" if pv_day else f" · PV-Start {until(start)}")
959+
return txt + (" — wird geladen" if drain is not None and drain < -0.05 else "")
966960
last_h = max(0.0, (soc - reserve) / 100.0 * cap) / drain
967961
empty = now + timedelta(hours=last_h)
968962
txt += (f": reicht noch {num(last_h)} h bis {reserve:.0f} % (~{empty.strftime('%H:%M')}, "
969963
f"bei {self._kw(drain)})")
970-
if pv_day:
971-
return txt + f" · PV-Ende {until(end)}"
972-
txt += f" · PV-Start {until(start)}"
964+
if now < end < start: # PV day: the next solar start is tomorrow
965+
return txt
973966
return txt + (" ✅" if empty >= start else " ⚠️ reicht nicht bis PV-Start")

‎custom_components/surplus_pilot/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"iot_class": "local_polling",
1010
"issue_tracker": "https://github.com/xchillxx/surplus-pilot/issues",
1111
"requirements": [],
12-
"version": "3.1.21"
12+
"version": "3.1.22"
1313
}

‎dashboards/surplus-pilot.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ views:
136136
icon: mdi:power-plug
137137
- type: markdown
138138
content: |
139-
| Device | | Reason | Runtime today | Power |
140-
|---|---|---|---|---|
141-
{% for e in integration_entities('surplus_pilot') | sort if e.startswith('sensor.') and state_attr(e, 'laufzeit_heute_h') is not none %}{% set a = states[e].attributes %}| **{{ a.name }}** | {{ '🟢 on' if a.an else '⚪ off' }}{% if a.schaltet_in_s %} → {{ 'on' if a.soll_an else 'off' }} in {{ (a.schaltet_in_s / 60) | round(0) | int }} min{% endif %} | {{ state_translated(e) }}{% if a.akku_leer_um %} · empty ~{{ (as_datetime(a.akku_leer_um) | as_local).strftime('%H:%M') }}{% endif %} | {{ a.laufzeit_heute_h | round(1) }} h | {{ a.leistung_kw | round(2) }} kW |
139+
| Device | | Runtime today | Power |
140+
|---|---|---|---|
141+
{% for e in integration_entities('surplus_pilot') | sort if e.startswith('sensor.') and state_attr(e, 'laufzeit_heute_h') is not none %}{% set a = states[e].attributes %}| **{{ a.name }}** | {{ '🟢 on' if a.an else '⚪ off' }}{% if a.schaltet_in_s %} → {{ 'on' if a.soll_an else 'off' }} in {{ (a.schaltet_in_s / 60) | round(0) | int }} min{% endif %} | {{ a.laufzeit_heute_h | round(1) }} h | {{ a.leistung_kw | round(2) }} kW |
142142
{% endfor %}
143143
# one tile per device: Off = Surplus Pilot leaves the device alone
144144
- type: tile

0 commit comments

Comments
 (0)