Skip to content

Commit

Permalink
feat: Fourth batch of name standardization
Browse files Browse the repository at this point in the history
- Fixed class type battery to only with SOC
- Battery SoC/Percentage to Battery
- Battery Status to Battery State
- Battery 1* to Battery*
- Device/Inverter Status to Device State
- SN to Serial Number
  • Loading branch information
davidrapan committed Aug 14, 2024
1 parent 4b3f128 commit 2930e60
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 131 deletions.
2 changes: 2 additions & 0 deletions custom_components/solarman/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ async def service_read_holding_registers(self, register, quantity, wait_for_atte
_LOGGER.warning(f"[{self.serial}] service_read_holding_registers: [{register}], quantity: [{quantity}] failed. [{format_exception(e)}]")
if not self.auto_reconnect:
await self.async_disconnect()
raise

async def service_read_input_registers(self, register, quantity, wait_for_attempts = ACTION_ATTEMPTS):
_LOGGER.debug(f"[{self.serial}] service_read_input_registers: [{register}], quantity: [{quantity}]")
Expand All @@ -268,6 +269,7 @@ async def service_read_input_registers(self, register, quantity, wait_for_attemp
_LOGGER.warning(f"[{self.serial}] service_read_input_registers: [{register}], quantity: [{quantity}] failed. [{format_exception(e)}]")
if not self.auto_reconnect:
await self.async_disconnect()
raise

async def service_write_holding_register(self, register, value, wait_for_attempts = ACTION_ATTEMPTS) -> bool:
_LOGGER.debug(f"[{self.serial}] service_write_holding_register: {register}, value: {value}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default:
digits: 6

parameters:
- group: solar
- group: PV
items:
- name: "PV1 Voltage"
class: "voltage"
Expand Down Expand Up @@ -164,6 +164,5 @@ parameters:
uom: "°C"
scale: 0.1
rule: 1

registers: [0x000D]
icon: "mdi:thermometer"
25 changes: 12 additions & 13 deletions custom_components/solarman/inverter_definitions/afore_hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default:
digits: 6

parameters:
- group: solar
- group: PV
items:
- name: "PV1 Voltage"
class: "voltage"
Expand Down Expand Up @@ -112,21 +112,21 @@ parameters:
registers: [0x07DA]
icon: "mdi:battery-minus"

- name: "Battery Status"
class: ""
- name: "Battery State"
class: "enum"
state_class: "measurement"
uom: ""
scale: 1
rule: 1
registers: [0x07D0]
isstr: true
options: ["charging", "discharging", "idle"]
lookup:
- key: 4
value: "Charge"
value: "charging"
- key: 5
value: "Discharge"
value: "discharging"
- key: 6
value: "Stand-by"
value: "idle"
icon: "mdi:battery"

- name: "Battery Power"
Expand Down Expand Up @@ -156,7 +156,7 @@ parameters:
registers: [0x07D5]
icon: "mdi:battery"

- name: "Battery SOC"
- name: "Battery"
class: "battery"
state_class: "measurement"
uom: "%"
Expand Down Expand Up @@ -221,21 +221,20 @@ parameters:
registers: [0x0201]
icon: "mdi:home-lightning-bolt"

- group: Inverter
- group: Device
items:
- name: "Running Status"
- name: "Device State"
class: ""
state_class: ""
uom: ""
scale: 1
rule: 1
registers: [0x09C4]
isstr: true
lookup:
- key: 1
value: "Stand-by"
value: "Standby"
- key: 2
value: "Start-up"
value: "Startup"
- key: 3
value: "Grid"
- key: 4
Expand Down
28 changes: 15 additions & 13 deletions custom_components/solarman/inverter_definitions/deye_hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,21 @@ parameters:
registers: [0x0047]
icon: "mdi:battery-minus"

- name: "Battery Status"
- name: "Battery State"
class: "enum"
state_class: ""
uom: ""
scale: 1
rule: 1
registers: [0x00BD]
options: ["Charge", "Stand-by", "Discharge"]
options: ["charging", "idle", "discharging"]
lookup:
- key: 0
value: "Charge"
value: "charging"
- key: 1
value: "Stand-by"
value: "idle"
- key: 2
value: "Discharge"
value: "discharging"
icon: "mdi:battery"

- name: "Battery Power"
Expand All @@ -159,7 +159,7 @@ parameters:
rule: 1
registers: [0x00B7]

- name: "Battery SOC"
- name: "Battery"
class: "battery"
state_class: "measurement"
uom: "%"
Expand Down Expand Up @@ -231,7 +231,7 @@ parameters:
registers: [0x00A1]
icon: "mdi:transmission-tower"

- name: "Internal CT L1 Power"
- name: "Internal CT1 Power"
class: "power"
state_class: "measurement"
uom: "W"
Expand All @@ -240,7 +240,7 @@ parameters:
registers: [0x00A7]
icon: "mdi:transmission-tower"

- name: "Internal CT L2 Power"
- name: "Internal CT2 Power"
class: "power"
state_class: "measurement"
uom: "W"
Expand All @@ -249,7 +249,7 @@ parameters:
registers: [0x00A8]
icon: "mdi:transmission-tower"

- name: "External CT L1 Power"
- name: "External CT1 Power"
class: "power"
state_class: "measurement"
uom: "W"
Expand All @@ -258,7 +258,7 @@ parameters:
registers: [0x00AA]
icon: "mdi:transmission-tower"

- name: "External CT L2 Power"
- name: "External CT2 Power"
class: "power"
state_class: "measurement"
uom: "W"
Expand Down Expand Up @@ -384,15 +384,18 @@ parameters:
value: "ON"
icon: "mdi:lightning-bolt-circle"

- group: Inverter
- group: Device
items:
- name: "Running Status"
# 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
Expand All @@ -408,7 +411,6 @@ parameters:
value: "Alarm"
- key: 0x0004
value: "Fault"
icon: "mdi:information"

- name: "Power"
class: "power"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ parameters:
rule: 1
registers: [0x004F]

- group: Inverter
- group: Device
items:
- name: "Running Status"
# Device - Operating (Running) state
- name: "Device State"
update_interval: 30
class: "enum"
state_class: ""
uom: ""
Expand Down
20 changes: 10 additions & 10 deletions custom_components/solarman/inverter_definitions/kstar_hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ requests:
code: 0x03

parameters:
- group: solar
- group: PV
items:
- name: "PV1 Voltage"
class: "voltage"
Expand Down Expand Up @@ -263,7 +263,7 @@ parameters:
- group: Battery
items:
- name: "Battery Type"
class: "battery"
class: ""
state_class: "measurement"
uom: ""
scale: 1
Expand Down Expand Up @@ -303,7 +303,7 @@ parameters:
registers: [3065]
icon: "mdi:battery-charging-high"

- name: "Battery SoC"
- name: "Battery"
class: "battery"
state_class: "measurement"
uom: "%"
Expand All @@ -322,7 +322,7 @@ parameters:
icon: "mdi:battery-heart-outline"

- name: "Battery Discharge Capacity Depth"
class: "battery"
class: ""
state_class: "measurement"
uom: "%"
scale: 1
Expand Down Expand Up @@ -463,7 +463,7 @@ parameters:
- key: 0
value: "Initialize"
- key: 1
value: "Stand-by"
value: "Standby"
- key: 2
value: "Hybrid Grid"
- key: 3
Expand All @@ -490,7 +490,7 @@ parameters:
value: "Permanent Error"
icon: "mdi:wrench"

- name: "Inverter status"
- name: "Inverter Status"
class: ""
state_class: "measurement"
uom: ""
Expand All @@ -499,7 +499,7 @@ parameters:
registers: [3047]
lookup:
- key: 0
value: "Stand-by"
value: "Standby"
- key: 1
value: "Off-Grid"
- key: 2
Expand All @@ -510,7 +510,7 @@ parameters:
value: "On-Grid to Off-Grid"
icon: "mdi:wrench"

- name: "DCDC status"
- name: "DCDC Status"
class: ""
state_class: "measurement"
uom: ""
Expand All @@ -519,7 +519,7 @@ parameters:
registers: [3048]
lookup:
- key: 0
value: "Stand-by"
value: "Standby"
- key: 1
value: "Soft Boot"
- key: 2
Expand Down Expand Up @@ -639,7 +639,7 @@ parameters:
registers: [3217]
icon: "mdi:wrench"

- name: "Inverter SN Number"
- name: "Device Serial Number"
class: ""
state_class: "measurement"
uom: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ default:
parameters:
- group: Basic information
items:
- name: "Device SN"
- name: "Device Serial Number"
class: ""
state_class: ""
uom: ""
Expand Down Expand Up @@ -111,7 +111,7 @@ parameters:
registers: [5126]
icon: "mdi:thermometer"

- name: "Battery Charge"
- name: "Battery"
class: "battery"
state_class: "measurement"
uom: "%"
Expand Down Expand Up @@ -300,7 +300,7 @@ parameters:
registers: [5151]

- name: "Battery Pack SOH"
class: "battery"
class: ""
state_class: "measurement"
uom: "%"
scale: 1
Expand Down
Loading

0 comments on commit 2930e60

Please sign in to comment.