Session status event without `sessionEnergy` kills the websocket reader (MissingField in PeblarSessionMeterData)
還沒有人認領這個 Issue。
評估
研究方向
Start by reading PeblarSessionMeterData and PeblarSessionStatus.from_dict() in the package, then trace the session status callback and _read_messages error handling mentioned in the traceback. Check the existing tests for session status payloads and add coverage for the shown payload without sessionEnergy and for malformed messages. Done when the status parses and a bad payload does not terminate the websocket reader.
由索引模型根據 Issue 內容生成。
描述
What happens
With no car connected, the charger's session status event carries a meter_data object without sessionEnergy. PeblarSessionMeterData declares session_energy as a required int, so PeblarSessionStatus.from_dict() raises and the websocket reader task dies. The charger sends the current status right after subscribing, so this happens on every connect while no car is plugged in.
Payload received (energy counter rounded):
{'instantaneousPower': [0, 0, 0], 'totalEnergy': 1700000}
Traceback
mashumaro.exceptions.MissingField: Field "session_energy" of type int is missing in PeblarSessionMeterData instance
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/peblar/websocket.py", line 41, in async_run
await self._async_listen()
File "/usr/local/lib/python3.14/site-packages/peblar/websocket.py", line 209, in disconnect
await self._reader
File "/usr/local/lib/python3.14/site-packages/peblar/websocket.py", line 267, in _read_messages
self._handle_message(payload)
File "/usr/local/lib/python3.14/site-packages/peblar/websocket.py", line 323, in _handle_message
callback(data)
File "/usr/local/lib/python3.14/site-packages/peblar/websocket.py", line 129, in <lambda>
lambda data: callback(PeblarSessionStatus.from_dict(data)),
mashumaro.exceptions.InvalidFieldValue: Field "meter_data" of type Optional[PeblarSessionMeterData] in PeblarSessionStatus has invalid value {'instantaneousPower': [0, 0, 0], 'totalEnergy': 1700000}
Effect in Home Assistant
The exception is a mashumaro error, not a PeblarError, so the retry loop in the integration's PeblarSessionListener.async_run does not catch it. The listener task ends with "Task exception was never retrieved" (once per start) and is not restarted until the entry is reloaded. Polling continues, so entities keep updating; only the early refresh on a session change is lost.
Expected
A session status without sessionEnergy parses (field optional, or defaulting to 0), and a payload that fails to parse does not end the reader. The comment in _read_messages already states that intent for unparsable JSON.
Versions
- peblar 2.1.0
- Home Assistant Core 2026.11.2
- Charger firmware 1.10.0+1+WL-1, customization Peblar-1.16
- State at the time: no EV connected
- 主要語言
- Python
- 星號
- 12
- 分支
- 10
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
frenck/python-peblar 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 64/100
frenck/python-peblar#466 · 1 則留言 ·
-
no-stale
難度 4/5 3-5 天 新手友好度 20/100
frenck/python-peblar#4 ·
查看 frenck/python-peblar 的全部 Issue
相似的 Issue
-
docs(contributing): the two things that silently block a PR可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉available documentation good first issue
難度 1/5 1-3 小時 新手友好度 95/100
Nixitov/Riptide-Native#944 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 88/100
JTHCode/secretguard#24 ·
維護者通常 1 天內回覆
-
area: middleware documentation good first issue
難度 2/5 1-3 小時 新手友好度 88/100
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
good first issue
難度 1/5 1 小時以內 新手友好度 95/100
omarelshamy25x/shamy-hijri#63 ·
維護者通常 1 天內回覆