Repository navigation
feat(1P): add Time of Use Sell Mode switches (registers 274-279, bit 6) - #125
Conversation
|
tested it on 3P LV and it didn't work, tried bitmask: 40 suggested by chatgpt based on kellerza/sunsynk#635 but the grid relay kept disconnecting until a full restart of the inverter so be warned about it |
Its not for a 3P LV its only for 1P (single phase). You need to make sure your inverter also has the sell mode otherwise it wont work. |
Another way you can test it is online. You can send a modbus command directly to the inverter though the Deye Cloud.
on this page of changing the settings online. you can nagivate to the "Customised Command" tab In the customised command tab you can send modbus frames then create a modbus request according to the documentation online for a 3P inverter that would be 01 03 00 AC 00 06 (CRC) if you send that to your inverter and send me the response I'll decode it. I looked up the 3P modbus protocol and found a document V105.4-20240813 |
|
Yes, it's the latest firmware with sell enabled, I'll see about bit5. |
|
seems that it was already implemented in #45 |
56e50b7 to
a9155a3
Compare
Adds six "Time of Use N Sell Mode" switches for the single-phase inverter, toggling the undocumented bit 6 (0x40) of the per-slot Time-of-Use control registers 274-279 (hardware-validated; not in the V119 protocol). Implemented as native modbus_controller bitmask switches, mirroring the existing Charge Enable switches (bit 0); grid-charge (buy) and sell are mutually exclusive per slot. Also sets restore_mode: DISABLED on the Sell Mode and Charge Enable switches so they no longer write registers 274-279 on boot: a modbus switch re-asserts its restored state during setup(), and a bitmask write clobbers the whole register, which wiped grid-charge/sell settings on every flash. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
a9155a3 to
79110e2
Compare
|
@SupermotoJerry thx |


Description
Adds six "Time of Use N Sell Mode" switches for the single-phase inverter, toggling the undocumented bit 6 (0x40) of the per-slot Time-of-Use control registers 274-279 (hardware-validated; not in the V119 protocol). Implemented as native modbus_controller bitmask switches, mirroring the existing Charge Enable switches (bit 0); grid-charge (buy) and sell are mutually exclusive per slot.
Also sets restore_mode: DISABLED on the Sell Mode and Charge Enable switches so they no longer write registers 274-279 on boot: a modbus switch re-asserts its restored state during setup(), and a bitmask write clobbers the whole register, which wiped grid-charge/sell settings on every flash.
Changes relate to
Changes
Added six switches "Time of Use 1–6 Sell Mode" to the single-phase package — native modbus_controller bitmask switches on bit 6 (0x40) of registers 274–279, one per Time-of-Use slot, mirroring the existing "Charge Enable" switches (bit 0).
Added restore_mode: DISABLED to the new Sell Mode switches and the existing Charge Enable switches on registers 274–279.
Notes
Undocumented bit: bit 6 isn't in the 2025 V119 modbus protocol, but is hardware-validated — enabling "sell" for a time point on the inverter's own screen sets it (e.g. register 277 reads 0x0040 with sell enabled for slot 4) See image below.
Buy/sell are mutually exclusive per slot: a bitmask-switch write sets its own bit and clears the rest of the register, so enabling Sell clears grid-charge (bit 0) and vice-versa.
restore_mode: DISABLED is required: a modbus_controller switch otherwise re-asserts its restored state during setup(), and because a bitmask write overwrites the whole 16-bit register, that boot-write wiped the slot's grid-charge/sell bits on every flash. DISABLED makes these switches read-only on boot (state still comes from polling; writes happen only on user toggle). This also hardens the existing Charge Enable switches against the same boot-clobber.
Trade-off (identical to how Charge Enable already behaves): toggling a switch clears the other mode bits in that register at write time.
1P only — the 3P package is untouched.
How it was verified
Flashed to hardware: toggling Time of Use - Sell Mode sets/clears bit 6 (0x0040) of the matching register (274–279), cross-checked against the inverter's own Sell Mode setting for that slot.
Confirmed mutual exclusion: enabling Sell clears that slot's grid-charge bit, and enabling Charge Enable clears the sell bit.
Confirmed the boot fix: with restore_mode: DISABLED, grid-charge and sell settings now survive a flash (previously they were reset to 0 on every flash).
New Sell Mode inside system work mode
Inverter Firmware Version