diff --git a/custom_components/solarman/inverter_definitions/deye_2mppt.yaml b/custom_components/solarman/inverter_definitions/deye_2mppt.yaml index afa5980..c60a0b0 100644 --- a/custom_components/solarman/inverter_definitions/deye_2mppt.yaml +++ b/custom_components/solarman/inverter_definitions/deye_2mppt.yaml @@ -392,3 +392,21 @@ parameters: - key: 1 value: "Enabled" icon: 'mdi:factory' + + - name: "PV1 Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 11 + registers: [0x006D, 0x006E] + icon: 'mdi:solar-power' + + - name: "PV2 Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 10 + rule: 11 + registers: [0x006F, 0x0070] + icon: 'mdi:solar-power' diff --git a/custom_components/solarman/parser.py b/custom_components/solarman/parser.py index a5752f4..2cd919d 100644 --- a/custom_components/solarman/parser.py +++ b/custom_components/solarman/parser.py @@ -38,6 +38,8 @@ def try_parse_field (self, rawData, definition, start, length): self.try_parse_time(rawData,definition, start, length) elif rule == 10: self.try_parse_raw(rawData,definition, start, length) + elif rule == 11: + self.try_parse_multipl(rawData,definition, start, length) return def do_validate(self, title, value, rule): @@ -190,6 +192,22 @@ def try_parse_raw (self, rawData, definition, start, length): if found: self.result[title] = value return + + def try_parse_multipl (self, rawData, definition, start, length): + title = definition['name'] + value = definition['scale'] if 'scale' in definition else 1 + found = True + for r in definition['registers']: + index = r - start # get the decimal value of the register' + if (index >= 0) and (index < length): + temp = rawData[index] + value = value * temp + else: + found = False + + if found: + self.result[title] = value + return def try_parse_version (self, rawData, definition, start, length): title = definition['name'] diff --git a/customization.md b/customization.md index 66443f2..711fb1b 100644 --- a/customization.md +++ b/customization.md @@ -125,4 +125,4 @@ The `rule` field specifies how to interpret the binary data contained in the reg | 8 | Date Time | | | 9 | Time | Time value as string