diff --git a/custom_components/alphaess/const.py b/custom_components/alphaess/const.py index f565ad1..84df884 100644 --- a/custom_components/alphaess/const.py +++ b/custom_components/alphaess/const.py @@ -16,8 +16,10 @@ INVERTER_COUNT = 0 INVERTER_LIST = [] +KNOWN_INVERTERS = ["Storion-S5", "SMILE5-INV", "VT1000", "SMILE-T10-HV-INV"] # List of known inverters + # Set blacklist for certain inverters from certain sensors -INVERTER_SETTING_BLACKLIST = [] # Blacklist sensors for setting discharge/charge amount and sending discharge and charge amount +INVERTER_SETTING_BLACKLIST = ["VT1000"] # Blacklist sensors for setting discharge/charge amount and sending discharge and charge amount LIMITED_INVERTER_SENSOR_LIST = ["Storion-S5"] # Blacklist sensors for showing data relating to getlastpowerdata and other data points # Inverters who do not support "getlastpowerdata" diff --git a/custom_components/alphaess/coordinator.py b/custom_components/alphaess/coordinator.py index 95abcb5..c9c72cb 100644 --- a/custom_components/alphaess/coordinator.py +++ b/custom_components/alphaess/coordinator.py @@ -62,7 +62,8 @@ def __init__(self, hass: HomeAssistant, client: alphaess.alphaess) -> None: self.hass = hass # Reduce the throttle count lower due to the reduced API calls it makes - if all(inverter not in self.model_list for inverter in LOWER_INVERTER_API_CALL_LIST) and len(self.model_list) > 0: + if all(inverter not in self.model_list for inverter in LOWER_INVERTER_API_CALL_LIST) and len( + self.model_list) > 0: self.has_throttle = False set_throttle_count_lower() @@ -124,6 +125,13 @@ async def _async_update_data(self): if invertor.get("minv") is not None: inverterdata["Model"] = await process_value(invertor.get("minv")) + if invertor.get("mbat") is not None: + inverterdata["Battery Model"] = await process_value(invertor.get("mbat")) + + inverterdata["Inverter nominal Power"] = await process_value(invertor.get("poinv")) + inverterdata["Pv nominal Power"] = await process_value(invertor.get("popv")) + + inverterdata["EMS Status"] = await process_value(invertor.get("emsStatus")) inverterdata["Maximum Battery Capacity"] = await process_value(invertor.get("usCapacity")) inverterdata["Current Capacity"] = await process_value(invertor.get("surplusCobat")) @@ -164,6 +172,7 @@ async def _async_update_data(self): _soc = await safe_get(_powerdata, "soc") _gridpowerdetails = _powerdata.get("pgridDetail", {}) _pvpowerdetails = _powerdata.get("ppvDetail", {}) + _getEVdetails = _powerdata.get("pevDetail", {}) inverterdata["Instantaneous Battery SOC"] = _soc @@ -179,10 +188,19 @@ async def _async_update_data(self): inverterdata["Instantaneous PPV2"] = await safe_get(_pvpowerdetails, "ppv2") inverterdata["Instantaneous PPV3"] = await safe_get(_pvpowerdetails, "ppv3") inverterdata["Instantaneous PPV4"] = await safe_get(_pvpowerdetails, "ppv4") + inverterdata["pmeterDc"] = await safe_get(_pvpowerdetails, "pmeterDc") + inverterdata["pev"] = await safe_get(_powerdata, "pev") + inverterdata["Electric Vehicle Power One"] = await safe_get(_getEVdetails, "ev1Power") + inverterdata["Electric Vehicle Power Two"] = await safe_get(_getEVdetails, "ev2Power") + inverterdata["Electric Vehicle Power Three"] = await safe_get(_getEVdetails, "ev3Power") + inverterdata["Electric Vehicle Power Four"] = await safe_get(_getEVdetails, "ev4Power") inverterdata["Instantaneous Grid I/O Total"] = await safe_get(_powerdata, "pgrid") inverterdata["Instantaneous Grid I/O L1"] = await safe_get(_gridpowerdetails, "pmeterL1") inverterdata["Instantaneous Grid I/O L2"] = await safe_get(_gridpowerdetails, "pmeterL2") inverterdata["Instantaneous Grid I/O L3"] = await safe_get(_gridpowerdetails, "pmeterL3") + inverterdata["PrealL1"] = await safe_get(_powerdata, "prealL1") + inverterdata["PrealL2"] = await safe_get(_powerdata, "prealL1") + inverterdata["PrealL3"] = await safe_get(_powerdata, "prealL1") # Get Charge Config _charge_config = invertor.get("ChargeConfig", {}) diff --git a/custom_components/alphaess/enums.py b/custom_components/alphaess/enums.py index 42d3951..27b9bef 100644 --- a/custom_components/alphaess/enums.py +++ b/custom_components/alphaess/enums.py @@ -51,3 +51,15 @@ class AlphaESSNames(str, Enum): DischargeTime2 = "Discharge Period 2" ChargeRange = "Charging Range" Total_Generation = "Total Generation" + ElectricVehiclePowerOne = "Electric Vehicle Power One" + ElectricVehiclePowerTwo = "Electric Vehicle Power Two" + ElectricVehiclePowerThree = "Electric Vehicle Power Three" + ElectricVehiclePowerFour = "Electric Vehicle Power Four" + pev = "pev" + pmeterDc = "pmeterDc" + PrealL1 = "PrealL1" + PrealL2 = "PrealL2" + PrealL3 = "PrealL3" + mbat = "Battery Model" + popv = "Pv nominal Power" + poinv = "Inverter nominal Power" diff --git a/custom_components/alphaess/manifest.json b/custom_components/alphaess/manifest.json index 78fe1fd..62820f6 100644 --- a/custom_components/alphaess/manifest.json +++ b/custom_components/alphaess/manifest.json @@ -15,7 +15,7 @@ "requirements": [ "alphaessopenapi==0.0.11" ], - "version": "0.5.7" + "version": "0.5.8" } diff --git a/custom_components/alphaess/sensorlist.py b/custom_components/alphaess/sensorlist.py index 4c85b8e..63edbb5 100644 --- a/custom_components/alphaess/sensorlist.py +++ b/custom_components/alphaess/sensorlist.py @@ -266,7 +266,106 @@ state_class=None, entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:battery-lock-open", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.mbat, + name="Battery Model", + native_unit_of_measurement=None, + state_class=None, + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:battery-heart-variant", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.poinv, + name="Inverter nominal Power", + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=None, + device_class=SensorDeviceClass.ENERGY, + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:lightning-bolt", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.popv, + name="Pv nominal Power", + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=None, + device_class=SensorDeviceClass.ENERGY, + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:lightning-bolt", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.pmeterDc, + name="pmeterDc", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:current-dc", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerOne, + name="Electric Vehicle Power One", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerTwo, + name="Electric Vehicle Power Two", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerThree, + name="Electric Vehicle Power Three", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerFour, + name="Electric Vehicle Power Four", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.pev, + name="pev", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.PrealL1, + name="PrealL1", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.PrealL2, + name="PrealL2", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.PrealL3, + name="PrealL3", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", ) + ] LIMITED_SENSOR_DESCRIPTIONS: List[AlphaESSSensorDescription] = [ @@ -449,6 +548,104 @@ state_class=None, entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:battery-lock-open", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.mbat, + name="Battery Model", + native_unit_of_measurement=None, + state_class=None, + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:battery-heart-variant", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.poinv, + name="Inverter nominal Power", + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=None, + device_class=SensorDeviceClass.ENERGY, + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:lightning-bolt", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.popv, + name="Pv nominal Power", + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=None, + device_class=SensorDeviceClass.ENERGY, + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:lightning-bolt", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.pmeterDc, + name="pmeterDc", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:current-dc", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerOne, + name="Electric Vehicle Power One", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerTwo, + name="Electric Vehicle Power Two", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerThree, + name="Electric Vehicle Power Three", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.ElectricVehiclePowerFour, + name="Electric Vehicle Power Four", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:car-electric", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.pev, + name="pev", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.PrealL1, + name="PrealL1", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.PrealL2, + name="PrealL2", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", + ), + AlphaESSSensorDescription( + key=AlphaESSNames.PrealL3, + name="PrealL3", + native_unit_of_measurement=UnitOfPower.WATT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:flash", ) ]