Home Assistant Git Exporter
This commit is contained in:
@@ -1,40 +1,46 @@
|
||||
from homeassistant.const import Platform
|
||||
|
||||
from . import const, BaseDevice, EntityMigration, MigrationAction
|
||||
from .const import ATTR_DESIGN_CAPACITY, ATTR_FULL_CAPACITY, ATTR_REMAIN_CAPACITY, BATTERY_CHARGING_STATE, \
|
||||
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
|
||||
from ..number import ChargingPowerEntity, MaxBatteryLevelEntity, MinBatteryLevelEntity, BatteryBackupLevel
|
||||
from ..select import DictSelectEntity, TimeoutDictSelectEntity
|
||||
from ..sensor import LevelSensorEntity, RemainSensorEntity, TempSensorEntity, \
|
||||
CyclesSensorEntity, InWattsSensorEntity, OutWattsSensorEntity, VoltSensorEntity, StatusSensorEntity, \
|
||||
MilliVoltSensorEntity, InMilliVoltSensorEntity, OutMilliVoltSensorEntity, ChargingStateSensorEntity, \
|
||||
CapacitySensorEntity
|
||||
CyclesSensorEntity, InWattsSensorEntity, OutWattsSensorEntity, VoltSensorEntity, InAmpSensorEntity, \
|
||||
InVoltSensorEntity, QuotasStatusSensorEntity, MilliVoltSensorEntity, InMilliVoltSensorEntity, \
|
||||
OutMilliVoltSensorEntity, ChargingStateSensorEntity, CapacitySensorEntity
|
||||
from ..switch import EnabledEntity
|
||||
|
||||
|
||||
class River2(BaseDevice):
|
||||
|
||||
def charging_power_step(self) -> int:
|
||||
return 50
|
||||
|
||||
def sensors(self, client: EcoflowMQTTClient) -> list[BaseSensorEntity]:
|
||||
return [
|
||||
LevelSensorEntity(client, "bms_bmsStatus.soc", const.MAIN_BATTERY_LEVEL)
|
||||
.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),
|
||||
.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),
|
||||
|
||||
LevelSensorEntity(client, "bms_bmsStatus.soh", const.SOH),
|
||||
|
||||
LevelSensorEntity(client, "bms_emsStatus.lcdShowSoc", const.COMBINED_BATTERY_LEVEL),
|
||||
|
||||
ChargingStateSensorEntity(client, "bms_emsStatus.chgState", const.BATTERY_CHARGING_STATE),
|
||||
ChargingStateSensorEntity(client, "bms_emsStatus.chgState", BATTERY_CHARGING_STATE),
|
||||
|
||||
InWattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER),
|
||||
OutWattsSensorEntity(client, "pd.wattsOutSum", const.TOTAL_OUT_POWER),
|
||||
|
||||
InAmpSensorEntity(client, "inv.dcInAmp", const.SOLAR_IN_CURRENT),
|
||||
InVoltSensorEntity(client, "inv.dcInVol", const.SOLAR_IN_VOLTAGE),
|
||||
|
||||
InWattsSensorEntity(client, "inv.inputWatts", const.AC_IN_POWER),
|
||||
OutWattsSensorEntity(client, "inv.outputWatts", const.AC_OUT_POWER),
|
||||
|
||||
@@ -44,14 +50,15 @@ class River2(BaseDevice):
|
||||
InWattsSensorEntity(client, "pd.typecChaWatts", const.TYPE_C_IN_POWER),
|
||||
InWattsSensorEntity(client, "mppt.inWatts", const.SOLAR_IN_POWER),
|
||||
|
||||
OutWattsSensorEntity(client, "pd.carWatts", const.DC_OUT_POWER),
|
||||
OutWattsSensorEntity(client, "pd.typec1Watts", const.TYPEC_1_OUT_POWER),
|
||||
|
||||
# both USB-A Ports (the small RIVER 2 has only two) are being summarized under "pd.usb1Watts" - https://github.com/tolwi/hassio-ecoflow-cloud/issues/12#issuecomment-1432837393
|
||||
OutWattsSensorEntity(client, "pd.carWatts", const.DC_OUT_POWER),
|
||||
OutWattsSensorEntity(client, "pd.typec1Watts", const.TYPEC_OUT_POWER),
|
||||
OutWattsSensorEntity(client, "pd.usb1Watts", const.USB_OUT_POWER),
|
||||
# OutWattsSensorEntity(client, "pd.usb2Watts", const.USB_2_OUT_POWER),
|
||||
|
||||
RemainSensorEntity(client, "bms_emsStatus.chgRemainTime", const.CHARGE_REMAINING_TIME),
|
||||
RemainSensorEntity(client, "bms_emsStatus.dsgRemainTime", const.DISCHARGE_REMAINING_TIME),
|
||||
RemainSensorEntity(client, "pd.remainTime", const.REMAINING_TIME),
|
||||
|
||||
TempSensorEntity(client, "inv.outTemp", "Inv Out Temperature"),
|
||||
CyclesSensorEntity(client, "bms_bmsStatus.cycles", const.CYCLES),
|
||||
@@ -68,8 +75,8 @@ class River2(BaseDevice):
|
||||
MilliVoltSensorEntity(client, "bms_bmsStatus.minCellVol", const.MIN_CELL_VOLT, False),
|
||||
MilliVoltSensorEntity(client, "bms_bmsStatus.maxCellVol", const.MAX_CELL_VOLT, False),
|
||||
|
||||
QuotasStatusSensorEntity(client),
|
||||
# FanSensorEntity(client, "bms_emsStatus.fanLevel", "Fan Level"),
|
||||
StatusSensorEntity(client),
|
||||
|
||||
]
|
||||
|
||||
@@ -86,6 +93,14 @@ class River2(BaseDevice):
|
||||
ChargingPowerEntity(client, "mppt.cfgChgWatts", const.AC_CHARGING_POWER, 100, 360,
|
||||
lambda value: {"moduleType": 5, "operateType": "acChgCfg",
|
||||
"params": {"chgWatts": int(value), "chgPauseFlag": 255}}),
|
||||
|
||||
BatteryBackupLevel(client, "pd.bpPowerSoc", const.BACKUP_RESERVE_LEVEL, 5, 100,
|
||||
"bms_emsStatus.minDsgSoc", "bms_emsStatus.maxChargeSoc",
|
||||
lambda value: {"moduleType": 1, "operateType": "watthConfig",
|
||||
"params": {"isConfig": 1,
|
||||
"bpPowerSoc": int(value),
|
||||
"minDsgSoc": 0,
|
||||
"minChgSoc": 0}}),
|
||||
]
|
||||
|
||||
def switches(self, client: EcoflowMQTTClient) -> list[BaseSwitchEntity]:
|
||||
@@ -95,15 +110,28 @@ class River2(BaseDevice):
|
||||
"params": {"enabled": value, "out_voltage": -1, "out_freq": 255,
|
||||
"xboost": 255}}),
|
||||
|
||||
EnabledEntity(client, "pd.acAutoOutConfig", const.AC_ALWAYS_ENABLED,
|
||||
lambda value, params: {"moduleType": 1, "operateType": "acAutoOutConfig",
|
||||
"params": {"acAutoOutConfig": value,
|
||||
"minAcOutSoc": int(params.get("bms_emsStatus.minDsgSoc", 0)) + 5}}
|
||||
),
|
||||
|
||||
EnabledEntity(client, "mppt.cfgAcXboost", const.XBOOST_ENABLED,
|
||||
lambda value: {"moduleType": 5, "operateType": "acOutCfg",
|
||||
"params": {"enabled": 255, "out_voltage": -1, "out_freq": 255,
|
||||
"xboost": value}}),
|
||||
|
||||
EnabledEntity(client, "pd.carState", const.DC_ENABLED,
|
||||
lambda value: {"moduleType": 5, "operateType": "mpptCar", "params": {"enabled": value}})
|
||||
lambda value: {"moduleType": 5, "operateType": "mpptCar", "params": {"enabled": value}}),
|
||||
|
||||
EnabledEntity(client, "pd.bpPowerSoc", const.BP_ENABLED,
|
||||
lambda value, params: {"moduleType": 1, "operateType": "watthConfig",
|
||||
"params": {"isConfig": value,
|
||||
"bpPowerSoc": value,
|
||||
"minDsgSoc": 0,
|
||||
"minChgSoc": 0}})
|
||||
]
|
||||
|
||||
|
||||
def selects(self, client: EcoflowMQTTClient) -> list[BaseSelectEntity]:
|
||||
return [
|
||||
DictSelectEntity(client, "mppt.dcChgCurrent", const.DC_CHARGE_CURRENT, const.DC_CHARGE_CURRENT_OPTIONS,
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"reactivex==4.0.4",
|
||||
"protobuf>=4.23.0"
|
||||
],
|
||||
"version": "0.13.3"
|
||||
"version": "0.13.4"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"title": "EcoFlow-Cloud",
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"username": "Email do utilizador",
|
||||
"password": "Palavra-passe do utilizador",
|
||||
"type": "Tipo de dispositivo",
|
||||
"name": "Nome do dispositivo",
|
||||
"device_id": "SN do dispositivo"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"power_step": "Controlo deslizante da potência",
|
||||
"refresh_period_sec": "Período de atualização dos dados (segundos)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user