Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wills106 committed Mar 16, 2024
2 parents b9d899a + e1ade39 commit efe6c74
Showing 1 changed file with 253 additions and 0 deletions.
253 changes: 253 additions & 0 deletions custom_components/solax_modbus/plugin_sofar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3036,6 +3036,259 @@ def value_function_sync_rtc_ymd_sofar(initval, descr, datadict):
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
),

###
#
# Battery Configuration (0x1044-0x105A)
# Read-only for now. On write all 23 registers would need to be set in one chunk.
#
###
SofarModbusSensorEntityDescription(
name = "BatConfig: ID",
key = "bat_config_id",
register = 0x1044,
newblock = True,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Address 1",
key = "bat_config_address_1",
register = 0x1045,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Protocol",
key = "bat_config_protocol",
register = 0x1046,
scale = { 0: "First Flight built-in BMS/Default",
1: "Pie Energy protocol/PYLON",
2: "First Flight protocol/GENERAL",
3: "AMASS",
4: "LG",
5: "AlphaESS",
6: "CATL",
7: "WECO",
8: "Fronus",
9: "EMS",
10: "Nilar",
11: "BTS 5K",
11: "Move for",},
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Overvoltage Protection",
key = "bat_config_overvoltage_protection",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x1047,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Charging Voltage",
key = "bat_config_charging_voltage",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x1048,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Undervoltage Protection",
key = "bat_config_undervoltage_protection",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x1049,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Minimum Discharge Voltage",
key = "bat_config_minimum_discharge_voltage",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x104A,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Maximum Charge Current Limit",
key = "bat_config_maximum_charge_current_limit",
native_unit_of_measurement = UnitOfElectricCurrent.AMPERE,
register = 0x104B,
scale = 0.01,
rounding = 2,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Maximum Discharge Current Limit",
key = "bat_config_maximum_discharge_current_limit",
native_unit_of_measurement = UnitOfElectricCurrent.AMPERE,
register = 0x104C,
scale = 0.01,
rounding = 2,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Depth of Discharge",
key = "bat_config_depth_of_discharge",
native_unit_of_measurement = PERCENTAGE,
register = 0x104D,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: End of Discharge",
key = "bat_config_end_of_discharge",
native_unit_of_measurement = PERCENTAGE,
register = 0x104E,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Capacity",
key = "bat_config_capacity",
native_unit_of_measurement = "Ah",
register = 0x104F,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Rated Battery Voltage",
key = "bat_config_rated_battery_voltage",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x1050,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Cell Type",
key = "bat_config_cell_type",
register = 0x1051,
scale = { 0: "Lead acid",
1: "Lithium iron phosphate",
2: "Ternary",
3: "Lithium titanate",
4: "AGM",
5: "Gel",
6: "Flooded", },
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: EPS Buffer",
key = "bat_config_eps_buffer",
native_unit_of_measurement = PERCENTAGE,
register = 0x1052,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
# 0x1053 BatConfig_Control skipped for now. Only useful when writing
SofarModbusSensorEntityDescription(
name = "BatConfig: Address 2",
key = "bat_config_address_2",
register = 0x1054,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Address 3",
key = "bat_config_address_3",
register = 0x1055,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Address 4",
key = "bat_config_address_4",
register = 0x1055,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Lead Acid Battery Temperature Compensation Factor",
key = "bat_config_tempco",
native_unit_of_measurement = "mV/Cell",
register = 0x1057,
unit = REGISTER_S16,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Lead Acid Battery Recovery Buffer",
key = "bat_config_rated_battery_voltage",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x1058,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),
SofarModbusSensorEntityDescription(
name = "BatConfig: Lead Acid Battery Float Voltage",
key = "bat_config_voltage_float",
native_unit_of_measurement = UnitOfElectricPotential.VOLT,
register = 0x105A,
scale = 0.1,
rounding = 1,
entity_category = EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default = False,
allowedtypes = HYBRID,
icon = "mdi:battery-check-outline",
),

###
#
# Remote Control (0x1100-0x12FF)
Expand Down

0 comments on commit efe6c74

Please sign in to comment.