Skip to content

Commit

Permalink
State of Health sensor for multiple devices
Browse files Browse the repository at this point in the history
  • Loading branch information
tolwi committed Jan 10, 2024
1 parent 6d40451 commit 49af9e2
Show file tree
Hide file tree
Showing 20 changed files with 192 additions and 171 deletions.
52 changes: 45 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.
⚠️ Originally developed for personal use without a goal to cover all available device attributes

## Current state
<details><summary> DELTA_2 <i>(sensors: 43, switches: 8, sliders: 6, selects: 5)</i> </summary>
<details><summary> DELTA_2 <i>(sensors: 45, switches: 8, sliders: 6, selects: 5)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Total In Power
- Total Out Power
Expand Down Expand Up @@ -50,6 +51,7 @@ Once installed, use Add Integration -> Ecoflow Cloud.
- Slave Design Capacity _(disabled)_
- Slave Full Capacity _(disabled)_
- Slave Remain Capacity _(disabled)_
- Slave State of Health
- Slave Battery Temperature _(auto)_
- Slave Min Cell Temperature _(disabled)_
- Slave Max Cell Temperature _(disabled)_
Expand Down Expand Up @@ -88,14 +90,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.

</p></details>

<details><summary> RIVER_2 <i>(sensors: 28, switches: 3, sliders: 3, selects: 5)</i> </summary>
<details><summary> RIVER_2 <i>(sensors: 29, switches: 3, sliders: 3, selects: 5)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Battery Charging State
- Total In Power
Expand Down Expand Up @@ -140,14 +143,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.

</p></details>

<details><summary> RIVER_2_MAX <i>(sensors: 31, switches: 5, sliders: 4, selects: 5)</i> </summary>
<details><summary> RIVER_2_MAX <i>(sensors: 32, switches: 5, sliders: 4, selects: 5)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Battery Charging State
- Total In Power
Expand Down Expand Up @@ -198,14 +202,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.

</p></details>

<details><summary> RIVER_2_PRO <i>(sensors: 29, switches: 3, sliders: 3, selects: 5)</i> </summary>
<details><summary> RIVER_2_PRO <i>(sensors: 30, switches: 3, sliders: 3, selects: 5)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Battery Charging State
- Total In Power
Expand Down Expand Up @@ -251,14 +256,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.

</p></details>

<details><summary> DELTA_PRO <i>(sensors: 50, switches: 6, sliders: 6, selects: 4)</i> </summary>
<details><summary> DELTA_PRO <i>(sensors: 53, switches: 6, sliders: 6, selects: 4)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Total In Power
- Total Out Power
Expand Down Expand Up @@ -294,13 +300,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.
- Slave 1 Design Capacity _(disabled)_
- Slave 1 Full Capacity _(disabled)_
- Slave 1 Remain Capacity _(disabled)_
- Slave 1 State of Health
- Slave 1 Battery Temperature _(auto)_
- Slave 1 In Power _(auto)_
- Slave 1 Out Power _(auto)_
- Slave 2 Battery Level _(auto)_
- Slave 2 Design Capacity _(disabled)_
- Slave 2 Full Capacity _(disabled)_
- Slave 2 Remain Capacity _(disabled)_
- Slave 2 State of Health
- Slave 2 Battery Temperature _(auto)_
- Slave 2 In Power _(auto)_
- Slave 2 Out Power _(auto)_
Expand Down Expand Up @@ -446,14 +454,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.

</p></details>

<details><summary> DELTA_MINI <i>(sensors: 32, switches: 4, sliders: 3, selects: 4)</i> </summary>
<details><summary> DELTA_MINI <i>(sensors: 33, switches: 4, sliders: 3, selects: 4)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Total In Power
- Total Out Power
Expand Down Expand Up @@ -557,14 +566,15 @@ Once installed, use Add Integration -> Ecoflow Cloud.

</p></details>

<details><summary> DELTA_2_MAX <i>(sensors: 31, switches: 6, sliders: 5, selects: 3)</i> </summary>
<details><summary> DELTA_2_MAX <i>(sensors: 60, switches: 6, sliders: 5, selects: 3)</i> </summary>
<p>

*Sensors*
- Main Battery Level
- Main Design Capacity _(disabled)_
- Main Full Capacity _(disabled)_
- Main Remain Capacity _(disabled)_
- State of Health
- Battery Level
- Total In Power
- Total Out Power
Expand All @@ -591,6 +601,34 @@ Once installed, use Add Integration -> Ecoflow Cloud.
- Battery Volts _(disabled)_
- Min Cell Volts _(disabled)_
- Max Cell Volts _(disabled)_
- Slave 1 Battery Level _(auto)_
- Slave 1 Design Capacity _(disabled)_
- Slave 1 Full Capacity _(disabled)_
- Slave 1 Remain Capacity _(disabled)_
- Slave 1 Battery Temperature _(auto)_
- Slave 1 Min Cell Temperature _(disabled)_
- Slave 1 Max Cell Temperature _(disabled)_
- Slave 1 Battery Volts _(disabled)_
- Slave 1 Min Cell Volts _(disabled)_
- Slave 1 Max Cell Volts _(disabled)_
- Slave 1 Cycles _(auto)_
- Slave 1 State of Health _(auto)_
- Slave 1 In Power _(auto)_
- Slave 1 Out Power _(auto)_
- Slave 2 Battery Level _(auto)_
- Slave 2 Design Capacity _(disabled)_
- Slave 2 Full Capacity _(disabled)_
- Slave 2 Remain Capacity _(disabled)_
- Slave 2 Battery Temperature _(auto)_
- Slave 2 Min Cell Temperature _(disabled)_
- Slave 2 Max Cell Temperature _(disabled)_
- Slave 2 Battery Volts _(disabled)_
- Slave 2 Min Cell Volts _(disabled)_
- Slave 2 Max Cell Volts _(disabled)_
- Slave 2 Cycles _(auto)_
- Slave 2 State of Health _(auto)_
- Slave 2 In Power _(auto)_
- Slave 2 Out Power _(auto)_
- Status

*Switches*
Expand Down
31 changes: 16 additions & 15 deletions custom_components/ecoflow_cloud/devices/delta2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from homeassistant.const import Platform

from . import const, BaseDevice, EntityMigration, MigrationAction
from .const import ATTR_DESIGN_CAPACITY, ATTR_FULL_CAPACITY, ATTR_REMAIN_CAPACITY, MAIN_DESIGN_CAPACITY, \
MAIN_FULL_CAPACITY, MAIN_REMAIN_CAPACITY, SLAVE_DESIGN_CAPACITY, SLAVE_FULL_CAPACITY, SLAVE_REMAIN_CAPACITY
from .. import EcoflowMQTTClient
from ..entities import BaseSensorEntity, BaseNumberEntity, BaseSwitchEntity, BaseSelectEntity
from ..number import ChargingPowerEntity, MinBatteryLevelEntity, MaxBatteryLevelEntity, \
Expand All @@ -18,12 +16,14 @@ class Delta2(BaseDevice):
def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
return [
LevelSensorEntity(client, "bms_bmsStatus.soc", const.MAIN_BATTERY_LEVEL)
.attr("bms_bmsStatus.designCap", ATTR_DESIGN_CAPACITY, 0)
.attr("bms_bmsStatus.fullCap", ATTR_FULL_CAPACITY, 0)
.attr("bms_bmsStatus.remainCap", ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bms_bmsStatus.designCap", MAIN_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bms_bmsStatus.fullCap", MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bms_bmsStatus.remainCap", MAIN_REMAIN_CAPACITY, False),
.attr("bms_bmsStatus.designCap", const.ATTR_DESIGN_CAPACITY, 0)
.attr("bms_bmsStatus.fullCap", const.ATTR_FULL_CAPACITY, 0)
.attr("bms_bmsStatus.remainCap", const.ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bms_bmsStatus.designCap", const.MAIN_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bms_bmsStatus.fullCap", const.MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bms_bmsStatus.remainCap", const.MAIN_REMAIN_CAPACITY, False),

LevelSensorEntity(client, "bms_bmsStatus.soh", const.SOH),

LevelSensorEntity(client, "bms_emsStatus.lcdShowSoc", const.COMBINED_BATTERY_LEVEL),
InWattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER),
Expand Down Expand Up @@ -72,13 +72,14 @@ def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:

# Optional Slave Battery
LevelSensorEntity(client, "bms_slave.soc", const.SLAVE_BATTERY_LEVEL, False, True)
.attr("bms_slave.designCap", ATTR_DESIGN_CAPACITY, 0)
.attr("bms_slave.fullCap", ATTR_FULL_CAPACITY, 0)
.attr("bms_slave.remainCap", ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bms_slave.designCap", SLAVE_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bms_slave.fullCap", SLAVE_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bms_slave.remainCap", SLAVE_REMAIN_CAPACITY, False),

.attr("bms_slave.designCap", const.ATTR_DESIGN_CAPACITY, 0)
.attr("bms_slave.fullCap", const.ATTR_FULL_CAPACITY, 0)
.attr("bms_slave.remainCap", const.ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bms_slave.designCap", const.SLAVE_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bms_slave.fullCap", const.SLAVE_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bms_slave.remainCap", const.SLAVE_REMAIN_CAPACITY, False),

LevelSensorEntity(client, "bms_slave.soh", const.SLAVE_SOH),
TempSensorEntity(client, "bms_slave.temp", const.SLAVE_BATTERY_TEMP, False, True)
.attr("bms_slave.minCellTemp", const.ATTR_MIN_CELL_TEMP, 0)
.attr("bms_slave.maxCellTemp", const.ATTR_MAX_CELL_TEMP, 0),
Expand Down
4 changes: 3 additions & 1 deletion custom_components/ecoflow_cloud/devices/delta2_max.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
CapacitySensorEntity(client, "bms_bmsStatus.fullCap", const.MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bms_bmsStatus.remainCap", const.MAIN_REMAIN_CAPACITY, False),

LevelSensorEntity(client, "bms_bmsStatus.soh", const.SOH),

LevelSensorEntity(client, "bms_emsStatus.lcdShowSoc", const.COMBINED_BATTERY_LEVEL),

InWattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER),
Expand Down Expand Up @@ -103,7 +105,7 @@ def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
CapacitySensorEntity(client, "bms_slave_bmsSlaveStatus_2.fullCap", const.SLAVE_N_FULL_CAPACITY % 2, False),
CapacitySensorEntity(client, "bms_slave_bmsSlaveStatus_2.remainCap", const.SLAVE_N_REMAIN_CAPACITY % 2, False),

TempSensorEntity(client, "bms_slave_bmsSlaveStatus_2.temp", const.SLAVE_N_BATTERY_TEMP % 2, False, True)
TempSensorEntity(client, "bms_slave_bmsSlaveStatus_2.temp", const.SLAVE_N_BATTERY_TEMP % 2, False, True)
.attr("bms_slave_bmsSlaveStatus_2.minCellTemp", const.ATTR_MIN_CELL_TEMP, 0)
.attr("bms_slave_bmsSlaveStatus_2.maxCellTemp", const.ATTR_MAX_CELL_TEMP, 0),
TempSensorEntity(client, "bms_slave_bmsSlaveStatus_2.minCellTemp", const.SLAVE_N_MIN_CELL_TEMP % 2, False),
Expand Down
14 changes: 6 additions & 8 deletions custom_components/ecoflow_cloud/devices/delta_max.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from homeassistant.const import Platform

from . import const, BaseDevice, EntityMigration, MigrationAction
from .const import ATTR_DESIGN_CAPACITY, ATTR_FULL_CAPACITY, ATTR_REMAIN_CAPACITY, MAIN_DESIGN_CAPACITY, \
MAIN_FULL_CAPACITY, MAIN_REMAIN_CAPACITY
from .. import EcoflowMQTTClient
from ..entities import BaseSensorEntity, BaseNumberEntity, BaseSwitchEntity, BaseSelectEntity
from ..number import ChargingPowerEntity, MinBatteryLevelEntity, MaxBatteryLevelEntity, \
Expand All @@ -18,12 +16,12 @@ class DeltaMax(BaseDevice):
def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
return [
LevelSensorEntity(client, "bmsMaster.soc", const.MAIN_BATTERY_LEVEL)
.attr("bmsMaster.designCap", ATTR_DESIGN_CAPACITY, 0)
.attr("bmsMaster.fullCap", ATTR_FULL_CAPACITY, 0)
.attr("bmsMaster.remainCap", ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bmsMaster.designCap", MAIN_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.fullCap", MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.remainCap", MAIN_REMAIN_CAPACITY, False),
.attr("bmsMaster.designCap", const.ATTR_DESIGN_CAPACITY, 0)
.attr("bmsMaster.fullCap", const.ATTR_FULL_CAPACITY, 0)
.attr("bmsMaster.remainCap", const.ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bmsMaster.designCap", const.MAIN_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.fullCap", const.MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.remainCap", const.MAIN_REMAIN_CAPACITY, False),

LevelSensorEntity(client, "ems.lcdShowSoc", const.COMBINED_BATTERY_LEVEL),
InWattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER),
Expand Down
18 changes: 9 additions & 9 deletions custom_components/ecoflow_cloud/devices/delta_mini.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from homeassistant.const import Platform

from . import const, BaseDevice, EntityMigration, MigrationAction
from .const import ATTR_DESIGN_CAPACITY, ATTR_FULL_CAPACITY, ATTR_REMAIN_CAPACITY, MAIN_DESIGN_CAPACITY, \
MAIN_FULL_CAPACITY, MAIN_REMAIN_CAPACITY
from ..entities import BaseSensorEntity, BaseNumberEntity, BaseSwitchEntity, BaseSelectEntity
from ..mqtt.ecoflow_mqtt import EcoflowMQTTClient
from ..number import ChargingPowerEntity, MaxBatteryLevelEntity, MinBatteryLevelEntity
Expand All @@ -18,12 +16,15 @@ class DeltaMini(BaseDevice):
def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
return [
LevelSensorEntity(client, "bmsMaster.soc", const.MAIN_BATTERY_LEVEL)
.attr("bmsMaster.designCap", ATTR_DESIGN_CAPACITY, 0)
.attr("bmsMaster.fullCap", ATTR_FULL_CAPACITY, 0)
.attr("bmsMaster.remainCap", ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bmsMaster.designCap", MAIN_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.fullCap", MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.remainCap", MAIN_REMAIN_CAPACITY, False),
.attr("bmsMaster.designCap", const.ATTR_DESIGN_CAPACITY, 0)
.attr("bmsMaster.fullCap", const.ATTR_FULL_CAPACITY, 0)
.attr("bmsMaster.remainCap", const.ATTR_REMAIN_CAPACITY, 0),
CapacitySensorEntity(client, "bmsMaster.designCap", const.MAIN_DESIGN_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.fullCap", const.MAIN_FULL_CAPACITY, False),
CapacitySensorEntity(client, "bmsMaster.remainCap", const.MAIN_REMAIN_CAPACITY, False),

LevelSensorEntity(client, "bmsMaster.soh", const.SOH),

LevelSensorEntity(client, "ems.lcdShowSoc", const.COMBINED_BATTERY_LEVEL),

WattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER),
Expand All @@ -38,7 +39,6 @@ def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
InWattsSolarSensorEntity(client, "mppt.inWatts", const.SOLAR_IN_POWER),

OutWattsDcSensorEntity(client, "mppt.outWatts", const.DC_OUT_POWER),
# OutWattsSensorEntity(client, "pd.carWatts", const.DC_OUT_POWER),

OutWattsSensorEntity(client, "mppt.carOutWatts", const.DC_CAR_OUT_POWER),
OutWattsSensorEntity(client, "mppt.dcdc12vWatts", const.DC_ANDERSON_OUT_POWER),
Expand Down
Loading

0 comments on commit 49af9e2

Please sign in to comment.