Skip to content

Commit a1f2a8e

Browse files
committed
feat: Add Deye EV Charger (SUN-EVSE**K01-EU-AC) support
Adds full support for the Deye EV Charger (SUN-EVSE**K01-EU-AC) connected via Modbus slave ID 3. Profile covers: - Info: device identification, serial number, firmware/protocol version, rated power - Configuration: date/time, charging start mode (Plug & Play / Time Of Charge), communication mode (WiFi / LoRa), LoRa channel, grid voltage protection limits, off-grid charge inhibit switch, leakage current detection and protective earth detection switches - Time Of Charge: 4 scheduled charging time programs with enable switches; time stored as hours×12 + minute÷5 slot (dec: 12, mul: 5) - Control: Charging Power Limit (0x0012), writable setpoint with minimum power note (~1000 W / 4000 W per phase count) - Telemetry: Charger Policy State and Charger Operational State (IEC 61851) from packed register 0x0039; raw hex state; charging power and current per phase; grid voltage per phase; total and today energy counters Also fixes: - Rule 9 time parsing: added mul parameter to scale slot index back to minutes (parser.py, time.py)
1 parent ac1d88b commit a1f2a8e

5 files changed

Lines changed: 478 additions & 3 deletions

File tree

custom_components/solarman/const.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,14 @@
7878
AUTODETECTION_DEYE_MICRO = ((0x0004, 0x0400), "deye_micro.yaml")
7979
AUTODETECTION_DEYE_4P3 = ((0x0005, 0x0500), "deye_p3.yaml")
8080
AUTODETECTION_DEYE_1P3 = ((0x0006, 0x0007, 0x0600, 0x0008, 0x0601), "deye_p3.yaml")
81+
AUTODETECTION_DEYE_EVSE = ((0x0904,), "deye_evse.yaml")
8182
AUTODETECTION_REDIRECT = [DEFAULT_[CONF_LOOKUP_FILE], AUTODETECTION_DEYE_STRING[1], "deye_p1.yaml", AUTODETECTION_DEYE_P1[1], AUTODETECTION_DEYE_MICRO[1], "deye_4mppt.yaml", "deye_2mppt.yaml", AUTODETECTION_DEYE_4P3[1], "deye_sg04lp3.yaml", "deye_sg01hp3.yaml"]
8283
AUTODETECTION_CODE_DEYE = 0x03
8384
AUTODETECTION_REGISTERS_DEYE = (0x0000, 0x0016)
8485
AUTODETECTION_REQUEST_DEYE = (AUTODETECTION_CODE_DEYE, *AUTODETECTION_REGISTERS_DEYE)
8586
AUTODETECTION_DEVICE_DEYE = (AUTODETECTION_CODE_DEYE, AUTODETECTION_REGISTERS_DEYE[0])
8687
AUTODETECTION_TYPE_DEYE = (AUTODETECTION_CODE_DEYE, 0x0008)
87-
AUTODETECTION_DEYE = { AUTODETECTION_DEYE_STRING[0]: (AUTODETECTION_DEYE_STRING[1], 0, 0x12), AUTODETECTION_DEYE_P1[0]: (AUTODETECTION_DEYE_P1[1], 0, 0x12), AUTODETECTION_DEYE_MICRO[0]: (AUTODETECTION_DEYE_MICRO[1], 0, 0x12), AUTODETECTION_DEYE_4P3[0]: (AUTODETECTION_DEYE_4P3[1], 0, 0x16), AUTODETECTION_DEYE_1P3[0]: (AUTODETECTION_DEYE_1P3[1], 1, 0x16) }
88+
AUTODETECTION_DEYE = { AUTODETECTION_DEYE_STRING[0]: (AUTODETECTION_DEYE_STRING[1], 0, 0x12), AUTODETECTION_DEYE_P1[0]: (AUTODETECTION_DEYE_P1[1], 0, 0x12), AUTODETECTION_DEYE_MICRO[0]: (AUTODETECTION_DEYE_MICRO[1], 0, 0x12), AUTODETECTION_DEYE_4P3[0]: (AUTODETECTION_DEYE_4P3[1], 0, 0x16), AUTODETECTION_DEYE_1P3[0]: (AUTODETECTION_DEYE_1P3[1], 1, 0x16), AUTODETECTION_DEYE_EVSE[0]: (AUTODETECTION_DEYE_EVSE[1], 0, 0x08) }
8889
AUTODETECTION_BATTERY_REGISTERS_DEYE = (0x2712, 0x2712)
8990
AUTODETECTION_BATTERY_REQUEST_DEYE = (AUTODETECTION_CODE_DEYE, *AUTODETECTION_BATTERY_REGISTERS_DEYE)
9091
AUTODETECTION_BATTERY_NUMBER_DEYE = (AUTODETECTION_CODE_DEYE, AUTODETECTION_BATTERY_REGISTERS_DEYE[0])

custom_components/solarman/device.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ async def setup(self):
4747
self.endpoint = await EndPointProvider(self.config).init()
4848
self.modbus = Solarman(*self.endpoint.connection)
4949
self.profile = await ProfileProvider(self.config, self.endpoint).init(self.get)
50+
if (profile_slave_id := (self.profile.info or {}).get(CONF_MB_SLAVE_ID)) and CONF_MB_SLAVE_ID not in self.config._additional_options and profile_slave_id != self.endpoint.mb_slave_id:
51+
await self.modbus.close()
52+
self.modbus = Solarman(self.endpoint.host, self.endpoint.port, self.endpoint.transport, self.endpoint.serial, profile_slave_id, TIMINGS_INTERVAL)
5053
except Exception as e:
5154
raise type(e)(f"{"Timeout" if (x := isinstance(e, TimeoutError)) else "Error"} setuping {self.config.name}{"" if x else f": {strepr(e)}"}") from e
5255
else:

0 commit comments

Comments
 (0)