Skip to content

Commit

Permalink
Update plugin_alphaess.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wills106 committed Oct 13, 2024
1 parent b81e582 commit de5b7df
Showing 1 changed file with 350 additions and 1 deletion.
351 changes: 350 additions & 1 deletion custom_components/solax_modbus/plugin_alphaess.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,224 @@ class AlphaESSModbusSensorEntityDescription(BaseModbusSensorEntityDescription):

EXPORT_LIMIT_SCALE_EXCEPTIONS = []

NUMBER_TYPES = []
NUMBER_TYPES = [
AlphaESSModbusNumberEntityDescription(
name = "Discharge Minimum SOC",
key = "discharge_minimum_soc",
register = 0x850,
fmt = "i",
native_min_value = 10,
native_max_value = 99,
native_step = 1,
native_unit_of_measurement = PERCENTAGE,
allowedtypes = GEN,
icon = "mdi:battery-sync",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Start 1 Hours",
key = "discharge_start_1_hours",
register = 0x851,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Stop 1 Hours",
key = "discharge_stop_1_hours",
register = 0x852,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Start 2 Hours",
key = "discharge_start_2_hours",
register = 0x853,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Stop 2 Hours",
key = "discharge_stop_2_hours",
register = 0x854,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Target SOC",
key = "charge_target_soc",
register = 0x855,
fmt = "i",
native_min_value = 10,
native_max_value = 99,
native_step = 1,
native_unit_of_measurement = PERCENTAGE,
allowedtypes = GEN,
icon = "mdi:battery-sync",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Start 1 Hours",
key = "charge_start_1_hours",
register = 0x856,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Stop 1 Hours",
key = "charge_stop_1_hours",
register = 0x857,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Start 2 Hours",
key = "charge_start_2_hours",
register = 0x858,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Stop 2 Hours",
key = "charge_stop_2_hours",
register = 0x859,
fmt = "i",
native_min_value = 0,
native_max_value = 23,
native_step = 1,
native_unit_of_measurement = UnitOfTime.HOURS,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Start 1 Mins",
key = "discharge_start_1_mins",
register = 0x85A,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Stop 1 Mins",
key = "discharge_stop_1_mins",
register = 0x85B,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Start 2 Mins",
key = "discharge_start_2_mins",
register = 0x85C,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Discharge Stop 2 Mins",
key = "discharge_stop_2_mins",
register = 0x85D,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Start 1 Mins",
key = "charge_start_1_mins",
register = 0x85E,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Stop 1 Mins",
key = "charge_stop_1_mins",
register = 0x85F,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Start 2 Mins",
key = "charge_start_2_mins",
register = 0x860,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
AlphaESSModbusNumberEntityDescription(
name = "Charge Stop 2 Mins",
key = "charge_stop_2_mins",
register = 0x861,
fmt = "i",
native_min_value = 0,
native_max_value = 59,
native_step = 1,
native_unit_of_measurement = UnitOfTime.MINUTES,
allowedtypes = GEN,
icon = "mdi:battery-clock",
),
]

# ================================= Select Declarations ============================================================

Expand Down Expand Up @@ -138,6 +355,19 @@ class AlphaESSModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
allowedtypes = GEN | X3,
icon = "mdi:dip-switch",
),
AlphaESSModbusSelectEntityDescription(
name = "Time Preiod Control",
key = "time_preiod_control",
register = 0x84F,
option_dict = {
0: "Disabled",
1: "Charge - Enabled",
2: "Discharge - Enabled",
3: "Both - Enabled",
},
allowedtypes = GEN,
icon = "mdi:dip-switch",
),
]

# ================================= Sennsor Declarations ============================================================
Expand Down Expand Up @@ -708,6 +938,125 @@ class AlphaESSModbusSensorEntityDescription(BaseModbusSensorEntityDescription):
allowedtypes = GEN | X3,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "time_preiod_control",
register = 0x84F,
scale = { 0: "Disabled",
1: "Charge - Enabled",
2: "Discharge - Enabled",
3: "Both - Enabled", },
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_minimum_soc",
register = 0x850,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_start_1_hours",
register = 0x851,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_stop_1_hours",
register = 0x852,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_start_2_hours",
register = 0x853,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_stop_2_hours",
register = 0x854,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_target_soc",
register = 0x855,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_start_1_hours",
register = 0x856,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_stop_1_hours",
register = 0x857,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_start_2_hours",
register = 0x858,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_stop_2_hours",
register = 0x859,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_start_1_mins",
register = 0x85A,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_stop_1_mins",
register = 0x85B,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_start_2_mins",
register = 0x85C,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "discharge_stop_2_mins",
register = 0x85D,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_start_1_mins",
register = 0x85E,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_stop_1_mins",
register = 0x85F,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_start_2_mins",
register = 0x860,
allowedtypes = GEN,
internal = True,
),
AlphaESSModbusSensorEntityDescription(
key = "charge_stop_2_mins",
register = 0x861,
allowedtypes = GEN,
internal = True,
),

]

# ============================ plugin declaration =================================================
Expand Down

0 comments on commit de5b7df

Please sign in to comment.