Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion custom_components/solaredge_modbus/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from homeassistant.const import (
ATTR_SECONDS,
PERCENTAGE,
EntityCategory,
UnitOfApparentPower,
UnitOfElectricCurrent,
UnitOfElectricPotential,
Expand Down Expand Up @@ -190,16 +191,19 @@ class SolarEdgeSelectDescription(
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="status",
name="Status",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="statusvendor",
name="Status Vendor",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
]
)
Expand Down Expand Up @@ -443,6 +447,7 @@ class SolarEdgeSelectDescription(
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
)
)

Expand All @@ -455,6 +460,7 @@ class SolarEdgeSelectDescription(
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
)
)

Expand All @@ -467,6 +473,7 @@ class SolarEdgeSelectDescription(
device_class=SensorDeviceClass.CURRENT,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
)
)

Expand Down Expand Up @@ -503,6 +510,7 @@ class SolarEdgeSelectDescription(
device_class=SensorDeviceClass.ENERGY_STORAGE,
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
)
)

Expand All @@ -515,13 +523,18 @@ class SolarEdgeSelectDescription(
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=(
EntityCategory.DIAGNOSTIC if key == "state_of_health" else None
),
)
)

for batteryKey, batteryList in BATTERIES.items():
batteryList.append(
SensorEntityDescription(
key=batteryKey + "_status", name=batteryKey.capitalize() + " Status"
key=batteryKey + "_status",
name=batteryKey.capitalize() + " Status",
entity_category=EntityCategory.DIAGNOSTIC,
)
)

Expand Down Expand Up @@ -581,6 +594,7 @@ class SolarEdgeSelectDescription(
fmt="u16",
attrs={"min": 0, "max": 100},
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
)
)

Expand All @@ -594,12 +608,14 @@ class SolarEdgeSelectDescription(
name="Export control mode",
register=0xE000,
options_dict=EXPORT_CONTROL_MODE,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeSelectDescription(
key="export_control_limit_mode",
name="Export control limit mode",
register=0xE001,
options_dict=EXPORT_CONTROL_LIMIT_MODE,
entity_category=EntityCategory.CONFIG,
),
]
)
Expand All @@ -613,6 +629,7 @@ class SolarEdgeSelectDescription(
fmt="f",
attrs={"min": 0, "max": DEFAULT_MAX_EXPORT_CONTROL_SITE_LIMIT},
native_unit_of_measurement=UnitOfPower.WATT,
entity_category=EntityCategory.CONFIG,
)
)

Expand All @@ -625,24 +642,28 @@ class SolarEdgeSelectDescription(
name="Storage Control Mode",
register=0xE004,
options_dict=STORAGE_CONTROL_MODE,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeSelectDescription(
key="storage_ac_charge_policy",
name="Storage AC Charge Policy",
register=0xE005,
options_dict=STORAGE_AC_CHARGE_POLICY,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeSelectDescription(
key="storage_default_mode",
name="Storage Default Mode",
register=0xE00A,
options_dict=STORAGE_CHARGE_DISCHARGE_MODE,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeSelectDescription(
key="storage_remote_command_mode",
name="Storage Remote Command Mode",
register=0xE00D,
options_dict=STORAGE_CHARGE_DISCHARGE_MODE,
entity_category=EntityCategory.CONFIG,
),
]
)
Expand All @@ -658,6 +679,7 @@ class SolarEdgeSelectDescription(
register=0xE006,
fmt="f",
attrs={"min": 0, "max": 100000000000},
entity_category=EntityCategory.CONFIG,
),
SolarEdgeNumberDescription(
name="Storage Backup reserved",
Expand All @@ -666,6 +688,7 @@ class SolarEdgeSelectDescription(
fmt="f",
attrs={"min": 0, "max": 100},
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeNumberDescription(
name="Storage Remote Command Timeout",
Expand All @@ -674,6 +697,7 @@ class SolarEdgeSelectDescription(
fmt="u32",
attrs={"min": 0, "max": 86400},
native_unit_of_measurement=ATTR_SECONDS,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeNumberDescription(
name="Storage Remote Charge Limit",
Expand All @@ -682,6 +706,7 @@ class SolarEdgeSelectDescription(
fmt="f",
attrs={"min": 0, "max": 20000},
native_unit_of_measurement=UnitOfPower.WATT,
entity_category=EntityCategory.CONFIG,
),
SolarEdgeNumberDescription(
name="Storage Remote Discharge Limit",
Expand All @@ -690,6 +715,7 @@ class SolarEdgeSelectDescription(
fmt="f",
attrs={"min": 0, "max": 20000},
native_unit_of_measurement=UnitOfPower.WATT,
entity_category=EntityCategory.CONFIG,
),
]
)