Open not4rthur opened 9 months ago
Hello,
Thanks also for your work. Same problem on my side for DeltaMax2, "AC Charging power " has not impact and is not updated when on the Ecoflow app the value is updated. Same for bip option (not important ;-) )
Same problem on my side for DeltaMax, "AC Charging power " has not impact and is not updated when on the Ecoflow app the value is updated
Hello guys. So I have a workaround for this, it may actually work for other models if you have the same issue. Unfortunately I'm no developper so I can't integrate this in the main code myself, I'll leave it to the contributors ^^
Here's the hack :
In the file custom_components/ecoflow_cloud/devices/delta_max.py
Comment/replace these lines :
ChargingPowerEntity(client, "inv.cfgFastChgWatt", const.AC_CHARGING_POWER, 400, 2200, lambda value: {"moduleType": 5, "operateType": "acChgCfg", "params": {"chgWatts": int(value), "chgPauseFlag": 255}})
With this :
ChargingPowerEntity(client, "inv.cfgSlowChgWatts", const.AC_CHARGING_POWER, 200, 2000, lambda value: {"moduleType": 0, "operateType": "TCP", "params": {"slowChgPower": value, "id": 69}}),
Restart HA, then you'll have a new 'AC Charging' entity that's functional.
Cheers
Hi @not4rthur Thanks for this, It's work for the control perfectly by HA, but if i change the value in the smartphone application HA dont update the value. This is already a step forward. Thanks again
I can confirm that it works both ways here. I can change the value on the App or in HA and it updates on the other.
Good luck with that last part :)
@not4rthur Can you share your file "delta_max.py" ? I have other similar issues with the entities "Max charge level" and "Min charge level" so I think I'll start from 0 with that. Thanks in advance
Yup, here you go.
` from homeassistant.const import Platform
from . import const, BaseDevice, EntityMigration, MigrationAction from .const import ATTR_DESIGN_CAPACITY, ATTR_FULL_CAPACITY, ATTR_REMAIN_CAPACITY from .. import EcoflowMQTTClient from ..entities import BaseSensorEntity, BaseNumberEntity, BaseSwitchEntity, BaseSelectEntity from ..number import ChargingPowerEntity, MinBatteryLevelEntity, MaxBatteryLevelEntity, \ MaxGenStopLevelEntity, MinGenStartLevelEntity from ..sensor import LevelSensorEntity, RemainSensorEntity, TempSensorEntity, CyclesSensorEntity, \ InWattsSensorEntity, OutWattsSensorEntity, StatusSensorEntity, MilliVoltSensorEntity, \ InMilliVoltSensorEntity, OutMilliVoltSensorEntity from ..switch import BeeperEntity, EnabledEntity
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), LevelSensorEntity(client, "ems.lcdShowSoc", const.COMBINED_BATTERY_LEVEL), InWattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER), OutWattsSensorEntity(client, "pd.wattsOutSum", const.TOTAL_OUT_POWER),
InWattsSensorEntity(client, "inv.inputWatts", const.AC_IN_POWER),
OutWattsSensorEntity(client, "inv.outputWatts", const.AC_OUT_POWER),
InMilliVoltSensorEntity(client, "inv.acInVol", const.AC_IN_VOLT),
OutMilliVoltSensorEntity(client, "inv.invOutVol", const.AC_OUT_VOLT),
InWattsSensorEntity(client, "mppt.inWatts", const.SOLAR_IN_POWER),
# OutWattsSensorEntity(client, "pd.carWatts", const.DC_OUT_POWER),
# the same value as pd.carWatts
OutWattsSensorEntity(client, "mppt.outWatts", const.DC_OUT_POWER),
OutWattsSensorEntity(client, "pd.typec1Watts", const.TYPEC_1_OUT_POWER),
OutWattsSensorEntity(client, "pd.typec2Watts", const.TYPEC_2_OUT_POWER),
OutWattsSensorEntity(client, "pd.usb1Watts", const.USB_1_OUT_POWER),
OutWattsSensorEntity(client, "pd.usb2Watts", const.USB_2_OUT_POWER),
OutWattsSensorEntity(client, "pd.qcUsb1Watts", const.USB_QC_1_OUT_POWER),
OutWattsSensorEntity(client, "pd.qcUsb2Watts", const.USB_QC_2_OUT_POWER),
RemainSensorEntity(client, "ems.chgRemainTime", const.CHARGE_REMAINING_TIME),
RemainSensorEntity(client, "ems.dsgRemainTime", const.DISCHARGE_REMAINING_TIME),
TempSensorEntity(client, "inv.outTemp", "Inv Out Temperature"),
CyclesSensorEntity(client, "bmsMaster.cycles", const.CYCLES),
TempSensorEntity(client, "bmsMaster.temp", const.BATTERY_TEMP),
TempSensorEntity(client, "bmsMaster.minCellTemp", const.MIN_CELL_TEMP, False),
TempSensorEntity(client, "bmsMaster.maxCellTemp", const.MAX_CELL_TEMP, False),
MilliVoltSensorEntity(client, "bmsMaster.vol", const.BATTERY_VOLT, False),
MilliVoltSensorEntity(client, "bmsMaster.minCellVol", const.MIN_CELL_VOLT, False),
MilliVoltSensorEntity(client, "bmsMaster.maxCellVol", const.MAX_CELL_VOLT, False),
# Optional Slave Battery
#LevelSensorEntity(client, "bms_slave.soc", const.SLAVE_BATTERY_LEVEL, False, True),
#TempSensorEntity(client, "bms_slave.temp", const.SLAVE_BATTERY_TEMP, False, True),
#TempSensorEntity(client, "bms_slave.minCellTemp", const.SLAVE_MIN_CELL_TEMP, False),
#TempSensorEntity(client, "bms_slave.maxCellTemp", const.SLAVE_MAX_CELL_TEMP, False),
#VoltSensorEntity(client, "bms_slave.vol", const.SLAVE_BATTERY_VOLT, False),
#VoltSensorEntity(client, "bms_slave.minCellVol", const.SLAVE_MIN_CELL_VOLT, False),
#VoltSensorEntity(client, "bms_slave.maxCellVol", const.SLAVE_MAX_CELL_VOLT, False),
#CyclesSensorEntity(client, "bms_slave.cycles", const.SLAVE_CYCLES, False, True),
#InWattsSensorEntity(client, "bms_slave.inputWatts", const.SLAVE_IN_POWER, False, True),
#OutWattsSensorEntity(client, "bms_slave.outputWatts", const.SLAVE_OUT_POWER, False, True)
StatusSensorEntity(client),
]
def numbers(self, client: EcoflowMQTTClient) -> list[BaseNumberEntity]:
return [
MaxBatteryLevelEntity(client, "ems.maxChargeSoc", const.MAX_CHARGE_LEVEL, 50, 100,
lambda value: {"moduleType": 2, "operateType": "upsConfig",
"params": {"maxChgSoc": int(value)}}),
MinBatteryLevelEntity(client, "ems.minDsgSoc", const.MIN_DISCHARGE_LEVEL, 0, 30,
lambda value: {"moduleType": 2, "operateType": "dsgCfg",
"params": {"minDsgSoc": int(value)}}),
MinGenStartLevelEntity(client, "ems.minOpenOilEbSoc", const.GEN_AUTO_START_LEVEL, 0, 30,
lambda value: {"moduleType": 2, "operateType": "closeOilSoc",
"params": {"closeOilSoc": value}}),
MaxGenStopLevelEntity(client, "ems.maxCloseOilEbSoc", const.GEN_AUTO_STOP_LEVEL, 50, 100,
lambda value: {"moduleType": 2, "operateType": "openOilSoc",
"params": {"openOilSoc": value}}),
ChargingPowerEntity(client, "inv.cfgSlowChgWatts", const.AC_CHARGING_POWER, 200, 2000,
lambda value: {"moduleType": 0, "operateType": "TCP",
"params": {"slowChgPower": value, "id": 69}}),
]
def switches(self, client: EcoflowMQTTClient) -> list[BaseSwitchEntity]:
return [
BeeperEntity(client, "pd.beepState", const.BEEPER,
lambda value: {"moduleType": 5, "operateType": "quietMode", "params": {"enabled": value}}),
EnabledEntity(client, "pd.dcOutState", const.USB_ENABLED,
lambda value: {"moduleType": 0, "operateType": "TCP", "params": {"enabled": value, "id": 34 }}),
EnabledEntity(client, "pd.acAutoOnCfg", const.AC_ALWAYS_ENABLED,
lambda value: {"moduleType": 1, "operateType": "acAutoOn", "params": {"cfg": value}}),
EnabledEntity(client, "pd.pvChgPrioSet", const.PV_PRIO,
lambda value: {"moduleType": 1, "operateType": "pvChangePrio", "params": {"pvChangeSet": value}}),
EnabledEntity(client, "inv.cfgAcEnabled", const.AC_ENABLED,
lambda value: {"moduleType": 0, "operateType": "TCP", "params": {"enabled": value, "id": 66 }}),
EnabledEntity(client, "inv.cfgAcXboost", const.XBOOST_ENABLED,
lambda value: {"moduleType": 5, "operateType": "TCP", "params": {"id": 66, "xboost": value}}),
EnabledEntity(client, "mppt.carState", const.DC_ENABLED,
lambda value: {"moduleType": 0, "operateType": "TCP", "params": {"enabled": value, "id": 81 }}),
]
def selects(self, client: EcoflowMQTTClient) -> list[BaseSelectEntity]:
return [
#DictSelectEntity(client, "mppt.cfgDcChgCurrent", const.DC_CHARGE_CURRENT, const.DC_CHARGE_CURRENT_OPTIONS,
# lambda value: {"moduleType": 5, "operateType": "dcChgCfg",
# "params": {"dcChgCfg": value}}),
#TimeoutDictSelectEntity(client, "pd.lcdOffSec", const.SCREEN_TIMEOUT, const.SCREEN_TIMEOUT_OPTIONS,
# lambda value: {"moduleType": 1, "operateType": "lcdCfg",
# "params": {"brighLevel": 255, "delayOff": value}}),
#TimeoutDictSelectEntity(client, "inv.cfgStandbyMin", const.UNIT_TIMEOUT, const.UNIT_TIMEOUT_OPTIONS,
# lambda value: {"moduleType": 1, "operateType": "standbyTime",
# "params": {"standbyMin": value}}),
#TimeoutDictSelectEntity(client, "mppt.acStandbyMins", const.AC_TIMEOUT, const.AC_TIMEOUT_OPTIONS,
# lambda value: {"moduleType": 5, "operateType": "standbyTime",
# "params": {"standbyMins": value}}),
#TimeoutDictSelectEntity(client, "mppt.carStandbyMin", const.DC_TIMEOUT, const.DC_TIMEOUT_OPTIONS,
# lambda value: {"moduleType": 5, "operateType": "carStandby",
# "params": {"standbyMins": value}})
]
def migrate(self, version) -> list[EntityMigration]:
if version == 2:
return [
EntityMigration("pd.soc", Platform.SENSOR, MigrationAction.REMOVE),
]
return []
`
Hi, Perfect now all work for the "ChargingPowerEntity" in both ways :) thanks But i have always the issue with the "MaxBatteryLevelEntity" & "MinBatteryLevelEntity" if i change in HA, the value update after 5 seconds with the value on the smartphone application, so i can't change the value on HA only in the smatphone application and after HA read the value. Have you the same behavior ?
Hey, thanks, works perfectly
TOTAL_IN_POWER
TOTAL_OUT_POWER
shows 0, you also have the same problem ?
InWattsSensorEntity(client, "pd.wattsInSum", const.TOTAL_IN_POWER),
OutWattsSensorEntity(client, "pd.wattsOutSum", const.TOTAL_OUT_POWER),
Hi @jeff1975 if you want the Total ( accumulation ) of IN and OUT
you can use this Power value and new entitie see : #168.
If it is the instantaneous consultation in Watt on my side these entities work in effect:
but the battery needs to be charging of course, like this :
I hope this helps you
For me the fix via
ChargingPowerEntity(client, "inv.cfgFastChgWatt", const.AC_CHARGING_POWER, 200, 2000,
lambda value: {"moduleType": 0, "operateType": "TCP",
"params": {"slowChgPower": value, "id": 69}}),
doesn't seem to work.
Home Assistant shows:
1100 is only visible when I try to adjust the value, so it atleast confirms the range from 200-2000, but in the diagnostic data of the DELTA Max I read
"inv.cfgFastChgWatts": 2200,
and I don't know what to make of it.
Hey, same Problem here, as described by @Nid01 :( Would appriciate some help
Update: @v3ry you forget to change cfgFastChgWatt to cfgSlowChgWatts after i changed that it works
Hello, thank you for this amazing integration!
I'm using a Delta Max unit, all features are working fine but I can't get the 'AC charging power' slider to work. The Ecoflow App allow changing the value from 200 to 2000, but in the integration's I get a slider with 400 to 2200.
Also, whatever value I change the slider to, no action is taken on the battery even in the correct range. Not sure what I'm missing here.. I activated debug and it only shows a call but no error :
2023-10-01 19:59:50.740 DEBUG (MainThread) [custom_components.ecoflow_cloud.mqtt.ecoflow_mqtt] Sending {"from": "HomeAssistant", "id": "999923587", "version": "1.0", "moduleType": 5, "operateType": "acChgCfg", "params": {"chgWatts": 1000, "chgPauseFlag": 255}} :(0, 4)(False)
As anyone faced a similar issue and could point me in the right direction please ?