diff --git a/custom_components/solarman/api.py b/custom_components/solarman/api.py index 3e561bf..db935cf 100644 --- a/custom_components/solarman/api.py +++ b/custom_components/solarman/api.py @@ -285,7 +285,7 @@ async def get(self, runtime = 0): return self.get_result() async def call(self, code, start, arg, wait_for_attempts = ACTION_ATTEMPTS) -> bool: - _LOGGER.debug(f"[{self.serial}] call code {code}: {start}, arg: {arg}, wait_for_attempts: {wait_for_attempts}") + _LOGGER.debug(f"[{self.serial}] call code {code}: {start} | 0x{start:04X}, arg: {arg}, wait_for_attempts: {wait_for_attempts}") if await self.wait_for_reading_done(wait_for_attempts): _LOGGER.debug(f"[{self.serial}] call code {code}: Timeout.") @@ -297,10 +297,10 @@ async def call(self, code, start, arg, wait_for_attempts = ACTION_ATTEMPTS) -> b try: response = await self.read_write(code, start, arg) - _LOGGER.debug(f"[{self.serial}] call code {code}: {start}, response: {response}") + _LOGGER.debug(f"[{self.serial}] call code {code}: {start} | 0x{start:04X}, response: {response}") return response except Exception as e: - _LOGGER.warning(f"[{self.serial}] call code {code}: {start}, arg: {arg} failed, attempts left: {attempts_left}. [{format_exception(e)}]") + _LOGGER.warning(f"[{self.serial}] call code {code}: {start} | 0x{start:04X}, arg: {arg} failed, attempts left: {attempts_left}. [{format_exception(e)}]") if not self.auto_reconnect: await self.disconnect() if not attempts_left > 0: diff --git a/custom_components/solarman/inverter_definitions/deye_2mppt.yaml b/custom_components/solarman/inverter_definitions/deye_2mppt.yaml index 0907432..924394e 100644 --- a/custom_components/solarman/inverter_definitions/deye_2mppt.yaml +++ b/custom_components/solarman/inverter_definitions/deye_2mppt.yaml @@ -6,7 +6,7 @@ # 2x MPPT, 2x inverter # 1x Logger, 2x Module # - +# ## Tested with: ### SUN-800-G3-EU-230 FW: 2.06 ### SUN-M80-G3-EU-Q0 FW: 2.06 @@ -14,49 +14,234 @@ ########## May work with: ### SUN-M80G3-EU-230 FW: ?.?? ### SUN-M60G3-EU-Q0 FW: ?.?? +# default: update_interval: 5 digits: 6 parameters: - - group: PV + - group: Device items: - - name: "PV1 Voltage" - class: "voltage" - state_class: "measurement" - uom: "V" - scale: 0.1 + - name: "Device" + class: "enum" + state_class: "" + uom: "" + scale: 1 rule: 1 - registers: [0x006D] + registers: [0x0000] + icon: "mdi:information" + lookup: + - key: 2 + value: "String Inverter" + - key: 3 + value: "Single-Phase Hybrid Inverter" + - key: 4 + value: "Microinverter" + - key: 5 + value: "LV 3-Phase Hybrid Inverter" + - key: 6 + value: "HV 3-Phase Hybrid Inverter" + - key: 7 + value: "HV 3-Phase Inverter 6-15kw" + - key: 8 + value: "HV 3-Phase Inverter 20-50kw" + attributes: + [ + "Device Modbus Address", + "Device Protocol Version", + "Device Serial Number", + "Device Rated Phase", + "Device Chip Type", + "Device Communication Board Firmware Version Field 2", + "Device Control Board Helper Version", + "Device Control Board Firmware Version Field 2", + "Device Control Board Firmware Version", + "Device Communication Board Firmware Version", + "Device Rated Power", + "Device MPPTs", + "Device Phases", + ] + + - name: "Device Modbus Address" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0001] + icon: "mdi:information" + + - name: "Device Protocol Version" + attribute: + rule: 7 + remove: "0." + registers: [0x0002] + icon: "mdi:information" + + - name: "Device Serial Number" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 5 + registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] + + - name: "Device Rated Phase" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0008] + lookup: + - key: 1 + value: "Single-Phase" + - key: 2 + value: "Three-Phase" + + - name: "Device Chip Type" + attribute: + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 6 + registers: [0x0009] + lookup: + - key: 0x0000 + value: "AT32F403A" + - key: 0x0001 + value: "SXX32F103" + - key: 0x0002 + value: "GD32F103" + - key: 0x0003 + value: "GD32F303" + + - name: "Device Communication Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000A] + + - name: "Device Control Board Helper Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000B] + + - name: "Device Control Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000C] + + - name: "Device Control Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000D] + + - name: "Device Communication Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000E] + + - name: "Device Rated Power" + attribute: + class: "power" + state_class: "" + uom: "W" + scale: 0.1 + rule: 4 + registers: [0x0010, 0x0011] icon: "mdi:solar-power" - - name: "PV2 Voltage" - class: "voltage" + - name: "Device MPPTs" + attribute: + class: "" state_class: "measurement" - uom: "V" - scale: 0.1 + uom: "" rule: 1 - registers: [0x006F] - icon: "mdi:solar-power" + mask: 0x0F00 + divide: 256 + registers: [0x0012] + range: + min: 257 + max: 2051 - - name: "PV1 Current" - class: "current" + - name: "Device Phases" + attribute: + class: "" state_class: "measurement" - uom: "A" - scale: 0.1 + uom: "" rule: 1 - registers: [0x006E] - icon: "mdi:solar-power" + mask: 0x000F + registers: [0x0012] + range: + min: 257 + max: 2051 - - name: "PV2 Current" - class: "current" + - name: "Device State" + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x003B] + icon: "mdi:information" + range: + min: 0 + max: 5 + lookup: + - key: 0x0000 + value: "Standby" + - key: 0x0001 + value: "Self-test" + - key: 0x0002 + value: "Normal" + - key: 0x0003 + value: "Alarm" + - key: 0x0004 + value: "Fault" + + - group: PV + items: + - name: PV Power + description: Combined power of all inputs + class: "power" state_class: "measurement" - uom: "A" - scale: 0.1 + uom: "W" rule: 1 - registers: [0x0070] - icon: "mdi:solar-power" + digits: 3 + scale: 0.1 + registers: [0x006D, 0x006E, 0x006F, 0x0070] + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] + - registers: [0x006F] + multiply: + registers: [0x0070] - name: PV1 Power class: "power" @@ -64,13 +249,30 @@ parameters: uom: "W" rule: 1 digits: 3 + scale: 0.1 registers: [0x006D, 0x006E] sensors: - registers: [0x006D] - scale: 0.1 - - operator: multiply - scale: 0.1 - registers: [0x006E] + multiply: + registers: [0x006E] + + - name: "PV1 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x006D] + icon: "mdi:solar-power" + + - name: "PV1 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [0x006E] + icon: "mdi:solar-power" - name: PV2 Power class: "power" @@ -78,13 +280,30 @@ parameters: uom: "W" rule: 1 digits: 3 + scale: 0.1 registers: [0x006F, 0x0070] sensors: - registers: [0x006F] - scale: 0.1 - - operator: multiply - scale: 0.1 - registers: [0x0070] + multiply: + registers: [0x0070] + + - name: "PV2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x006F] + icon: "mdi:solar-power" + + - name: "PV2 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [0x0070] + icon: "mdi:solar-power" - name: "Today Production" friendly_name: Today's Production @@ -149,356 +368,258 @@ parameters: validation: min: 0.1 - - name: "Active Power Regulation" + - group: Settings + items: + - name: "Start-up Self-checking Time" + platform: number class: "" state_class: "" - uom: "%" + uom: "s" scale: 1 rule: 1 - registers: [0x0028] - configurable: + registers: [0x0015] + range: min: 0 - max: 120 - step: 0.1 - range: - min: 0 - max: 1200 - icon: "mdi:solar-power" - - - group: Grid - items: - - name: "AC Voltage" - class: "voltage" - state_class: "measurement" - uom: "V" - scale: 0.1 - rule: 1 - registers: [0x0049] - icon: "mdi:transmission-tower" - - - name: "Grid Current" - class: "current" - state_class: "measurement" - uom: "A" - scale: 0.1 - rule: 2 - registers: [0x004C] - icon: "mdi:home-lightning-bolt" + max: 1000 - - name: "Output Frequency" - class: "frequency" - state_class: "measurement" - uom: "Hz" - scale: 0.01 - rule: 1 - registers: [0x004F] - icon: "mdi:home-lightning-bolt" + - name: "Device Time" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 8 + registers: [0x0016, 0x0017, 0x0018] + icon: "mdi:clock-time-three-outline" - name: "Grid Voltage Upper Limit" + platform: number class: "voltage" - state_class: "" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 registers: [0x001B] - icon: "mdi:transmission-tower" + configurable: + min: 160 + max: 550 + range: + min: 1600 + max: 5500 - name: "Grid Voltage Lower Limit" + platform: number class: "voltage" - state_class: "" + state_class: "measurement" uom: "V" scale: 0.1 rule: 1 registers: [0x001C] - icon: "mdi:transmission-tower" + configurable: + min: 160 + max: 550 + range: + min: 1600 + max: 5500 - name: "Grid Frequency Upper Limit" + platform: number class: "frequency" - state_class: "" + state_class: "measurement" uom: "Hz" scale: 0.01 rule: 1 registers: [0x001D] - icon: "mdi:home-lightning-bolt" + configurable: + min: 45 + max: 65 + range: + min: 4500 + max: 6500 - name: "Grid Frequency Lower Limit" + platform: number class: "frequency" - state_class: "" + state_class: "measurement" uom: "Hz" scale: 0.01 rule: 1 registers: [0x001E] - icon: "mdi:home-lightning-bolt" + configurable: + min: 45 + max: 65 + range: + min: 4500 + max: 6500 - - name: "Over-frequency Load Reduction Starting Point" + - name: "Over-Frequency Load Reduction Starting Point" + platform: number class: "frequency" - state_class: "" + state_class: "measurement" uom: "Hz" scale: 0.01 rule: 1 registers: [0x0022] - icon: "mdi:home-lightning-bolt" + configurable: + min: 45 + max: 65 + range: + min: 4500 + max: 6500 - - name: "Over-frequency Load Reduction Percentage" + - name: "Over-Frequency Load Reduction Percentage" + platform: number class: "" - state_class: "" + state_class: "measurement" uom: "%" scale: 1 rule: 1 registers: [0x0023] - icon: "" - - - group: Device - items: - # Device - Operating (Running) state - - name: "Device State" - class: "enum" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x003B] - icon: "mdi:information" range: min: 0 - max: 5 - lookup: - - key: 0x0000 - value: "Standby" - - key: 0x0001 - value: "Self-test" - - key: 0x0002 - value: "Normal" - - key: 0x0003 - value: "Alarm" - - key: 0x0004 - value: "Fault" - - - name: "Output Power" - class: "power" - state_class: "measurement" - uom: "W" - scale: 0.1 - rule: 3 - registers: [0x0056, 0x0057] - icon: "mdi:home-lightning-bolt" - - - name: "Radiator Temperature" - class: "temperature" - uom: "°C" - state_class: "measurement" - scale: 0.01 - rule: 1 - offset: 1000 - registers: [0x005a] - - # Device - Type - - name: "Device" - class: "enum" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0000] - icon: "mdi:information" - lookup: - - key: 2 - value: "String Inverter" - - key: 3 - value: "Single-Phase Hybrid Inverter" - - key: 4 - value: "Microinverter" - - key: 5 - value: "LV 3-Phase Hybrid Inverter" - - key: 6 - value: "HV 3-Phase Hybrid Inverter" - - key: 7 - value: "HV 3-Phase Inverter 6-15kw" - - key: 8 - value: "HV 3-Phase Inverter 20-50kw" - attributes: - [ - "Device Modbus Address", - "Device Protocol Version", - "Device Serial Number", - "Device Rated Phase", - "Device Rated Power", - "Device MPPTs", - "Device Phases", - ] - - # Device - Modbus Address - - name: "Device Modbus Address" - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0001] - icon: "mdi:information" - - # Device - Communication Protocol Version - - name: "Device Protocol Version" - attribute: - rule: 7 - remove: "0." - registers: [0x0002] - icon: "mdi:information" - - - name: "Device Serial Number" - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 5 - registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] - - - name: "Hardware Version" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 7 - registers: [0x000C] - icon: "mdi:map-marker" - - - name: "DC Master Firmware Version" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 7 - registers: [0x000D] - icon: "mdi:map-marker" - - - name: "AC Version. Number" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 7 - registers: [0x000E] - icon: "mdi:map-marker" - - - name: "Device Rated Power" - attribute: - class: "power" - state_class: "" - uom: "W" - scale: 0.1 - rule: 4 - registers: [0x0010, 0x0011] - icon: "mdi:solar-power" + max: 100 - # Device - MPPTs - - name: "Device MPPTs" - attribute: + - name: "Power Factor Regulation" + platform: number class: "" state_class: "measurement" uom: "" + scale: 0.001 + offset: 1000 rule: 1 - mask: 0x0F00 - divide: 256 - registers: [0x0012] + registers: [0x0027] range: - min: 257 - max: 2051 + min: 0 + max: 2000 - # Device - Phases - - name: "Device Phases" - attribute: + - name: "Active Power Regulation" + platform: number class: "" state_class: "measurement" - uom: "" + uom: "%" + scale: 1 rule: 1 - mask: 0x000F - registers: [0x0012] + registers: [0x0028] + configurable: + min: 0 + max: 120 + step: 0.1 range: - min: 257 - max: 2051 + min: 0 + max: 1200 - - name: "Start-up Self-checking Time " - class: "" - state_class: "" - uom: "s" - scale: 1 + - name: "" # Device - On/Off Switch (Empty name so the sensor has same name as the device, looks good! Can be used once per platform though) + platform: "switch" rule: 1 - registers: [0x0015] - icon: "mdi:solar-power" + registers: [0x002b] + value: + on: 0x0001 + off: 0x0002 - - name: "Device Time" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 8 - registers: [0x0016, 0x0017, 0x0018] - icon: "mdi:clock-time-three-outline" + - name: "Island Protection" + platform: "switch" + rule: 1 + registers: [0x002e] - - name: "Device Rated Phase" - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 + - name: "Soft Start" + platform: "switch" rule: 1 - registers: [0x0008] - lookup: - - key: 1 - value: "single-phase" - - key: 2 - value: "three-phase" - icon: "mdi:map-marker" + registers: [0x002F] - - name: "Device Chip-Typ" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 6 - registers: [0x0009] - icon: "mdi:map-marker" + - name: "GFDI" + platform: "switch" + rule: 1 + registers: [0x0030] - - name: "Power Factor Regulation" - class: "" - state_class: "" - uom: "" - scale: 0.1 - rule: 2 + - name: "Over-Frequency Load Reduction" + platform: "switch" + rule: 1 + registers: [0x0031] + + - name: "RISO" + platform: "switch" + rule: 1 registers: [0x0032] - icon: "mdi:exclamation" - name: "EEPROM" - class: "" - state_class: "" - uom: "" - scale: 1 + platform: "select" rule: 1 registers: [0x0036] + options: + [ + "Normal operation", + "Initialize the control board EEPROM", + "Initialize the communication board EEPROM", + ] lookup: - key: 0 value: "Normal operation" - key: 1 - value: "Initialize the control board EEPROM Mi to restore factory settings" + value: "Initialize the control board EEPROM" - key: 2 value: "Initialize the communication board EEPROM" - icon: "mdi:factory" - - name: "Restore Factory Settings" - class: "" - state_class: "" - uom: "" - scale: 1 + - group: Grid + items: + - name: "Grid Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 rule: 1 - registers: [0x0037] - lookup: - - key: 0 - value: "Disabled" - - key: 1 - value: "Enabled" - icon: "mdi:factory" + registers: [0x0049] + + - name: "Grid Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 2 + registers: [0x004C] + + - name: "Grid Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x004F] + + - name: "Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 0.1 + rule: 3 + registers: [0x0056, 0x0057] + + - name: Power losses + description: Includes consumption of the inverter device itself as well AC/DC conversion losses + class: "power" + state_class: "measurement" + uom: "W" + rule: 1 + digits: 3 + scale: 0.1 + registers: [0x006D, 0x006E, 0x006F, 0x0070, 0x0056, 0x0057] + uint: enforce + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] + - registers: [0x006F] + multiply: + registers: [0x0070] + - operator: subtract + registers: [0x0056, 0x0057] + + - name: "Temperature" + class: "temperature" + uom: "°C" + state_class: "measurement" + scale: 0.01 + rule: 1 + offset: 1000 + registers: [0x005a] - group: Alert items: @@ -509,7 +630,7 @@ parameters: scale: 1 rule: 3 registers: [0x0065, 0x0066] - icon: "mdi:message-alert-outline" + icon: "mdi:alert-outline" lookup: - key: 0x0000 value: "OK" @@ -523,17 +644,19 @@ parameters: value: "Battery loss" - key: 0x80000000 value: "Parallel communication quality" + - key: 0x1D0002 + value: "OK" - key: "default" value: "Error" - - name: "Fault information Word 1" - class: "" + - name: "Device Fault 1" + class: "enum" state_class: "" uom: "" scale: 1 rule: 3 registers: [0x0067] - icon: "mdi:alert-octagon-outline" + icon: "mdi:message-alert-outline" lookup: - key: 0x0000 value: "OK" @@ -565,64 +688,21 @@ parameters: value: "Arc Fault Reservation" - key: 0x2000 value: "Grid Current Sample Abnormality" + - key: "default" + value: "Error" - - name: "Fault information Word 2" - class: "" + - name: "Device Fault 2" + class: "enum" state_class: "" uom: "" scale: 1 rule: 3 registers: [0x0068] - icon: "mdi:alert-octagon-outline" + icon: "mdi:message-alert-outline" lookup: - key: 0x0000 value: "OK" - key: 0x191 value: "Grid phase failure or No Relay Connection" - - - group: Control - items: - # Device - On/Off Switch (Empty name so the sensor has same name as the device, looks good! Can be used once per platform though) - - name: "" - platform: "switch" - rule: 1 - registers: [0x002b] - value: - on: 0x0001 - off: 0x0002 - - # Island Protection - On/Off Switch - - name: "Island Protection" - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x002e] - - # Soft Start - On/Off Switch - - name: "Soft Start" - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x002F] - - # GFDI - On/Off Switch - - name: "GFDI" - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0030] - - # Over-frequency Load-shedding - On/Off Switch - - name: "Over-frequency Load Reduction" - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0031] + - key: "default" + value: "Error" diff --git a/custom_components/solarman/inverter_definitions/deye_4mppt.yaml b/custom_components/solarman/inverter_definitions/deye_4mppt.yaml index 4441694..a8e5777 100644 --- a/custom_components/solarman/inverter_definitions/deye_4mppt.yaml +++ b/custom_components/solarman/inverter_definitions/deye_4mppt.yaml @@ -6,48 +6,270 @@ # 4x MPPT, 4x inverter # 1x Logger, 4x Module, # +# +# +# +# +# +# +# +# +# default: update_interval: 5 digits: 6 parameters: - - group: PV + - group: Device items: - - name: "PV1 Voltage" - class: "voltage" - state_class: "measurement" - uom: "V" - scale: 0.1 + - name: "Device" + class: "enum" + state_class: "" + uom: "" + scale: 1 rule: 1 - registers: [0x006D] + registers: [0x0000] + icon: "mdi:information" + lookup: + - key: 2 + value: "String Inverter" + - key: 3 + value: "Single-Phase Hybrid Inverter" + - key: 4 + value: "Microinverter" + - key: 5 + value: "LV 3-Phase Hybrid Inverter" + - key: 6 + value: "HV 3-Phase Hybrid Inverter" + - key: 7 + value: "HV 3-Phase Inverter 6-15kw" + - key: 8 + value: "HV 3-Phase Inverter 20-50kw" + attributes: + [ + "Device Modbus Address", + "Device Protocol Version", + "Device Serial Number", + "Device Rated Phase", + "Device Chip Type", + "Device Communication Board Firmware Version Field 2", + "Device Control Board Helper Version", + "Device Control Board Firmware Version Field 2", + "Device Control Board Firmware Version", + "Device Communication Board Firmware Version", + "Device Rated Power", + "Device MPPTs", + "Device Phases", + ] + + - name: "Device Modbus Address" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0001] + icon: "mdi:information" + + - name: "Device Protocol Version" + attribute: + rule: 7 + remove: "0." + registers: [0x0002] + icon: "mdi:information" + + - name: "Device Serial Number" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 5 + registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] + + - name: "Device Rated Phase" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0008] + lookup: + - key: 1 + value: "Single-Phase" + - key: 2 + value: "Three-Phase" + + - name: "Device Chip Type" + attribute: + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 6 + registers: [0x0009] + lookup: + - key: 0x0000 + value: "AT32F403A" + - key: 0x0001 + value: "SXX32F103" + - key: 0x0002 + value: "GD32F103" + - key: 0x0003 + value: "GD32F303" + + - name: "Device Communication Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000A] + + - name: "Device Control Board Helper Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000B] + + - name: "Device Control Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000C] + + - name: "Device Control Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000D] + + - name: "Device Communication Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000E] + + - name: "Device Rated Power" + attribute: + class: "power" + state_class: "" + uom: "W" + scale: 0.1 + rule: 4 + registers: [0x0010, 0x0011] icon: "mdi:solar-power" - - name: "PV2 Voltage" - class: "voltage" + - name: "Device MPPTs" + attribute: + class: "" state_class: "measurement" - uom: "V" - scale: 0.1 + uom: "" rule: 1 - registers: [0x006F] - icon: "mdi:solar-power" + mask: 0x0F00 + divide: 256 + registers: [0x0012] + range: + min: 257 + max: 2051 - - name: "PV3 Voltage" - class: "voltage" + - name: "Device Phases" + attribute: + class: "" state_class: "measurement" - uom: "V" + uom: "" + rule: 1 + mask: 0x000F + registers: [0x0012] + range: + min: 257 + max: 2051 + + - name: "Device State" + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x003B] + icon: "mdi:information" + range: + min: 0 + max: 5 + lookup: + - key: 0x0000 + value: "Standby" + - key: 0x0001 + value: "Self-test" + - key: 0x0002 + value: "Normal" + - key: 0x0003 + value: "Alarm" + - key: 0x0004 + value: "Fault" + + - group: PV + items: + - name: PV Power + description: Combined power of all inputs + class: "power" + state_class: "measurement" + uom: "W" + rule: 1 + digits: 3 scale: 0.1 + registers: + [0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074] + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] + - registers: [0x006F] + multiply: + registers: [0x0070] + - registers: [0x0071] + multiply: + registers: [0x0072] + - registers: [0x0073] + multiply: + registers: [0x0074] + + - name: PV1 Power + class: "power" + state_class: "measurement" + uom: "W" rule: 1 - registers: [0x0071] - icon: "mdi:solar-power" + digits: 3 + scale: 0.1 + registers: [0x006D, 0x006E] + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] - - name: "PV4 Voltage" + - name: "PV1 Voltage" class: "voltage" state_class: "measurement" uom: "V" scale: 0.1 rule: 1 - registers: [0x0073] + registers: [0x006D] icon: "mdi:solar-power" - name: "PV1 Current" @@ -59,74 +281,67 @@ parameters: registers: [0x006E] icon: "mdi:solar-power" - - name: "PV2 Current" - class: "current" + - name: PV2 Power + class: "power" state_class: "measurement" - uom: "A" - scale: 0.1 + uom: "W" rule: 1 - registers: [0x0070] - icon: "mdi:solar-power" + digits: 3 + scale: 0.1 + registers: [0x006F, 0x0070] + sensors: + - registers: [0x006F] + multiply: + registers: [0x0070] - - name: "PV3 Current" - class: "current" + - name: "PV2 Voltage" + class: "voltage" state_class: "measurement" - uom: "A" + uom: "V" scale: 0.1 rule: 1 - registers: [0x0072] + registers: [0x006F] icon: "mdi:solar-power" - - name: "PV4 Current" + - name: "PV2 Current" class: "current" state_class: "measurement" uom: "A" scale: 0.1 rule: 1 - registers: [0x0074] + registers: [0x0070] icon: "mdi:solar-power" - - name: PV1 Power + - name: PV3 Power class: "power" state_class: "measurement" uom: "W" rule: 1 digits: 3 - registers: [0x006D, 0x006E] + scale: 0.1 + registers: [0x0071, 0x0072] sensors: - - registers: [0x006D] - scale: 0.1 - - operator: multiply - scale: 0.1 - registers: [0x006E] + - registers: [0x0071] + multiply: + registers: [0x0072] - - name: PV2 Power - class: "power" + - name: "PV3 Voltage" + class: "voltage" state_class: "measurement" - uom: "W" + uom: "V" + scale: 0.1 rule: 1 - digits: 3 - registers: [0x006F, 0x0070] - sensors: - - registers: [0x006F] - scale: 0.1 - - operator: multiply - scale: 0.1 - registers: [0x0070] + registers: [0x0071] + icon: "mdi:solar-power" - - name: PV3 Power - class: "power" + - name: "PV3 Current" + class: "current" state_class: "measurement" - uom: "W" + uom: "A" + scale: 0.1 rule: 1 - digits: 3 - registers: [0x0071, 0x0072] - sensors: - - registers: [0x0071] - scale: 0.1 - - operator: multiply - scale: 0.1 - registers: [0x0072] + registers: [0x0072] + icon: "mdi:solar-power" - name: PV4 Power class: "power" @@ -134,13 +349,30 @@ parameters: uom: "W" rule: 1 digits: 3 + scale: 0.1 registers: [0x0073, 0x0074] sensors: - registers: [0x0073] - scale: 0.1 - - operator: multiply - scale: 0.1 - registers: [0x0074] + multiply: + registers: [0x0074] + + - name: "PV4 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0073] + icon: "mdi:solar-power" + + - name: "PV4 Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 1 + registers: [0x0074] + icon: "mdi:solar-power" - name: "Today Production" friendly_name: Today's Production @@ -245,333 +477,278 @@ parameters: registers: [0x004D] icon: "mdi:solar-power" validation: - min: 0.1 - - - name: "Active Power Regulation" - class: "" - state_class: "" - uom: "%" - scale: 1 - rule: 1 - registers: [0x0028] - configurable: - min: 0 - max: 120 - step: 0.1 - range: - min: 0 - max: 1200 - icon: "mdi:solar-power" - - - group: Grid - items: - - name: "AC Voltage" - class: "voltage" - state_class: "measurement" - uom: "V" - scale: 0.1 - rule: 1 - registers: [0x0049] - icon: "mdi:transmission-tower" - - - name: "Grid Current" - class: "current" - state_class: "measurement" - uom: "A" - scale: 0.1 - rule: 2 - registers: [0x004C] - icon: "mdi:home-lightning-bolt" - - - name: "Output Frequency" - class: "frequency" - state_class: "measurement" - uom: "Hz" - scale: 0.01 - rule: 1 - registers: [0x004F] - icon: "mdi:home-lightning-bolt" - - - name: "Grid Voltage Upper Limit" - class: "voltage" - state_class: "" - uom: "V" - scale: 0.1 - rule: 1 - registers: [0x001B] - icon: "mdi:transmission-tower" - - - name: "Grid Voltage Lower Limit" - class: "voltage" - state_class: "" - uom: "V" - scale: 0.1 - rule: 1 - registers: [0x001C] - icon: "mdi:transmission-tower" - - - name: "Grid Frequency Upper Limit" - class: "frequency" - state_class: "" - uom: "Hz" - scale: 0.01 - rule: 1 - registers: [0x001D] - icon: "mdi:home-lightning-bolt" - - - name: "Grid Frequency Lower Limit" - class: "frequency" - state_class: "" - uom: "Hz" - scale: 0.01 - rule: 1 - registers: [0x001E] - icon: "mdi:home-lightning-bolt" - - - name: "Over-frequency Load Reduction Starting Point" - class: "frequency" - state_class: "" - uom: "Hz" - scale: 0.01 - rule: 1 - registers: [0x0022] - icon: "mdi:home-lightning-bolt" - - - name: "Over-frequency Load Reduction Percentage" - class: "" - state_class: "" - uom: "%" - scale: 1 - rule: 1 - registers: [0x0023] - icon: "" - - - group: Device - items: - # Device - Operating (Running) state - - name: "Device State" - update_interval: 30 - class: "enum" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x003B] - icon: "mdi:information" - range: - min: 0 - max: 5 - lookup: - - key: 0x0000 - value: "Standby" - - key: 0x0001 - value: "Self-test" - - key: 0x0002 - value: "Normal" - - key: 0x0003 - value: "Alarm" - - key: 0x0004 - value: "Fault" - - - name: "Output Power" - class: "power" - state_class: "measurement" - uom: "W" - scale: 0.1 - rule: 3 - registers: [0x0056, 0x0057] - icon: "mdi:home-lightning-bolt" - - - name: "Radiator Temperature" - class: "temperature" - uom: "°C" - state_class: "measurement" - scale: 0.01 - rule: 1 - offset: 1000 - registers: [0x005a] - - # Device - Type - - name: "Device" - update_interval: 300 - class: "enum" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0000] - icon: "mdi:information" - lookup: - - key: 2 - value: "String Inverter" - - key: 3 - value: "Single-Phase Hybrid Inverter" - - key: 4 - value: "Microinverter" - - key: 5 - value: "LV 3-Phase Hybrid Inverter" - - key: 6 - value: "HV 3-Phase Hybrid Inverter" - - key: 7 - value: "HV 3-Phase Inverter 6-15kw" - - key: 8 - value: "HV 3-Phase Inverter 20-50kw" - attributes: - [ - "Device Modbus Address", - "Device Protocol Version", - "Device Serial Number", - "Device Rated Power", - "Device MPPTs", - "Device Phases", - ] - - # Device - Modbus Address - - name: "Device Modbus Address" - attribute: - update_interval: 300 - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0001] - icon: "mdi:information" - - # Device - Communication Protocol Version - - name: "Device Protocol Version" - attribute: - update_interval: 300 - scale: 1 - rule: 7 - remove: "0." - registers: [0x0002] - icon: "mdi:information" - - - name: "Device Serial Number" - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 5 - registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] - - - name: "Hardware Version" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 7 - registers: [0x000C] - icon: "mdi:map-marker" + min: 0.1 - - name: "DC Master Firmware Version" + - group: Settings + items: + - name: "Start-up Self-checking Time" + platform: number class: "" state_class: "" - uom: "" + uom: "s" scale: 1 - rule: 7 - registers: [0x000D] - icon: "mdi:map-marker" + rule: 1 + registers: [0x0015] + range: + min: 0 + max: 1000 - - name: "AC Version. Number" + - name: "Device Time" class: "" state_class: "" uom: "" scale: 1 - rule: 7 - registers: [0x000E] - icon: "mdi:map-marker" + rule: 8 + registers: [0x0016, 0x0017, 0x0018] + icon: "mdi:clock-time-three-outline" - - name: "Device Rated Power" - attribute: - class: "power" - state_class: "" - uom: "W" + - name: "Grid Voltage Upper Limit" + platform: number + class: "voltage" + state_class: "measurement" + uom: "V" scale: 0.1 - rule: 4 - registers: [0x0010, 0x0011] - icon: "mdi:solar-power" + rule: 1 + registers: [0x001B] + configurable: + min: 160 + max: 550 + range: + min: 1600 + max: 5500 - # Device - MPPTs - - name: "Device MPPTs" - attribute: - update_interval: 300 - class: "" + - name: "Grid Voltage Lower Limit" + platform: number + class: "voltage" state_class: "measurement" - uom: "" + uom: "V" + scale: 0.1 rule: 1 - mask: 0x0F00 - divide: 256 - registers: [0x0012] + registers: [0x001C] + configurable: + min: 160 + max: 550 range: - min: 257 - max: 2051 + min: 1600 + max: 5500 - # Device - Phases - - name: "Device Phases" - attribute: - update_interval: 300 - class: "" + - name: "Grid Frequency Upper Limit" + platform: number + class: "frequency" state_class: "measurement" - uom: "" + uom: "Hz" + scale: 0.01 rule: 1 - mask: 0x000F - registers: [0x0012] + registers: [0x001D] + configurable: + min: 45 + max: 65 range: - min: 257 - max: 2051 + min: 4500 + max: 6500 - - name: "Start-up Self-checking Time " - class: "" - state_class: "" - uom: "s" - scale: 1 + - name: "Grid Frequency Lower Limit" + platform: number + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 rule: 1 - registers: [0x0015] - icon: "mdi:solar-power" + registers: [0x001E] + configurable: + min: 45 + max: 65 + range: + min: 4500 + max: 6500 - - name: "Device Time" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 8 - registers: [0x0016, 0x0017, 0x0018] - icon: "mdi:clock-time-three-outline" + - name: "Over-Frequency Load Reduction Starting Point" + platform: number + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x0022] + configurable: + min: 45 + max: 65 + range: + min: 4500 + max: 6500 - - name: "Device Chip-Typ" + - name: "Over-Frequency Load Reduction Percentage" + platform: number class: "" - state_class: "" - uom: "" + state_class: "measurement" + uom: "%" scale: 1 - rule: 6 - registers: [0x0009] - icon: "mdi:map-marker" + rule: 1 + registers: [0x0023] + range: + min: 0 + max: 100 - name: "Power Factor Regulation" + platform: number class: "" - state_class: "" + state_class: "measurement" uom: "" - scale: 0.1 - rule: 2 - registers: [0x0032] - icon: "mdi:exclamation" + scale: 0.001 + offset: 1000 + rule: 1 + registers: [0x0027] + range: + min: 0 + max: 2000 - - name: "Restore Factory Settings" + - name: "Active Power Regulation" + platform: number class: "" - state_class: "" - uom: "" + state_class: "measurement" + uom: "%" scale: 1 rule: 1 + registers: [0x0028] + configurable: + min: 0 + max: 120 + step: 0.1 + range: + min: 0 + max: 1200 + + - name: "" # Device - On/Off Switch (Empty name so the sensor has same name as the device, looks good! Can be used once per platform though) + platform: "switch" + rule: 1 + registers: [0x002b] + value: + on: 0x0001 + off: 0x0002 + + - name: "Island Protection" + platform: "switch" + rule: 1 + registers: [0x002e] + + - name: "Soft Start" + platform: "switch" + rule: 1 + registers: [0x002F] + + - name: "GFDI" + platform: "switch" + rule: 1 + registers: [0x0030] + + - name: "Over-Frequency Load Reduction" + platform: "switch" + rule: 1 + registers: [0x0031] + + - name: "RISO" + platform: "switch" + rule: 1 + registers: [0x0032] + + - name: "EEPROM" + platform: "select" + rule: 1 registers: [0x0036] + options: + [ + "Normal operation", + "Initialize the control board EEPROM", + "Initialize the communication board EEPROM", + ] lookup: - key: 0 - value: "Disabled" + value: "Normal operation" - key: 1 - value: "Enabled" - icon: "mdi:factory" + value: "Initialize the control board EEPROM" + - key: 2 + value: "Initialize the communication board EEPROM" + + - group: Grid + items: + - name: "Grid Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x0049] + + - name: "Grid Current" + class: "current" + state_class: "measurement" + uom: "A" + scale: 0.1 + rule: 2 + registers: [0x004C] + + - name: "Grid Frequency" + class: "frequency" + state_class: "measurement" + uom: "Hz" + scale: 0.01 + rule: 1 + registers: [0x004F] + + - name: "Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 0.1 + rule: 3 + registers: [0x0056, 0x0057] + + - name: Power losses + description: Includes consumption of the inverter device itself as well AC/DC conversion losses + class: "power" + state_class: "measurement" + uom: "W" + rule: 1 + digits: 3 + scale: 0.1 + registers: + [ + 0x006D, + 0x006E, + 0x006F, + 0x0070, + 0x0071, + 0x0072, + 0x0073, + 0x0074, + 0x0056, + 0x0057, + ] + uint: enforce + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] + - registers: [0x006F] + multiply: + registers: [0x0070] + - registers: [0x0071] + multiply: + registers: [0x0072] + - registers: [0x0073] + multiply: + registers: [0x0074] + - operator: subtract + registers: [0x0056, 0x0057] + + - name: "Temperature" + class: "temperature" + uom: "°C" + state_class: "measurement" + scale: 0.01 + rule: 1 + offset: 1000 + registers: [0x005a] - group: Alert items: @@ -582,7 +759,7 @@ parameters: scale: 1 rule: 3 registers: [0x0065, 0x0066] - icon: "mdi:message-alert-outline" + icon: "mdi:alert-outline" lookup: - key: 0x0000 value: "OK" @@ -596,17 +773,19 @@ parameters: value: "Battery loss" - key: 0x80000000 value: "Parallel communication quality" + - key: 0x1D0002 + value: "OK" - key: "default" value: "Error" - - name: "Fault information Word 1" - class: "" + - name: "Device Fault 1" + class: "enum" state_class: "" uom: "" scale: 1 rule: 3 registers: [0x0067] - icon: "mdi:alert-octagon-outline" + icon: "mdi:message-alert-outline" lookup: - key: 0x0000 value: "OK" @@ -638,54 +817,21 @@ parameters: value: "Arc Fault Reservation" - key: 0x2000 value: "Grid Current Sample Abnormality" + - key: "default" + value: "Error" - - name: "Fault information Word 2" - class: "" + - name: "Device Fault 2" + class: "enum" state_class: "" uom: "" scale: 1 - rule: 10 + rule: 3 registers: [0x0068] - icon: "mdi:alert-octagon-outline" - - - group: Control - items: - # Device - On/Off Switch (Empty name so the sensor has same name as the device, looks good! Can be used once per platform though) - - name: "" - update_interval: 300 - platform: "switch" - rule: 1 - registers: [0x002b] - value: - on: 0x0001 - off: 0x0002 - - # Island Protection - On/Off Switch - - name: "Island Protection" - update_interval: 300 - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x002e] - - # Soft Start - On/Off Switch - - name: "Soft Start" - update_interval: 300 - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x002F] - - # Over-frequency Load-shedding - On/Off Switch - - name: "Over-frequency Load Reduction" - update_interval: 300 - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x0031] + icon: "mdi:message-alert-outline" + lookup: + - key: 0x0000 + value: "OK" + - key: 0x191 + value: "Grid phase failure or No Relay Connection" + - key: "default" + value: "Error" diff --git a/custom_components/solarman/inverter_definitions/deye_hybrid.yaml b/custom_components/solarman/inverter_definitions/deye_hybrid.yaml index f757a12..55ae0e1 100644 --- a/custom_components/solarman/inverter_definitions/deye_hybrid.yaml +++ b/custom_components/solarman/inverter_definitions/deye_hybrid.yaml @@ -3,6 +3,212 @@ default: digits: 6 parameters: + - group: Device + items: + - name: "Device" + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0000] + icon: "mdi:information" + lookup: + - key: 2 + value: "String Inverter" + - key: 3 + value: "Single-Phase Hybrid Inverter" + - key: 4 + value: "Microinverter" + - key: 5 + value: "LV 3-Phase Hybrid Inverter" + - key: 6 + value: "HV 3-Phase Hybrid Inverter" + - key: 7 + value: "HV 3-Phase Inverter 6-15kw" + - key: 8 + value: "HV 3-Phase Inverter 20-50kw" + attributes: + [ + "Device Modbus Address", + "Device Protocol Version", + "Device Serial Number", + "Device Rated Phase", + "Device Chip Type", + "Device Communication Board Firmware Version Field 2", + "Device Control Board Helper Version", + "Device Control Board Firmware Version Field 2", + "Device Control Board Firmware Version", + "Device Communication Board Firmware Version", + "Device Rated Power", + "Device MPPTs", + "Device Phases", + ] + + - name: "Device Modbus Address" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0001] + icon: "mdi:information" + + - name: "Device Protocol Version" + attribute: + rule: 7 + remove: "0." + registers: [0x0002] + icon: "mdi:information" + + - name: "Device Serial Number" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 5 + registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] + + - name: "Device Rated Phase" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0008] + lookup: + - key: 1 + value: "Single-Phase" + - key: 2 + value: "Three-Phase" + + - name: "Device Chip Type" + attribute: + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 6 + registers: [0x0009] + lookup: + - key: 0x0000 + value: "AT32F403A" + - key: 0x0001 + value: "SXX32F103" + - key: 0x0002 + value: "GD32F103" + - key: 0x0003 + value: "GD32F303" + + - name: "Device Communication Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000A] + + - name: "Device Control Board Helper Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000B] + + - name: "Device Control Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000C] + + - name: "Device Control Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000D] + + - name: "Device Communication Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000E] + + - name: "Device Rated Power" + attribute: + class: "power" + state_class: "" + uom: "W" + scale: 0.1 + rule: 4 + registers: [0x0010, 0x0011] + icon: "mdi:solar-power" + + - name: "Device MPPTs" + attribute: + update_interval: 300 + class: "" + state_class: "measurement" + uom: "" + rule: 1 + mask: 0x0F00 + divide: 256 + registers: [0x0012] + range: + min: 257 + max: 2051 + + - name: "Device Phases" + attribute: + update_interval: 300 + class: "" + state_class: "measurement" + uom: "" + rule: 1 + mask: 0x000F + registers: [0x0012] + range: + min: 257 + max: 2051 + + - name: "Device State" + update_interval: 30 + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x003B] + icon: "mdi:information" + range: + min: 0 + max: 5 + lookup: + - key: 0x0000 + value: "Standby" + - key: 0x0001 + value: "Self-test" + - key: 0x0002 + value: "Normal" + - key: 0x0003 + value: "Alarm" + - key: 0x0004 + value: "Fault" + - group: PV update_interval: 5 items: @@ -28,15 +234,6 @@ parameters: registers: [0x00BA] icon: "mdi:solar-power-variant" - - name: "PV2 Power" - class: "power" - state_class: "measurement" - uom: "W" - scale: 1 - rule: 1 - registers: [0x00BB] - icon: "mdi:solar-power-variant" - - name: "PV1 Voltage" class: "voltage" state_class: "measurement" @@ -46,6 +243,23 @@ parameters: registers: [0x006D] icon: "mdi:solar-power-variant" + - name: "PV1 Current" + class: "current" + uom: "A" + scale: 0.1 + rule: 1 + registers: [0x006E] + icon: "mdi:solar-power-variant" + + - name: "PV2 Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 1 + registers: [0x00BB] + icon: "mdi:solar-power-variant" + - name: "PV2 Voltage" class: "voltage" state_class: "measurement" @@ -55,14 +269,6 @@ parameters: registers: [0x006F] icon: "mdi:solar-power-variant" - - name: "PV1 Current" - class: "current" - uom: "A" - scale: 0.1 - rule: 1 - registers: [0x006E] - icon: "mdi:solar-power-variant" - - name: "PV2 Current" class: "current" state_class: "measurement" @@ -215,41 +421,14 @@ parameters: validation: min: 0.1 - # Battery - The state of battery - - name: "Battery State" - description: Determines battery state from battery power by +-50 W - class: "enum" - state_class: "" - uom: "" - scale: 1 - rule: 0 - options: ["charging", "idle", "discharging"] - icon: "mdi:battery" - -# Not working??? -# - name: "Battery State" -# class: "enum" -# state_class: "" -# uom: "" -# scale: 1 -# rule: 1 -# registers: [0x00BD] -# lookup: -# - key: 0 -# value: "charging" -# - key: 1 -# value: "idle" -# - key: 2 -# value: "discharging" -# icon: "mdi:battery" - - - name: "Battery Power" - class: "power" + - name: "Battery Temperature" + class: "temperature" state_class: "measurement" - uom: "W" - scale: 1 - rule: 2 - registers: [0x00BE] + uom: "°C" + scale: 0.1 + rule: 1 + offset: 1000 + registers: [0x00B6] - name: "Battery Voltage" class: "voltage" @@ -267,6 +446,27 @@ parameters: rule: 1 registers: [0x00B8] + - name: "Battery State" + description: Determines battery state from battery power by +-50 W + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 0 + #rule: 1 # Not working??? + #registers: [0x00BD] + #lookup: - key: 0 value: "charging" - key: 1 value: "idle" - key: 2 value: "discharging" + options: ["charging", "idle", "discharging"] + icon: "mdi:battery" + + - name: "Battery Power" + class: "power" + state_class: "measurement" + uom: "W" + scale: 1 + rule: 2 + registers: [0x00BE] + - name: "Battery Current" class: "current" state_class: "measurement" @@ -276,15 +476,6 @@ parameters: registers: [0x00BF] icon: "mdi:current-dc" - - name: "Battery Temperature" - class: "temperature" - state_class: "measurement" - uom: "°C" - scale: 0.1 - rule: 1 - offset: 1000 - registers: [0x00B6] - - name: "Battery Grid Charging Current" platform: number class: "current" @@ -536,38 +727,38 @@ parameters: bit: 3 icon: "mdi:lightning-bolt-circle" - - group: Device - items: - # Device - Operating (Running) state - - name: "Device State" - update_interval: 30 + - name: "Device Alarm" class: "enum" state_class: "" uom: "" scale: 1 - rule: 1 - registers: [0x003B] - icon: "mdi:information" - range: - min: 0 - max: 5 + rule: 3 + registers: [0x0065, 0x0066] + icon: "mdi:alert-outline" lookup: - key: 0x0000 - value: "Standby" - - key: 0x0001 - value: "Self-test" + value: "OK" - key: 0x0002 - value: "Normal" - - key: 0x0003 - value: "Alarm" + value: "Fan failure" - key: 0x0004 - value: "Fault" - attributes: - [ - "Device Serial Number", - "Communication Board Version No.", - "Control Board Version No.", - ] + value: "Grid phase failure" + - key: 0x0008 + value: "Meter communication failure" + - key: 0x40000000 + value: "Battery loss" + - key: 0x80000000 + value: "Parallel communication quality" + - key: "default" + value: "Error" + + - name: "Device Fault" + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 6 + registers: [0x0067, 0x0068, 0x0069, 0x006A] + icon: "mdi:message-alert-outline" - name: "Grid Frequency" class: "frequency" @@ -663,36 +854,6 @@ parameters: offset: 1000 registers: [0x005B] - - name: "Device Serial Number" - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 5 - registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] - icon: "mdi:information" - - - name: "Communication Board Version No." - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x000E] - icon: "mdi:information" - - - name: "Control Board Version No." - attribute: - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x000D] - icon: "mdi:information" - - name: "Grid" update_interval: 30 platform: "binary_sensor" @@ -781,19 +942,20 @@ parameters: min: 0 max: 12000 - - group: Device + - group: Time of Use items: - - name: "Device Alarm" - class: "" + - name: "Time of Use" + update_interval: 300 + platform: "switch" state_class: "" uom: "" scale: 1 - rule: 6 - registers: [0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A] - icon: "mdi:alert-outline" + rule: 1 + registers: [0x00F8] + value: + on: 0x00FF + off: 0x0000 - - group: Time of Use - items: - name: "Program 1 Time" update_interval: 300 platform: "time" @@ -1093,15 +1255,3 @@ parameters: mask: 1 registers: [0x0117] icon: mdi:sun-clock - - - name: "Time of Use" - update_interval: 300 - platform: "switch" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x00F8] - value: - on: 0x00FF - off: 0x0000 diff --git a/custom_components/solarman/inverter_definitions/deye_string.yaml b/custom_components/solarman/inverter_definitions/deye_string.yaml index c3acb6e..1a8ac55 100644 --- a/custom_components/solarman/inverter_definitions/deye_string.yaml +++ b/custom_components/solarman/inverter_definitions/deye_string.yaml @@ -3,33 +3,282 @@ default: digits: 6 parameters: + - group: Device + items: + - name: "Device" + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0000] + icon: "mdi:information" + lookup: + - key: 2 + value: "String Inverter" + - key: 3 + value: "Single-Phase Hybrid Inverter" + - key: 4 + value: "Microinverter" + - key: 5 + value: "LV 3-Phase Hybrid Inverter" + - key: 6 + value: "HV 3-Phase Hybrid Inverter" + - key: 7 + value: "HV 3-Phase Inverter 6-15kw" + - key: 8 + value: "HV 3-Phase Inverter 20-50kw" + attributes: + [ + "Device Modbus Address", + "Device Protocol Version", + "Device Serial Number", + "Device Rated Phase", + "Device Chip Type", + "Device Communication Board Firmware Version Field 2", + "Device Control Board Helper Version", + "Device Control Board Firmware Version Field 2", + "Device Control Board Firmware Version", + "Device Communication Board Firmware Version", + "Device Rated Power", + "Device MPPTs", + "Device Phases", + ] + + - name: "Device Modbus Address" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0001] + icon: "mdi:information" + + - name: "Device Protocol Version" + attribute: + rule: 7 + remove: "0." + registers: [0x0002] + icon: "mdi:information" + + - name: "Device Serial Number" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 5 + registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] + + - name: "Device Rated Phase" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x0008] + lookup: + - key: 1 + value: "Single-Phase" + - key: 2 + value: "Three-Phase" + + - name: "Device Chip Type" + attribute: + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 6 + registers: [0x0009] + lookup: + - key: 0x0000 + value: "AT32F403A" + - key: 0x0001 + value: "SXX32F103" + - key: 0x0002 + value: "GD32F103" + - key: 0x0003 + value: "GD32F303" + + - name: "Device Communication Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000A] + + - name: "Device Control Board Helper Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000B] + + - name: "Device Control Board Firmware Version Field 2" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000C] + + - name: "Device Control Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000D] + + - name: "Device Communication Board Firmware Version" + attribute: + class: "" + state_class: "" + uom: "" + scale: 1 + rule: 7 + registers: [0x000E] + + - name: "Device Rated Power" + attribute: + class: "power" + state_class: "" + uom: "W" + scale: 0.1 + rule: 4 + registers: [0x0010, 0x0011] + icon: "mdi:solar-power" + + - name: "Device MPPTs" + attribute: + update_interval: 300 + class: "" + state_class: "measurement" + uom: "" + rule: 1 + mask: 0x0F00 + divide: 256 + registers: [0x0012] + range: + min: 257 + max: 2051 + + - name: "Device Phases" + attribute: + update_interval: 300 + class: "" + state_class: "measurement" + uom: "" + rule: 1 + mask: 0x000F + registers: [0x0012] + range: + min: 257 + max: 2051 + + - name: "Device State" + class: "enum" + state_class: "" + uom: "" + scale: 1 + rule: 1 + registers: [0x003B] + icon: "mdi:information" + range: + min: 0 + max: 5 + lookup: + - key: 0x0000 + value: "Standby" + - key: 0x0001 + value: "Self-test" + - key: 0x0002 + value: "Normal" + - key: 0x0003 + value: "Alarm" + - key: 0x0004 + value: "Fault" + - group: PV items: - - name: "PV1 Voltage" - class: "voltage" + - name: PV Power + description: Combined power of all inputs + class: "power" state_class: "measurement" - uom: "V" + uom: "W" + rule: 1 + digits: 3 scale: 0.1 + registers: [0x006D, 0x006E, 0x006F, 0x0070] + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] + - registers: [0x006F] + multiply: + registers: [0x0070] + + - name: PV1 Power + class: "power" + state_class: "measurement" + uom: "W" rule: 1 - registers: [0x006D] - icon: "mdi:solar-power-variant" + digits: 3 + scale: 0.1 + registers: [0x006D, 0x006E] + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] - - name: "PV2 Voltage" + - name: "PV1 Voltage" class: "voltage" state_class: "measurement" uom: "V" scale: 0.1 rule: 1 - registers: [0x006F] - icon: "mdi:solar-power-variant" + registers: [0x006D] + icon: "mdi:solar-power" - name: "PV1 Current" class: "current" + state_class: "measurement" uom: "A" scale: 0.1 rule: 1 registers: [0x006E] - icon: "mdi:solar-power-variant" + icon: "mdi:solar-power" + + - name: PV2 Power + class: "power" + state_class: "measurement" + uom: "W" + rule: 1 + digits: 3 + scale: 0.1 + registers: [0x006F, 0x0070] + sensors: + - registers: [0x006F] + multiply: + registers: [0x0070] + + - name: "PV2 Voltage" + class: "voltage" + state_class: "measurement" + uom: "V" + scale: 0.1 + rule: 1 + registers: [0x006F] + icon: "mdi:solar-power" - name: "PV2 Current" class: "current" @@ -38,7 +287,7 @@ parameters: scale: 0.1 rule: 1 registers: [0x0070] - icon: "mdi:solar-power-variant" + icon: "mdi:solar-power" - name: "Today Production" friendly_name: Today's Production @@ -119,33 +368,6 @@ parameters: rule: 1 registers: [0x004F] - - group: Device - items: - # Device - Operating (Running) state - - name: "Device State" - update_interval: 30 - class: "enum" - state_class: "" - uom: "" - scale: 1 - rule: 1 - registers: [0x003B] - icon: "mdi:information" - range: - min: 0 - max: 5 - lookup: - - key: 0x0000 - value: "Standby" - - key: 0x0001 - value: "Self-test" - - key: 0x0002 - value: "Normal" - - key: 0x0003 - value: "Alarm" - - key: 0x0004 - value: "Fault" - - name: "Output AC Power" class: "power" state_class: "measurement" @@ -154,7 +376,7 @@ parameters: rule: 3 registers: [0x0050, 0x0051] - - name: "Input Active Power" + - name: "Input Power" class: "power" state_class: "measurement" uom: "W" @@ -170,7 +392,7 @@ parameters: rule: 3 registers: [0x0054, 0x0055] - - name: "Output Active Power" + - name: "Power" class: "power" state_class: "measurement" uom: "W" @@ -178,6 +400,26 @@ parameters: rule: 3 registers: [0x0056, 0x0057] + - name: Power losses + description: Includes consumption of the inverter device itself as well AC/DC conversion losses + class: "power" + state_class: "measurement" + uom: "W" + rule: 1 + digits: 3 + scale: 0.1 + registers: [0x006D, 0x006E, 0x006F, 0x0070, 0x0056, 0x0057] + uint: enforce + sensors: + - registers: [0x006D] + multiply: + registers: [0x006E] + - registers: [0x006F] + multiply: + registers: [0x0070] + - operator: subtract + registers: [0x0056, 0x0057] + - name: "Output Reactive Power" class: "reactive_power" state_class: "measurement" @@ -185,11 +427,3 @@ parameters: rule: 3 scale: 0.1 registers: [0x0058, 0x0059] - - - name: "Device Serial Number" - class: "" - state_class: "" - uom: "" - scale: 1 - rule: 5 - registers: [0x0003, 0x0004, 0x0005, 0x0006, 0x0007] diff --git a/custom_components/solarman/manifest.json b/custom_components/solarman/manifest.json index caa1e38..f034a31 100644 --- a/custom_components/solarman/manifest.json +++ b/custom_components/solarman/manifest.json @@ -9,5 +9,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/davidrapan/ha-solarman/issues", "requirements": ["ipaddress", "pyyaml", "umodbus", "pysolarmanv5>=3.0.4"], - "version": "24.09.22" + "version": "24.09.23" } diff --git a/custom_components/solarman/parser.py b/custom_components/solarman/parser.py index 20d6fb3..c99cb21 100644 --- a/custom_components/solarman/parser.py +++ b/custom_components/solarman/parser.py @@ -290,6 +290,11 @@ def try_parse_unsigned(self, rawData, definition, start, length): if not "scale" in s and "scale" in definition and (scale := definition["scale"]): s["scale"] = scale if (n := (self._read_registers(rawData, s, start, length) if not "signed" in s else self._read_registers_signed(rawData, s, start, length))) is not None: + if "multiply" in s and (s_multiply := s["multiply"]): + if not "scale" in s_multiply and "scale" in s and (s_scale := s["scale"]): + s_multiply["scale"] = s_scale + if (c := self._read_registers(rawData, s_multiply, start, length)) is not None: + n *= c if not "operator" in s: value += n else: