Session status event without `sessionEnergy` kills the websocket reader (MissingField in PeblarSessionMeterData)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 12
- Fork
- 10
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của frenck/python-peblar
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
frenck/python-peblar#466 · 1 bình luận ·
-
Dependency DashboardĐang mởno-stale
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
frenck/python-peblar#4 ·
Tất cả issue của frenck/python-peblar
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày