一键导入
marstek-open-api-udp
How this integration talks to Marstek devices via the local Open API over UDP (JSON messages) and how to handle errors safely
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How this integration talks to Marstek devices via the local Open API over UDP (JSON messages) and how to handle errors safely
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
How to create, update, and manage Changesets for release preparation in this repository
Guidance for using correct energy and power metrics in Home Assistant energy features
High-level Home Assistant integration best practices, quality scale cues, and testing/CI expectations for custom components
Patterns for Home Assistant config flows, discovery handlers, options flows, and reauth for custom components
Project-specific patterns for the Marstek integration (config flow, coordinator, scanner, entities, translations)
Practical test/CI playbook for Home Assistant custom components (config flow, coordinator, entities, diagnostics)
| name | marstek-open-api-udp |
| description | How this integration talks to Marstek devices via the local Open API over UDP (JSON messages) and how to handle errors safely |
This repository communicates with Marstek devices using the Open API over UDP as documented in docs/marstek_device_openapi.MD.
In code, this is encapsulated by the py-marstek library (pymarstek).
method and params, e.g.:
Marstek.GetDeviceES.GetStatus, ES.GetMode, Bat.GetStatus, PV.GetStatus, EM.GetStatusES.SetModeDiscovery pattern from the spec:
Parse error response (devices reacting to a non-JSON broadcast probe).method: Marstek.GetDevice to receive the device’s metadata including ip, ble_mac, wifi_mac, device, and ver.pymarstek.MarstekUDPClientawait udp_client.discover_devices(...) (config flow + scanner)await udp_client.send_request(...) (setup connectivity check)await udp_client.get_device_status(...) (coordinator polling)Important library behavior (current implementation):
get_device_status(...) can return default values on failure instead of raising.device_mode == "Unknown" as “no valid data received” and falls back to previous coordinator.data.The integration aims to be resilient to device/network flakiness:
ConfigEntryNotReady to let HA retry while the scanner updates IP if needed.Local API enablement:
Marstek devices can be sensitive to request bursts.
Control actions (ES.SetMode):
custom_components/marstek/device_action.py).device_mode=Unknown warnings (indicates no valid response).pymarstek + coordinator.