Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion pv_inverter/packages/deye_hybrid_1p/device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
globals:
- id: meter_ct_raw
type: int32_t
initial_value: "-1"

sensor:
- platform: modbus_controller
modbus_controller_id: ${modbus_controller_id}
Expand Down Expand Up @@ -383,4 +388,16 @@ select:
optionsmap:
"Disable": 0
"Enable": 1
"Generator": 13
# Register 326 (Ex_MeterCT) is a bitfield per the V119 protocol: bit0 =
# meter enable, bits1-3 = phase A/B/C, bits6-7 = direction, bits8-11 = meter
# type, bits12-15 = meter 2. Only bit0 is mapped here; the raw value is kept
# so writes preserve the other bits.
lambda: |-
id(meter_ct_raw) = x;
return (x & 0x0001) ? std::string("Enable") : std::string("Disable");
write_lambda: |-
if (id(meter_ct_raw) < 0) {
ESP_LOGW("meter", "Register 326 not read yet - write skipped");
return {};
}
return (id(meter_ct_raw) & ~0x0001) | (value & 0x0001);
20 changes: 20 additions & 0 deletions pv_inverter/packages/deye_hybrid_1p/grid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ globals:
- id: last_update_time
type: unsigned long
restore_value: yes
- id: gen_grid_signal_raw
type: int32_t
initial_value: "-1"

sensor:
# Register 54 = "AC power ratio". Per the V119 protocol, the AC power registers
Expand Down Expand Up @@ -324,6 +327,23 @@ select:
"Grid": 1
"Generator": 2
"Both": 3
# Register 242 (Gen_Grid_Signal): bit0 = grid signal, bit1 = generator
# signal. The upper bits carry other data on some inverters (e.g. 0x5F01),
# so only bits0-1 are mapped and the rest are preserved on write.
lambda: |-
id(gen_grid_signal_raw) = x;
switch (x & 0x0003) {
case 1: return std::string("Grid");
case 2: return std::string("Generator");
case 3: return std::string("Both");
default: return std::string("Normal");
}
write_lambda: |-
if (id(gen_grid_signal_raw) < 0) {
ESP_LOGW("charging_signal", "Register 242 not read yet - write skipped");
return {};
}
return (id(gen_grid_signal_raw) & ~0x0003) | (value & 0x0003);

switch:
- platform: modbus_controller
Expand Down
Loading