Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands #1

Open
mattwells opened this issue Mar 20, 2022 · 173 comments
Open

Commands #1

mattwells opened this issue Mar 20, 2022 · 173 comments

Comments

@mattwells
Copy link

mattwells commented Mar 20, 2022

A few things having done some digging myself.

Port 6093 seems to have something to do with upgrading firmware, perhaps the reason it leaves offline mode is because it is preparing to receive an update?

There are a few method that have peeked my interest:

  • BleCommand.setMainsParam and DirectDeviceCommand.setDcInputMode I am really hoping that this will allow control over charging from the mains (e.g. on/off), but it seems to be used to set the voltage and fequency so I am guessing that wont be the case.
  • BleCommand.setEspMode this appears to send a boolean value, perhaps turn on the ability to debug or flash the ESP module?
  • BleCommand.sendBmsDataCommand, DirectTcpManager.getBmsDataBytes and DirectTcpManager.getBmsSDataBytes it would be really nice if the BMS exposes information about each cell in the power station

There are a few methods around MQTT which suggests that it could be configured to push information to an MQTT server, maybe this is how they are getting the graphs in the mobile app for charge and discharge? Unless it is a typo for MPPT

com.ecoflow.common.command.BleCommand

The first param str in all of these methods appears to be the address of the device.

  • public void getCpuId(String str, int i)
  • public void getSn(String str, int i)
  • public void getWifiListCommand(String str, int i)
  • public void setHostCommand(String str, String str2, int i)
  • public void setHostCommand(String str, String str2)
  • public void getName(String str, int i)
  • public void setNameCommand(String str, String str2, int i)
  • public void setBCNameCommand(String str, String str2)
  • public void getWifiInfo(String str)
  • public void getIsDormancyCommand(String str)
  • public void sendPdCommand(String str)
  • public void sendEmsDataCommand(String str)
  • public void sendBmsDataCommand(String str)
  • public void sendInvDataCommand(String str)
  • public void sendMpptDataCommand(String str)
  • public void getCarChargerInputCommand(String str)
  • public void sendNotifyCommand(String str)
  • public void sendMinDsgSocCommand(String str, int i)
  • public void sendUpsCommand(String str, int i, int i2, int i3)
  • public void sendScWattsCommand(String str, int i)
  • public void sendAcCommand(String str, int i, int i2)
  • public void sendXBootCommand(String str, int i)
  • public void sendDcCommand(String str, int i, int i2, int i3)
  • public void sendSystemStandCommand(String str, int i)
  • public void sendLcdCommand(String str, int i, int i2, int i3)
  • public void sendBuzzerCommand(String str, int i)
  • public void sendLcdCommand(String str, int i)
  • public void sendResetCommand(String str)
  • public void sendCloseCommand(String str, int i)
  • public void sendCarChargerInputCommand(String str, int i)
  • public void sendAcOutFreqCommand(String str, int i)
  • public void sendPassword(String str, String str2)
  • public void getPassword(String str)
  • public void sendSilenceCharge(String str, boolean z, int i, int i2)
  • public void sendAcStandbyMinCommand(String str, int i)
  • public void sendOpenOilCommand(String str, int i, int i2, int i3)
  • public void sendCloseOilCommand(String str, int i, int i2, int i3)
  • public void mj100Reset(String str)
  • public void mj100DcOut(String str, int i)
  • public void mj100AcOutEnabled(String str, int i)
  • public void mj100AcOutXBoost(String str, int i)
  • public void mj100AcOutOutFreq(String str, int i)
  • public void mj100SetHvType(String str, int i)
  • public void mj100GetHvType(String str)
  • public void mj100SetStandBy(String str, int i)
  • public void mj100SmartProtection(String str, int i)
  • public void setMqttServer(String str, String str2, int i)
  • public void setMqttServerConfig(String str, String str2, String str3)
  • public void setMqttInfo(String str)
  • public void replayChannelPowerAck(String str, byte[] bArr, int i)
  • public void replyAck(String str, int i, int i2, int i3)
  • public void replyTimerTaskAck(String str, int i)
  • public void replyLogAck(String str, byte[] bArr, LogModItem logModItem)
  • public void replyHearBeat(String str, byte b, byte b2)
  • public void sendCFGPowerModeCommand(String str, byte[] bArr)
  • public void setAreaInfo(String str, String str2)
  • public void setMainsParam(String str, int i, int i2)
  • public void setEspMode(String str, boolean z)
  • public void setChannelCurrent(String str, int i, int i2)
  • public void setCfgSta(String str, int i)
  • public void setSplitPhase(String str, byte[] bArr)
  • public void setChannelEnableState(String str, int i, boolean z)
  • public void setChannelName(String str, int i, int i2, byte[] bArr)
  • public void getChannelInfo(String str)
  • public void setDischargeTime(String str, ByteBuffer byteBuffer)
  • public void setChargeTime(String str, ByteBuffer byteBuffer)
  • public void sendCHModeCommand(String str, int i, int i2, int i3)
  • public void setRestart(String str)
  • public void updateTime(String str, Date date)
  • public void setPowerStation(String str, int i, int i2, int i3)
  • public void setMH200DeviceName(String str, String str2)

com.ecoflow.common.command.CommandUtil

  • public static int getSynchronousCmdSet(int i)
  • public static int getSynchronousDst(int i)
  • public static int getWifiListCmdId(int i)
  • public static int setHostCmdId(int i)
  • public static int setStaCmdId(int i)
  • public static byte[] CommandToByteArray(byte[] bArr, int i, int i2, int i3, int i4)
  • public static byte[] getAcPayLoad(int i, int i2)
  • public static int getAcDst(int i)
  • public static int getCmdSet(int i)
  • public static int getAcCmdId(int i)
  • public static int getDcDst(int i, int i2)
  • public static int getDcCmdSet(int i, int i2)
  • public static int getDcCmdId(int i, int i2)
  • public static byte[] getLcdSettingTime(int i, int i2, int i3)
  • public static int getDcInputModeDst(int i, int i2)
  • public static int getDcInputModeCmdSet(int i, int i2)
  • public static int setDcInputModeId(int i, int i2)
  • public static int getDcInputModeId(int i, int i2)
  • public static int getUpsDst(int i, int i2)
  • public static int getUpsCmdSet(int i, int i2)
  • public static int getUpsCmdId(int i, int i2)
  • public static int getCpuIdDst(int i)
  • public static int getSnDst(int i)
  • public static int getNameCmdSet(int i)
  • public static int getNameCmdId(int i)

com.ecoflow.common.command.DirectDeviceCommand

  • public void getSnCommand()
  • public void setSnCommand(String str)
  • public void getCpuId()
  • public void sendSystemStandCommand(int i)
  • public void sendAcCommand(int i, int i2)
  • public void sendXBootCommand(int i)
  • public void sendAcOutFreqCommand(int i)
  • public void sendUsbCommand(int i)
  • public void sendBuzzerCommand(int i)
  • public void sendResetCommand()
  • public void sendCloseCommand(int i)
  • public void sendGetPdInfo()
  • public void sendLedCommand(int i)
  • public void sendDcCommand(int i, int i2, int i3)
  • public void sendLcdCommand(int i, int i2, int i3)
  • public void sendLcdCommand(int i)
  • public void sendAmbientModelCommand(int i)
  • public void setAmbientLightBrightnessCommand(int i)
  • public void setAnimationLightModeCommand(int i)
  • public void setAmbientLightColorCommand(int i)
  • public void setDcInputMode(int i, int i2, int i3)
  • public void getDcInputMode(int i, int i2)
  • public void sendUpsCommand(int i, int i2, int i3)
  • public void sendMinDsgSocCommand(int i, int i2, int i3)
  • public void sendCarChargerInputCommand(int i, int i2, int i3)
  • public void getCarChargerInputCommand(int i, int i2)
  • public void sendOpenOilCommand(int i, int i2, int i3)
  • public void sendCloseOilCommand(int i, int i2, int i3)
  • public void sendWattCommand(int i)
  • public void sendScWattsCommand(int i)
  • public void sendFanCommand(int i)
  • public void getFanCommand()
  • public void sendChgPauseCommand(int i)
  • public void sendAcStandbyMinCommand(int i)
  • public void sendSilenceCharge(boolean z, int i, int i2)
  • public void sendGetProduceInfo(int i)

com.ecoflow.common.helper.DirectTcpManager

  • public void startConnect()
  • public void initSp()
  • public void startHeartBeat()
  • public void getSnData()
  • private void getMr500SnData()
  • public byte[] getLcdTimeData()
  • private void getMr500CpuId()
  • public byte[] getOilDataBytes()
  • public void notifyWillSetSta()
  • public byte[] getPdDataBytes()
  • public byte[] getEmsDataBytes()
  • public byte[] getBmsDataBytes()
  • public byte[] getBmsSDataBytes()
  • public byte[] getInvDataBytes()
  • public byte[] getMpptDataBytes()
  • public void sendData(byte[] bArr)
  • public DirectDeviceCommand getDirectDeviceCommand()
  • public void setUserDisconnect(boolean z)
@mattwells
Copy link
Author

Heartbeat Package

  • int32 carUsedTime
  • int32 chgPowerAC
  • int32 chgPowerDC
  • int32 chgSunPower
  • int32 dcInUsedTime
  • int32 dsgPowerAC
  • int32 dsgPowerDC
  • int32 errCode
  • int32 invUsedTime
  • byte model
  • int32 mpptUsedTime
  • int32 remain_time
  • byte[5] reserved
  • byte soc
  • int32 sysVer
  • byte sys_chg_flag
  • int32 typecUsedTime
  • int32 usbUsedTime
  • int16 watts_in_sum
  • int16 watts_out_sum

Delta Heartbeat Package (extends Heartbeat Package)

  • byte beepMode
  • byte carState
  • byte carTemp
  • byte carWatts
  • byte dcOutState
  • byte iconRechgTimeMode
  • byte lcdBrightness
  • byte lcdOffSec
  • byte qcUsb1Watts
  • byte qcUsb2Watts
  • int32 reserved
  • int16 standbyMin
  • byte typec1Temp
  • byte typec1Watts
  • byte typec2Temp
  • byte typec2Watts
  • byte usb1Watts
  • byte usb2Watts
  • byte wifiAutoRcvy
  • int32 wifiVer

River Heartbeat Package (extends Heartbeat Package)

  • byte LedState
  • byte beepState
  • byte carSwitchState
  • byte carTemp
  • byte carWatts
  • byte ledWatts
  • int16 standbyMode
  • byte typecTemp
  • byte typecWatts
  • byte usb1Watts
  • byte usb2Watts
  • byte usb3Watts

River Mini Heartbeat Package (extends Heartbeat Package)

  • byte beepMode
  • byte carState
  • byte carTemp
  • byte carWatts
  • byte dcOutState
  • byte lcdBrightness
  • int16 lcdOffSec
  • byte qcUsb1Watts
  • byte qcUsb2Watts
  • byte[5] reserved
  • int16 standbyMin
  • byte typec1Temp
  • byte typec1Watts
  • byte typec2Temp
  • byte typec2Watts
  • byte usb1Watts
  • byte usb2Watts
  • byte wifiAutoRcvy
  • byte wifiRssi
  • int32 wifiVer
  • byte wirelessWatts

@ticpu
Copy link

ticpu commented May 18, 2022

There are a few methods around MQTT which suggests that it could be configured to push information to an MQTT server, maybe this is how they are getting the graphs in the mobile app for charge and discharge? Unless it is a typo for MPPT

I can confirm the mobile app when using v3 servers protocol connects to mqtts://mqtt.ecoflow.com:8883/app/device/property/<Your Serial Number> with the username/password combo of your device and subscribes to device's serial number topic.

Username is named as certificateAccount and password as certificatePassword in the application.

This is what the application gets:

MPTT status

{
  "id": ##########,
  "params": {
    "latestTimeStamp": 1652835724751,
    "mppt.carOutAmp": 0,
    "mppt.carOutVol": 0,
    "mppt.carOutWatts": 0,
    "mppt.carState": 0,
    "mppt.carTemp": 0,
    "mppt.cfgChgType": 0,
    "mppt.cfgDcChgCurrent": 8000,
    "mppt.chgPauseFlag": 0,
    "mppt.chgState": 0,
    "mppt.chgType": 0,
    "mppt.dc24vState": 1,
    "mppt.dc24vTemp": 24,
    "mppt.dcdc12vAmp": 0,
    "mppt.dcdc12vVol": 0,
    "mppt.dcdc12vWatts": 0,
    "mppt.faultCode": 0,
    "mppt.inAmp": 0,
    "mppt.inVol": 0,
    "mppt.inWatts": 0,
    "mppt.mpptTemp": 23,
    "mppt.outAmp": 1,
    "mppt.outVol": 494,
    "mppt.outWatts": 7,
    "mppt.reserved": [
      0
    ],
    "mppt.swVer": 50397200,
    "mppt.xt60ChgType": 0
  },
  "timestamp": 1652835724751,
  "version": "1.0"
}

Energy system status

{
  "id": ##########,
  "params": {
    "ems.bms0Online": 3,
    "ems.bms1Online": 0,
    "ems.bms2Online": 0,
    "ems.bmsModel": 1,
    "ems.bmsWarningState": 0,
    "ems.chgAmp": 1000,
    "ems.chgCmd": 1,
    "ems.chgRemainTime": 143999,
    "ems.chgState": 3,
    "ems.chgVol": 45000,
    "ems.dsgCmd": 1,
    "ems.dsgRemainTime": 8292,
    "ems.emsIsNormalFlag": 1,
    "ems.f32LcdShowSoc": 85.83515,
    "ems.fanLevel": 0,
    "ems.lcdShowSoc": 86,
    "ems.maxAvailableNum": 1,
    "ems.maxChargeSoc": 80,
    "ems.maxCloseOilEbSoc": 94,
    "ems.minDsgSoc": 8,
    "ems.minOpenOilEbSoc": 20,
    "ems.openBmsIdx": 1,
    "ems.openUpsFlag": 1,
    "ems.paraVolMax": 50726,
    "ems.paraVolMin": 49126,
    "latestTimeStamp": 1652835724715
  },
  "timestamp": 1652835724715,
  "version": "1.0"
}

BMS status

{
  "id": #########,
  "params": {
    "bmsMaster.amp": -337,
    "bmsMaster.bmsFault": 0,
    "bmsMaster.bqSysStatReg": 128,
    "bmsMaster.cellId": 2,
    "bmsMaster.cycles": 6,
    "bmsMaster.designCap": 80000,
    "bmsMaster.errCode": 0,
    "bmsMaster.f32ShowSoc": 85.83549,
    "bmsMaster.fullCap": 75998,
    "bmsMaster.inputWatts": 0,
    "bmsMaster.maxCellTemp": 25,
    "bmsMaster.maxCellVol": 3329,
    "bmsMaster.maxMosTemp": 25,
    "bmsMaster.minCellTemp": 25,
    "bmsMaster.minCellVol": 3323,
    "bmsMaster.minMosTemp": 25,
    "bmsMaster.num": 0,
    "bmsMaster.openBmsIdx": 1,
    "bmsMaster.outputWatts": 0,
    "bmsMaster.remainCap": 65233,
    "bmsMaster.remainTime": 0,
    "bmsMaster.soc": 86,
    "bmsMaster.soh": 0,
    "bmsMaster.sysVer": 16777298,
    "bmsMaster.tagChgAmp": 48000,
    "bmsMaster.temp": 25,
    "bmsMaster.type": 1,
    "bmsMaster.vol": 49921,
    "latestTimeStamp": 1652835724716
  },
  "timestamp": 1652835724716,
  "version": "1.0"
}

Power delivery status

{
  "id": ##########,
  "params": {
    "latestTimeStamp": 1652835724679,
    "pd.beepState": 1,
    "pd.carState": 0,
    "pd.carTemp": 0,
    "pd.carUsedTime": 86809,
    "pd.carWatts": 0,
    "pd.chgPowerAc": 359398,
    "pd.chgPowerDc": 4,
    "pd.chgSunPower": 1291,
    "pd.dcInUsedTime": 139,
    "pd.dcOutState": 1,
    "pd.dsgPowerAc": 342805,
    "pd.dsgPowerDc": 902,
    "pd.errCode": 0,
    "pd.ext3p8Port": 0,
    "pd.ext4p8Port": 0,
    "pd.extRj45Port": 0,
    "pd.iconAcFreqMode": 1,
    "pd.iconAcFreqState": 0,
    "pd.iconBmsErrMode": 0,
    "pd.iconBmsErrState": 0,
    "pd.iconBmsParallelMode": 0,
    "pd.iconBmsParallelState": 0,
    "pd.iconBtMode": 0,
    "pd.iconBtState": 0,
    "pd.iconCarMode": 1,
    "pd.iconCarState": 0,
    "pd.iconChgStationMode": 0,
    "pd.iconChgStationState": 0,
    "pd.iconCoGasMode": 0,
    "pd.iconCoGasState": 0,
    "pd.iconEcoMode": 0,
    "pd.iconEcoState": 0,
    "pd.iconFactoryMode": 0,
    "pd.iconFactoryState": 0,
    "pd.iconFanMode": 0,
    "pd.iconFanState": 0,
    "pd.iconGasGenMode": 0,
    "pd.iconGasGenState": 0,
    "pd.iconHiTempMode": 0,
    "pd.iconHiTempState": 0,
    "pd.iconInvParallelMode": 0,
    "pd.iconInvParallelState": 0,
    "pd.iconLowTempMode": 0,
    "pd.iconLowTempState": 0,
    "pd.iconOverloadMode": 0,
    "pd.iconOverloadState": 0,
    "pd.iconPackHeaterMode": 0,
    "pd.iconPackHeaterState": 0,
    "pd.iconRcMode": 0,
    "pd.iconRcState": 0,
    "pd.iconRechgTimeMode": 0,
    "pd.iconRechgTimeState": 0,
    "pd.iconSocUpsMode": 1,
    "pd.iconSocUpsState": 0,
    "pd.iconSolarBracketMode": 0,
    "pd.iconSolarBracketState": 0,
    "pd.iconSolarPanelMode": 0,
    "pd.iconSolarPanelState": 0,
    "pd.iconTransSwMode": 0,
    "pd.iconTransSwState": 0,
    "pd.iconTypecMode": 0,
    "pd.iconTypecState": 0,
    "pd.iconUsbMode": 0,
    "pd.iconUsbState": 0,
    "pd.iconWifiMode": 0,
    "pd.iconWifiState": 0,
    "pd.iconWindGenMode": 0,
    "pd.iconWindGenState": 0,
    "pd.iconWirelessChgMode": 0,
    "pd.iconWirelessChgState": 0,
    "pd.invUsedTime": 3760241,
    "pd.lcdBrightness": 141,
    "pd.lcdOffSec": 300,
    "pd.model": 1,
    "pd.mpptUsedTime": 3642,
    "pd.qcUsb1Watts": 0,
    "pd.qcUsb2Watts": 0,
    "pd.remainTime": 8292,
    "pd.soc": 86,
    "pd.standByMode": 120,
    "pd.sysChgDsgState": 1,
    "pd.sysVer": 16908346,
    "pd.typccUsedTime": 37720,
    "pd.typec1Temp": 24,
    "pd.typec1Watts": 0,
    "pd.typec2Temp": 25,
    "pd.typec2Watts": 0,
    "pd.usb1Watts": 0,
    "pd.usb2Watts": 0,
    "pd.usbUsedTime": 4687,
    "pd.usbqcUsedTime": 17151,
    "pd.wattsInSum": 312,
    "pd.wattsOutSum": 312,
    "pd.wifiAutoRcvy": 0,
    "pd.wifiRssi": 0,
    "pd.wifiVer": 774,
    "pd.wirelessWatts": 0
  },
  "timestamp": 1652835724679,
  "version": "1.0"
}

Inverter status

{
  "id": #################,
  "params": {
    "inv.acDipSwitch": 2,
    "inv.acInAmp": 0,
    "inv.acInFreq": 60,
    "inv.acInVol": 123183,
    "inv.acPassByAutoEn": 1,
    "inv.cfgAcEnabled": 1,
    "inv.cfgAcOutFreq": 2,
    "inv.cfgAcOutVoltage": 120000,
    "inv.cfgAcWorkMode": 0,
    "inv.cfgAcXboost": 0,
    "inv.cfgFastChgWatts": 0,
    "inv.cfgSlowChgWatts": 1800,
    "inv.cfgStandbyMin": 0,
    "inv.chargerType": 0,
    "inv.chgPauseFlag": 0,
    "inv.dcInAmp": 0,
    "inv.dcInTemp": 23,
    "inv.dcInVol": 0,
    "inv.dischargeType": 1,
    "inv.errCode": 0,
    "inv.fanState": 1,
    "inv.inputWatts": 337,
    "inv.invOutAmp": 2814,
    "inv.invOutFreq": 60,
    "inv.invOutVol": 122613,
    "inv.invType": 0,
    "inv.outTemp": 23,
    "inv.outputWatts": 337,
    "inv.sysVer": 33620289,
    "latestTimeStamp": 1652835724751
  },
  "timestamp": 1652835724751,
  "version": "1.0"
}

@mattwells
Copy link
Author

mattwells commented May 18, 2022

@ticpu That looks like it is everything and more than I had hope it would be, thank you for digging into that.

This is the first time I have played with MQTT and I'm trying to connect using MQTT Explorer and I can't see to configure it connect with the path /app/device/property/<Your Serial Number> is this the topic?

Edit: I have got to the point where I am just getting the error "Connection refused: Bad username or password". I have tried my account password, I'm guessing there is some meta data in the app after it has authenticated to give a new username and password to connect to MQTT?

Edit 2: I have managed to obtained the username/password, who knew android logs could be so helpful :) I have managed to connect to the Ecoflow MQTT server now but I don't see any topics. Unsure where I am going wrong atm.

Edit 3: Got it, MQTT topic names are case sensative and I had put the serial number in lower case, it needed to be upper case.

@mattwells
Copy link
Author

mattwells commented May 18, 2022

it looks as though the commands to turn on and off things like DC and AC are also done with MQTT based on what I am seeing in the logs:

Turning DC On:

mqtt:publishMqtt:{"from":"Android","id":"#########","moduleType":0,"operateType":"TCP","params":{"id":81,"enabled":1},"version":"1.0"}

Turning DC Off:

mqtt:publishMqtt:{"from":"Android","id":"#########","moduleType":0,"operateType":"TCP","params":{"id":81,"enabled":0},"version":"1.0"}

I am assuming here that ID 81 is DC I do think it is being published to a different topic though.

Here are the topics I can see in the logs:

  • /app/######//thing/property/get_reply
  • /app/######//thing/property/set_reply
  • /app/device/property/

The ###### is a 20 digit number, perhaps some kind of account ID?

@mattwells
Copy link
Author

I have successfuly got the data going into InfluxDB using fairly simple Telegraf config using MQTT Consumer and JSON v2:

[[outputs.influxdb_v2]]
  urls = ["http://localhost:8086"]

  ## API token for authentication.
  token = "<token>"

  organization = "<org>"
  bucket = "<bucket>"

[[inputs.mqtt_consumer]]
  servers = ["mqtts://mqtt.ecoflow.com:8883"]

  topics = [
    "/app/device/property/<serial number>",
  ]

  ## If unset, a random client ID will be generated.
  # client_id = ""

  ## Username and password to connect MQTT server.
  username = "<username>"
  password = "<password>"

  data_format = "json"

  [[inputs.file]]
    data_format = "json_v2"
    [[inputs.file.json_v2]]
        timestamp_path = "timestamp"
        timestamp_format = "unix"
        [[inputs.file.json_v2.object]]
            path = "params"

Only problem I have right now is that watts provided by the Delta Pro are have 1 decimal place effectively making the number of watts 10 times higher than it should be.

@mtb-ninja
Copy link

mtb-ninja commented May 20, 2022

This is the current login sequence to be able to get the mqtt certificateAccount and certificatePassword that is mentioned above:

  1. POST to https://api.ecoflow.com/auth/login with a body like:
{
  "os": "ios",
  "scene": "IOT_APP",
  "appVersion": "3.0.1",
  "osVersion": "15.4.1",
  "password": "<your ecoflow app password here base64 encoded>",
  "oauth": {
    "bundleId": "com.ef.EcoFlow"
  },
  "email": "<your ecoflow app user email here>",
  "userType": "ECOFLOW"
}

This returns a response with a token node that will be used as the bearer token in the next call.
2. GET https://api.ecoflow.com/iot-auth/app/certification - include an Authorization: Bearer <token> header on this call. The following headers are included with calls from the iOS app and may or may not be required to make this call work:

Authorization: Bearer <token>
version: 3.0.1
Accept: */*
Accept-Language: en-US;q=1
lang: en-us
User-Agent: EcoFlow/3.0.1 (iPad; iOS 15.4.1; Scale/2.00)
Connection: keep-alive
productId: 1000
Content-Type: application/json

This will return a response with a body like:

{
  "code": "0",
  "message": "Success",
  "data": {
    "url": "mqtt.ecoflow.com",
    "port": "8883",
    "protocol": "mqtts",
    "certificateAccount": "<mqtt user name>",
    "certificatePassword": "<mqtt password>"
  }
}

Would love to know if/when anyone has a working home assistant setup using this mqtt data.

@mattwells
Copy link
Author

mattwells commented May 20, 2022

That looks like a standard OAuth2 API login to me, nice and easy to integrate with :)

@mtb-ninja I would like to do a home assistant setup if I can, I'm not familar with it though and is why I am doing the InfluxDB so I at least get pretty graphs.

@franki29
Copy link

franki29 commented May 21, 2022

Hi , there is a implementation without mqtt by https://github.com/vwt12eh8/hassio-ecoflow for home assistant.

I have a delta mini and I like to use the heartbeat packages with node red. I already discovered that packages that begins with AA 02 6F. Byte 33 & 34 is the watt information from the solar panel and byte 30 seems to bet the actual % of the battery. Byte 31 & 32 the AC out usage. But I like to get more information out of the packages.

Can you tell me how did you find the information about the heartbeat packages?
Thx

@mattwells
Copy link
Author

mattwells commented May 22, 2022

@franki29 OOoh I had been looking for something like that with home assitant, I am definetly going to have to check that out.

As for the Heartbeat info I decompiled the APK (downloaded from the Ecoflow website) using http://www.javadecompilers.com/apk/ it is a little tricky to read as the decompile isn't great but it is enough to start picking out objects, I have not yet managed to find the part that actually reads the binary stream into the objects though.

@franki29
Copy link

Hi mattwells, thanks for the information.

I tried also with jadx, but as I am not familiar with coding, it did not help a lot.

I have to correct myself with the information regarding the Watt usage : Byte 33 & 34 is the watt input in total, no matter if I charge from AC or Solar panel. This is maybe only for the delta mini. I tried to figure out in the app how they are switching on/off the 12V DC and the AC output. No way to find it in the decompiled app for me.

But with the direct connection to the device and a network sniffer I could find the required sequence to send.

Here the buffer values that has to be send for the delta mini with node red:
["0xaa","0x02","0x01","0x00","0xa0","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x05","0x20","0x51","0x00","0xce","0xc2"] 12V DC Out off

["0xaa","0x02","0x01","0x00","0xa0","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x05","0x20","0x51","0x01","0x0f","0x02"] 12V DC out on

["0xaa","0x02","0x07","0x00","0xde","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x04","0x20","0x42","0x00","0xff","0xff","0xff","0xff","0xff","0xff","0x2e","0xe8"] AC out off

["0xaa","0x02","0x07","0x00","0xde","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x04","0x20","0x42","0x01","0xff","0xff","0xff","0xff","0xff","0xff","0x3e","0x28"] AC out on

Maybe you find a way to figure out the values for other commands looking into the app. I could find parts of it in the class com.ecoflow.common.command.DirectDeviceCommand
Br. Frank

@mattwells
Copy link
Author

No problem Frank, I'm really glad that you are finding it useful.

A few other things that I have noticed is that the MPPT side of things, despite the properties being called Watts, Amps and Volts are actually deciwatts, deciamps and centivolts, you have to devide them by 10 or 100 to actually have them in actual watts, amps and volts.

As a side note, I do enjoy seeing the MPPT Watts in and Watts out, you can see how effeciant the MPPT conversion is.

In regards to the BMS the cell voltage is actually in milivolts.

The PD time remain is in minutes, I haven't looked very hard but I haven't noticed anything explicitly saying weather it is charging or discharging but I would expect there is a boolean flag on one of the PD properties.

Tempuratures are all in celcious.

Inverter uses watts.

It must have been fun fixing all these values in the app rather than picking a standard...

@franki29
Copy link

Hi mattwells, thanks for the information. It look like I could detect also the MPPT packets.
But for my delta Mini it looks like Ampere has to divide by 100, the rest by 10.
Anyway, with the hints about the deciwatt I could detect the values, thank you very much.

In my case they are in the packets that starts with AA 02 42 starting at byte 24 with inVolt

Br. Frank

@KingKahn123
Copy link

This is the current login sequence to be able to get the mqtt certificateAccount and certificatePassword that is mentioned above:

  1. POST to https://api.ecoflow.com/auth/login with a body like:
{
  “os”: “ios”,
  “scene”: “IOT_APP”,
  “appVersion”: “3.0.1",
  “osVersion”: “15.4.1",
  “password”: “<your ecoflow app password here base64 encoded>“,
  “oauth”: {
    “bundleId”: “com.ef.EcoFlow”
  },
  “email”: “<your ecoflow app user email here>“,
  “userType”: “ECOFLOW”
}

This returns a response with a token node that will be used as the bearer token in the next call. 2. GET https://api.ecoflow.com/iot-auth/app/certification - include an Authorization: Bearer <token> header on this call. The following headers are included with calls from the iOS app and may or may not be required to make this call work:

Authorization: Bearer <token>
version: 3.0.1
Accept: */*
Accept-Language: en-US;q=1
lang: en-us
User-Agent: EcoFlow/3.0.1 (iPad; iOS 15.4.1; Scale/2.00)
Connection: keep-alive
productId: 1000
Content-Type: application/json

This will return a response with a body like:

{
  "code": "0",
  "message": "Success",
  "data": {
    "url": "mqtt.ecoflow.com",
    "port": "8883",
    "protocol": "mqtts",
    "certificateAccount": "<mqtt user name>",
    "certificatePassword": "<mqtt password>"
  }
}

Would love to know if/when anyone has a working home assistant setup using this mqtt data.

Hey,

is this still working? When I send a HTTP post to https://api.ecoflow.com/auth/login I get following error:

"code": "415",
"message": "Unsupported Media Type"

@mattwells
Copy link
Author

I personally never managed to get that endpoint to work myself. I grabbed my credentials from the Android logs while using the app.

@KingKahn123
Copy link

OK. It is now working as well. Under iOS it is a little bit problematic. But I got the credentials with the help of Charles.

https://www.heise.de/ratgeber/Schnueffel-Apps-finden-3986944.html?seite=5

Now I get all messages into my IPSymcon installation.

@KingKahn123
Copy link

@mattwells did you figure out how to send commands via mqtt or Is it not possible?

@mattwells
Copy link
Author

@mattwells did you figure out how to send commands via mqtt or Is it not possible?

Sorry I didn't really try it, I suspect that you can do so but by the time I was looking into doing that I had come across Ecoflow Hassio which did everything I wanted.

@Roughman007
Copy link

@mattwells Hi, what app did you use to find the logs from the app on android? I can't figure out how to get certificateAccount / certificatePassword. I'm trying to figure it out because my hassio-ecoflow stopped working(because of a firmware update) Thanks.

@mattwells
Copy link
Author

mattwells commented Sep 28, 2022

I didn't use an app (although there may be one), its something you do with ADB (Android Debug Bridge) a quick search for a guide brought up this page which looks like what I do https://yoodley.com/view-and-examine-android-logs/

@Roughman007
Copy link

Thanks. I will try it.

@KingKahn123
Copy link

@mattwells did you figure out how to send commands via mqtt or Is it not possible?

Sorry I didn't really try it, I suspect that you can do so but by the time I was looking into doing that I had come across Ecoflow Hassio which did everything I wanted.

Yes, I was thinking about this solution as well, but with new firmware ecoflow has closed port 8055 :-(

@mattwells
Copy link
Author

@mattwells did you figure out how to send commands via mqtt or Is it not possible?

Sorry I didn't really try it, I suspect that you can do so but by the time I was looking into doing that I had come across Ecoflow Hassio which did everything I wanted.

Yes, I was thinking about this solution as well, but with new firmware ecoflow has closed port 8055 :-(

I am aware but thankfully I didn't upgrade my firmware yet, but I really hope it can be sorted soon, now I have had a taste of HA with Ecoflow I don't want to give it up

@adiantek
Copy link

adiantek commented Oct 6, 2022

This is the current login sequence to be able to get the mqtt certificateAccount and certificatePassword that is mentioned above:

  1. POST to https://api.ecoflow.com/auth/login with a body like:
{
  “os”: “ios”,
  “scene”: “IOT_APP”,
  “appVersion”: “3.0.1",
  “osVersion”: “15.4.1",
  “password”: “<your ecoflow app password here base64 encoded>“,
  “oauth”: {
    “bundleId”: “com.ef.EcoFlow”
  },
  “email”: “<your ecoflow app user email here>“,
  “userType”: “ECOFLOW”
}

This returns a response with a token node that will be used as the bearer token in the next call. 2. GET https://api.ecoflow.com/iot-auth/app/certification - include an Authorization: Bearer <token> header on this call. The following headers are included with calls from the iOS app and may or may not be required to make this call work:

Authorization: Bearer <token>
version: 3.0.1
Accept: */*
Accept-Language: en-US;q=1
lang: en-us
User-Agent: EcoFlow/3.0.1 (iPad; iOS 15.4.1; Scale/2.00)
Connection: keep-alive
productId: 1000
Content-Type: application/json

This will return a response with a body like:

{
  "code": "0",
  "message": "Success",
  "data": {
    "url": "mqtt.ecoflow.com",
    "port": "8883",
    "protocol": "mqtts",
    "certificateAccount": "<mqtt user name>",
    "certificatePassword": "<mqtt password>"
  }
}

Would love to know if/when anyone has a working home assistant setup using this mqtt data.

Hey,

is this still working? When I send a HTTP post to https://api.ecoflow.com/auth/login I get following error:

"code": "415",
"message": "Unsupported Media Type"

You forgot about Content-Type: application/json header. If you get {"code":"1008","message":"Description Failed to resolve the request body"} it means JSON is malformed (@mtb-ninja posted JSON formatted by Word or some app and quotation marks are different).
" - correct quotation mark
” - incorrect

@adiantek
Copy link

What's odd about this is that I don't see an expiration or refresh token in the response to a successful auth.

Yep, it doesn't expire, I'm using it since one week and collecting all info to InfluxDB, then viewing in grafana. It's nice that I see voltage of solar panel and amps (app shows only Watts only if >=15W)

@mattwells
Copy link
Author

mattwells commented Oct 25, 2022

PreEdit: I replied and realised that I wasn't really answer the question being asked, I have limited time at the moment I would like to get back onto this project if I see questions I can answer I will try and make time for them. Need to get back to work now >.<

I've worked out how to configure a bridge connection from the Mosquitto broker which subscribes to the remote MQTT server and the same information that the Ecoflow MQTT server receives is now also available to me on my own MQTT server.

Love it, that is what I was trying to do but I couldn't quite work out how to do it as I hadn't played with MQTT before.

I've attempted to subscribe to the control topics that @mattwells mentioned just using MQTT Explorer - he mentioned a 20 digit number that could be an account ID or something. The $result response from the PowerShell script contains more than just the token and in that there is a $Result.data.user.userId which is a 19 digit code - so could be that. I did try to subscribe to /app/[userId]//thing/property/set_reply (note the two forward-slashes) but publishing anything to them didn't change anything on my Delta Pro.

It is the device's serial number, using capital letters, for the subscription. If you have multiple devices you have to subscribe to them individually:

image

The one you want to use to get information from the device is /app/device/property/SERIALNO1234

I haven't tried doing control over MQTT though so I am unsure how this would work.

I've done some poking around in Android debug logs but I've not seen any reference to the topics that @mattwells mentioned earlier in this thread. Matt, if you're still reading this thread, it'd be great if you could let us know where/how you came across the get_reply and set_reply topics.

I actually decompiled the Android app to find them. As for the serial number if you go into the app on your phone once you have it connected go to the device, clock the cog in the top right, then go to the Specifications menu open and it is at the top of the screen prefixed with SN:SERIALNO1234

@muddyland
Copy link

muddyland commented Oct 29, 2022

Thanks for putting this together! I recently picked up a Delta Max, had it integrated in HA for 1 day, updated the firmware and man do I regret that now. Anyway, after writing an angry email to Ecoflow about the local API, I managed to get this all working!

Here are the sensors I ended up creating:

mqtt:
  sensor:
    - name: "Delta Max ***NUMBER*** Battery (mqtt)"
      unique_id: "delta_max_***NUMBER***_battery_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      unit_of_measurement: "%"
      state_class: "measurement"
      value_template: >
        {% if value_json['params']['ems.lcdShowSoc'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_battery_mqtt') }}
        {% else %}
          {{ value_json['params']['ems.lcdShowSoc'] | int(0)}}
        {% endif %}

    - name: "Delta Max ***NUMBER*** AC Charge Speed (mqtt)"
      unique_id: "delta_max_***NUMBER***_ac_charge_speed_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "power"
      unit_of_measurement: "W"
      state_class: "measurement"
      value_template: >
        {% if value_json['params']['inv.cfgSlowChgWatts'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_ac_charge_speed_mqtt') }}
        {% else %}
          {{ value_json['params']['inv.cfgSlowChgWatts'] | int(0)}}
        {% endif %}

    - name: "Delta Max ***NUMBER*** AC Input (mqtt)"
      unique_id: "delta_max_***NUMBER***_ac_input_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "power"
      unit_of_measurement: "W"
      state_class: "measurement"
      value_template: >
        {% if value_json['params']['inv.inputWatts'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_ac_input_mqtt') }}
        {% else %}
          {{ value_json['params']['inv.inputWatts'] | int(0)}}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** Total Output (mqtt)"
      unique_id: "delta_max_***NUMBER***_total_output_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "power"
      unit_of_measurement: "W"
      state_class: "measurement"
      value_template: >
        {% if value_json['params']['pd.wattsOutSum'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_total_output_mqtt') }}
        {% else %}
          {{ value_json['params']['pd.wattsOutSum'] | int(0)}}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** Total Input (mqtt)"
      unique_id: "delta_max_***NUMBER***_total_input_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "power"
      unit_of_measurement: "W"
      state_class: "measurement"
      value_template: >
        {% if value_json['params']['pd.wattsInSum'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_total_input_mqtt') }}
        {% else %}
          {{ value_json['params']['pd.wattsInSum'] | int(0)}}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** Total Output Energy (mqtt)"
      unique_id: "delta_max_***NUMBER***_total_output_energy_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "energy"
      unit_of_measurement: "Wh"
      state_class: "total_increasing"
      value_template: >
        {% if value_json['params']['pd.dsgPowerAc'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_total_output_energy_mqtt') }}
        {% else %}
          {{ value_json['params']['pd.dsgPowerAc'] | int(0)}}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** Total Input Energy (mqtt)"
      unique_id: "delta_max_***NUMBER***_total_input_energy_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "energy"
      unit_of_measurement: "Wh"
      state_class: "total_increasing"
      value_template: >
        {% if value_json['params']['pd.chgPowerAc'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_total_input_energy_mqtt') }}
        {% else %}
          {{ (value_json['params']['pd.chgPowerAc'] | int(0)) + (value_json['params']['pd.chgPowerDc'] | int(0))}}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** Main Battery Cycles (mqtt)"
      unique_id: "delta_max_***NUMBER***_main_battery_cycles_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      state_class: "measurement"
      icon: mdi:battery-heart-variant
      value_template: >
        {% if value_json['params']['bmsMaster.cycles'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_main_battery_cycles_mqtt') }}
        {% else %}
          {{ value_json['params']['bmsMaster.cycles'] | int(0)}}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** MPPT Input Watts (mqtt)"
      unique_id: "delta_max_***NUMBER***_input_mppt_watts_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "power"
      unit_of_measurement: "W"
      state_class: "measurement"
      value_template: >
        {% if value_json['params']['mppt.inWatts'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_input_mppt_watts_mqtt') }}
        {% else %}
          {{ value_json['params']['mppt.inWatts'] | int(0) / 10 }}
        {% endif %}

    - name: "DELTA Max ***NUMBER*** MPPT Input Energy (mqtt)"
      unique_id: "delta_max_***NUMBER***_mppt_input_energy_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      device_class: "energy"
      unit_of_measurement: "Wh"
      state_class: "total_increasing"
      value_template: >
        {% if value_json['params']['pd.chgSunPower'] | int(-1) == -1 %}
          {{ states('delta_max_***NUMBER***_mppt_input_energy_mqtt') }}
        {% else %}
          {{ value_json['params']['pd.chgSunPower'] | int(0)}}
        {% endif %}
  binary_sensor:
    - name: "Delta Max ***NUMBER*** Charging (mqtt)"
      unique_id: "delta_max_***NUMBER***_charging_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      payload_on: "1"
      payload_off: "0"
      value_template: >
        {{ value_json['params']['inv.chargerType'] | default(0, true) | int(0) }}
    - name: "Delta Max ***NUMBER*** Fan (mqtt)"
      unique_id: "delta_max_***NUMBER***_fan_mqtt"
      state_topic: "ecoflow/***NUMBER***"
      payload_on: "1"
      payload_off: "0"
      value_template: >
        {{ value_json['params']['inv.fanState'] | default(0, true) | int(0) }}

I wanted to put my solar back into the Energy dashboard so I made 2 sensors for MPPT input and input energy. I also added a binary sensor for the fan as I may want to use this to turn on an external fan. I also made a change to the input energy sensor so that it adds AC and DC input energy fields together.

Anyways, it all seems to be working but I am hoping the local API comes back soon. I hate depending on the cloud :/

@lwsrbrts
Copy link

lwsrbrts commented Nov 6, 2022

I've removed a few comments I've made on this thread in line with some others who have done the same. As a result, you'll see quotes from comments that don't appear to be sourced from any comment in this thread.

We all hope to put the information back here sooner rather than later as we realise people are looking for a solution after updating their firmware.

@v1ckxy
Copy link
Owner

v1ckxy commented Nov 6, 2022

@lambro690 local api support was disabled even on offline mode?

Or offline mode is still working?

I still have the unit, but I'm sorry I almost hadn't had time since created this github 😪😩

@Hardy62wo
Copy link

Hardy62wo commented May 31, 2023 via email

@Ne0-Hack3r
Copy link

Does anyone else have a problem again with ecoflow mqtt (bridge)???

Around 1.5-2 days ago mine stopped working but it was only for 4-5 hours... today it stopped working permanently (at least for the past 9-10 hours it is consistent and I see no messages whatsoever) ..

I have also verified that I can connect to the mqtt server (I think the url changed from mqtt.ecoflow.com to mqtt-e.ecoflow.com) but I see nothing on my subscribed topic (/app/device/property/SERIALNO).

Any ideas?

P.S. I forgot to mention that the mobile app is also not working.

Servers were down for most of a day. I assume your stuff is working again at this point, yes?

@nodkan
Copy link

nodkan commented Jun 17, 2023

Hi there,

thanks both @hardy and @neo .. indeed I contacted ecoflow support and they said where doing some maintenance/upgrades.

So the above was a false alarm.

The thing is I have a different kind of problem now that I would like to ask you about .

My bridge at some point (feels like its every 15-20 minutes) stops receiving updates from the topic and it only works again if/when I "open" the mobile app. It looks as if it gets stuck or sleeps and when a topic pub reaches the mqtt server it wakes again.

Any ideas? Anyone else with the same issue?

BR,
Nodas

@lwsrbrts
Copy link

Hi there,

thanks both @hardy and @neo .. indeed I contacted ecoflow support and they said where doing some maintenance/upgrades.

So the above was a false alarm.

The thing is I have a different kind of problem now that I would like to ask you about .

My bridge at some point (feels like its every 15-20 minutes) stops receiving updates from the topic and it only works again if/when I "open" the mobile app. It looks as if it gets stuck or sleeps and when a topic pub reaches the mqtt server it wakes again.

Any ideas? Anyone else with the same issue?

BR, Nodas

I have started having the same problem - starting on or about 18th June.

I added these two configuration lines to my mosquitto.conf which seemed to improve the bridge's connection longevity but it still fails within minutes if I open the phone app.

# Fix disconnects?
start_type automatic
restart_timeout 10 120

After adding the above, if I restart the Mosquitto add-on in HA but do not open then app on my phone, the bridge connection continues to work for ~10 hours before it times out and disconnects. Restart Mosquitto and I get the same again.

If I restart Mosquitto, the connection works as above, but if I then open the app on my phone and then close it or let my phone go to sleep, the bridge connection stops receiving updates within a minute or so.

A little disappointing this has started to happen.

@nodkan
Copy link

nodkan commented Jun 22, 2023

Hi lwsbrts,

in your case I would schedule a mosquitto restart to happen every 5-10 hours.

Unfortunately what I experience is not the same. Mine receives updates when the app is active and when it's not it stops after a few minutes.

So far I tried scheduling a mosquitto restart every 1 minute which makes it a bit better. When the bridge comes up it receives messages for around 50" .. so it's not that bad. I also tried scheduling a mosquitto_pub to check the senario that if something gets published in the TOPIC the bridge would get "unstuck"... unfortunately that doesn't seem to make things any better.

Looking forward to hearing from the rest of the group.

BR,
Nodas

@Ne0-Hack3r
Copy link

Not seeing this behavior though I did notice strange DNS issues a couple days ago related to ecoflow.com... But I've not been losing connection and during the DNS issues only new connections appeared to be effected. However, I do tend to leave the app open to SHP and DPs on Android emulators a good portion of time...

@lwsrbrts
Copy link

By all accounts, others are having the same issue with disconnects as I've described above. Another integration author has implemented disconnect logic recently to reconnect to account for this new issue. That integration: https://github.com/tolwi/hassio-ecoflow-cloud

If I don't open the app, the bridge connection via Mosquitto works fine.

@Lyve1981
Copy link

Lyve1981 commented Aug 29, 2023

If I don't open the app, the bridge connection via Mosquitto works fine.

This might make sense as in MQTT the client id is supposed to be unique, i.e. when the same client id connects twice, the old connection is force-closed. Did you copy the ID from the app or did you generate a random UUID?

@aflusche
Copy link

I started having the disconnect problem yesterday (8/28/23) and came looking for help.

I added @lwsrbrts's mosquitto.conf code addition just now and restarted the MQTT add-on. So far, so good. But it's only been a few minutes. :)

If the answer is to remember to restart MQTT if you have to use the Ecoflow app, I can live with that.

@lwsrbrts
Copy link

If I don't open the app, the bridge connection via Mosquitto works fine.

This might make sense as in MQTT the client id is supposed to be unique, i.e. when the same client id connects twice, the old connection is force-closed. Did you copy the ID from the app or did you generate a random UUID?

In fact I wrote a PowerShell script that would do exactly that :) vwt12eh8/hassio-ecoflow#26 (comment)

@lwsrbrts
Copy link

If the answer is to remember to restart MQTT if you have to use the Ecoflow app, I can live with that.

I still occasionally need to open the Ecoflow app but having realised that I was doing it and then having to force close Ecoflow, wait a minute or so and then faff with Home Assistant to restart the MQTT addon, I decided to create an automation.

It waits until the sensor.shp_circuit_1_power sensor doesn't get updated for 5 minutes and sends me a notification with an action attached which I can choose to press or not. When pressed, the event restarts MQTT...this could of course be simplified and remove the notification action to just restart MQTT.

alias: Smart Home Panel not updating notification
description: ""
trigger:
  - platform: template
    value_template: >-
      {{ now() - states.sensor.shp_circuit_1_power.last_changed >= timedelta
      (minutes=5) }}
    id: power_info_stale
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: restart_mqtt_addon
    context: {}
    id: restart_mobile_notification
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - power_info_stale
        sequence:
          - service: notify.mobile_app_pixel_6_pro
            data:
              message: Power information for Smart Home Panel circuits is stale.
              title: "WARN: Stale power data"
              data:
                color: "#800000"
                sticky: true
                tag: shp-stale-data
                notification_icon: mdi:transmission-tower-off
                actions:
                  - action: restart_mqtt_addon
                    title: Restart MQTT Addon
      - conditions:
          - condition: trigger
            id:
              - restart_mobile_notification
        sequence:
          - service: hassio.addon_restart
            data:
              addon: core_mosquitto
mode: single

@Ne0-Hack3r
Copy link

@lwsrbrts I regularly open the app and occasionally a separate MQTT Explorer session to mqtt.ecoflow.com and, thus far, have not see this issue. I do use totally unique random client IDs for each instance (app vs mosquito vs MQTT Explorer) prepended with 'ANDROID_'

I assume you are using unique client IDs on everything as well and have tried generating new GUIDs for UUID, etc? Hoping I continue to stay immune to this issue but also curious if something in my setup has created this 'immunity'. Would certainly be nice if we could get everyone 'inoculated'.

@jkdat
Copy link

jkdat commented Sep 3, 2023

Did someone already tried the MQTT interface on a PowerStream inverter device?
I just did it and the MQTT topics seem the same but the content looks like a compressed or binary format:
4 ���"��5 (@HP X���HW<rest of SERIAL NUMBER>
this is the output of the topic: /app/device/property/HW

hexdump looks the following (edited S/N):

00000080 0A 3D 0A 03 08 D8 04 10 20 18 35 20 01 28 01 38 .=...... .5 .(.8
00000090 03 40 14 48 81 01 50 03 58 01 70 82 BC F2 CE 05 .@.H..P.X.p.....
000000A0 80 01 13 88 01 01 BA 01 03 69 6F 73 CA 01 10 48 .........ios...H
000000B0 57 35 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 0A W5ABCDEFGHIJKLM.

I'm going to check if it is just a compressed json or something simmiliar.

As the app must also understand it, it might be possible to get it out of the android app.

@Ne0-Hack3r
Copy link

Hi lwsbrts,

in your case I would schedule a mosquitto restart to happen every 5-10 hours.

Unfortunately what I experience is not the same. Mine receives updates when the app is active and when it's not it stops after a few minutes.

So far I tried scheduling a mosquitto restart every 1 minute which makes it a bit better. When the bridge comes up it receives messages for around 50" .. so it's not that bad. I also tried scheduling a mosquitto_pub to check the senario that if something gets published in the TOPIC the bridge would get "unstuck"... unfortunately that doesn't seem to make things any better.

Looking forward to hearing from the rest of the group.

BR, Nodas

@nodkan

I appear to be experiencing something like this now. I've had a couple cases of MQTT going silent. I just now opened the app and data flow resumed (did not reboot or reconnect Mosquito). Soon after closing the app the data flow stopped again. Restarted Mosquito at that point and data updates are back and seem to be solid again. This is the 2nd time I've seen updates cease in the past couple weeks. Not sure if connection is going stale, server is imposing some sort of timeout, or something else is going on...

I sure wish we better understood the nature of "what changed" since I don't think any of us had these issues when we first started tapping into mqtt.ecoflow.com

@Ne0-Hack3r
Copy link

@lwsrbrts

I've been looking more into this now very annoying issue. When updates cease on my dashboard and I then connect to my local broker (Mosquito) via MQTT Explorer I can see that nothing new is appearing on my side of the bridge. If I leave that connection open and then connect a second instance of MQTT Explorer to mqtt.ecoflow.com (using a different client ID than what Mosquito is using of course) data starts posting to the monitored topics on both sides. If I then close the mqtt.ecoflow.com connection data ceases (same if you open the app and then close it). I'm not sure what is triggering this or if there has been a change on the server side but I'm wondering if in fact something changed with Mosquito...

... Any chance an update to Mosquito was installed prior to this problem cropping up? I have done some updates to Mosquito recently which have not helped but I'm not sure exactly when the problem started on my end. When you first mentioned it I was not experiencing it at all then more recently I am experiencing it. Now I'm wondering if you simply updated Mosquito a few weeks before I did...

@Skydev0h
Copy link

I have dealt with this issue by setting a relatively short silence timeout, if there is no new data for about 10s then the client reconnects to MQTT and everything works OK. Since my Prometheus collection interval is 30s the reconnects are not visible and are not affecting the graph at all. Upon reconnection the client requests all data from the devices so no updates are lost.

@lwsrbrts
Copy link

@Ne0-Hack3r

When it started happening to me, I hadn't made any changes to Mosquitto in HA OS at all. I have since, like you, updated Mosquitto a couple of times when offered the update via HA OS but that hasn't made any change to how the connection is behaving.

I see exactly the same as you:

  • A single bridge connection from Mosquitto (in HA) works fine and continuously.
  • If I open the Ecoflow app, data continues to flow to both the Mosquitto bridge connection for HA OS and the Ecoflow app, while the app is open.
  • If I close the app by swiping it away (Android), data stops to Mosquitto in HA almost instantly and won't recover without restarting Mosquitto.
  • Similarly, if the screen goes off due to inactivity on the phone or I just go to a different app, after a few minutes, the bridge connection stops receiving data, presumably because the app is put to sleep by Android.
  • If I open the app again, data will flow to the app and Mosquitto again.

My automation above sorts out the resolution for me now but before that I would swipe the app away, wait 30 seconds and then restart Mosquitto in HA to reconnect the bridge.

This is the top section of my current mosquitto.conf

connection ecoflow-bridge
address mqtt.ecoflow.com:8883
remote_username [removed]
remote_password [removed]
cleansession true
remote_clientid [removed]
try_private true

# Fix disconnects?
start_type automatic
restart_timeout 30 180
persistence true

bridge_insecure false
bridge_protocol_version mqttv311
bridge_tls_version tlsv1.2
bridge_cafile /etc/ssl/certs/ca-certificates.crt

[removed]

The disconnects section I added while troubleshooting, but it doesn't kick the connection back in to life per my testing. Since it wasn't hurting, I just left it there.

@Ne0-Hack3r
Copy link

@lwsrbrts

I tried similar things in mosquito.conf and I also setup an automation that posts a request for ‘latestquotas’ to ../get every 30 seconds. When this condition occurs the connection from Mosquito to cloud server stays in tact and I see responses on ../getreply — I can also post commands to ../set but nothing seems to trigger status data to start posting again short of restarting Mosquito.

I suppose this would tend to point the finger at changes on the cloud server. I just find it odd that I noticed no issues until quite recently while you and others noticed it much earlier. The question of “what changed” continues to plague me.

@SilverSurfer2000
Copy link

SilverSurfer2000 commented Oct 12, 2023

Ich lade die Ecoflow Delta 2 abhängig vom aktuellen Solarüberschuß im Haus über den A/C Eingang. Der AC-Eingang wird entweder über einen Shelly ganz abgeschaltet (< 200W) oder die Ladeleistung je nach Höhe des Überschusses per MQTT: acChgCfg und chgWatts geregelt.

Ich habe die Befürchtung, daß zu viele An-/Abschaltungen des AC-Eingangs durch den Shelly evtl. schädlich für den AC-Eingang der Ecoflow sind und würde gerne die AC-Ladung über chgPauseFlag schalten.

Bei der Änderung der Ladeleistung in der App wird neben acChgCfg und chgWatts jedesmal auch chgPauseFlag : 255 gesendet.

Eine manuelle Änderung von chgPauseFlag über MQTT (z.B: auf 0) hat aber leider keinen Effekt und die Ecoflow lädt munter weiter über AC.

Hat das Pausieren des Ladevorgangs über chgPauseFlag schon jemand hinbekommen?

@jegres1709
Copy link

jegres1709 commented Oct 12, 2023

you could try my NodeRed flow. It might help you, how I handle this. it´s not perfect yet, but functional ;)

Details

[{"id":"72f8ed8f4e4b62d7","type":"tab","label":"hassio-ecoflow-cloud","disabled":false,"info":"","env":[]},{"id":"65a5060c994986f4","type":"inject","z":"72f8ed8f4e4b62d7","name":"Inject 2s","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"4","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":100,"y":100,"wires":[["b0a85144eb64d5ae"]]},{"id":"a47975111ee12c5e","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Gesamtleistung Power >= 60W","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"60","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1730,"y":180,"wires":[["11cef522cf627db3","8841ad05f6dd5dcb","6f6a788e83ebd060","4c8ab679d743828c"],["92ad901234dedc12","4a9f1d58ec2a2b74","5c9e1d867b5ed4af"]]},{"id":"92ad901234dedc12","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Gesamtleistung Power is not 0","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2430,"y":80,"wires":[["2d1cb9d923d7088c"],[]]},{"id":"2d1cb9d923d7088c","type":"change","z":"72f8ed8f4e4b62d7","name":"","rules":[{"t":"set","p":"var1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2700,"y":80,"wires":[["f75cd9514979a984"]]},{"id":"f75cd9514979a984","type":"change","z":"72f8ed8f4e4b62d7","name":"sum1","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var2') - $flowContext('var1') - $flowContext('var3') - 10","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":2890,"y":140,"wires":[["6e2f466048bda5e0"]]},{"id":"817be9f83369ede2","type":"change","z":"72f8ed8f4e4b62d7","name":"","rules":[{"t":"set","p":"var2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2700,"y":140,"wires":[["f75cd9514979a984"]]},{"id":"6e2f466048bda5e0","type":"switch","z":"72f8ed8f4e4b62d7","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"50","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":3060,"y":140,"wires":[["837f28cd5c830935","fb2ae28b20e8cec2"]]},{"id":"8e9f5adaa496fa65","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Gesamtleistung Power <= -10W","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"-10","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1730,"y":100,"wires":[["ccf86d233ef4f1d1"],[]]},{"id":"22a8be686e1f8f24","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Solar über 80W?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"80","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.solar_power_gesamt","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1270,"y":100,"wires":[["8e9f5adaa496fa65","a47975111ee12c5e"],["14d90f8b233b717b"]]},{"id":"7428b852d57bc895","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Gesamtleistung Power >= 1W","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"1","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2350,"y":420,"wires":[["79f1317fe8d08624","11cef522cf627db3","8841ad05f6dd5dcb"],[]]},{"id":"ccf86d233ef4f1d1","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2060,"y":20,"wires":[["92ad901234dedc12","4a9f1d58ec2a2b74","5c9e1d867b5ed4af"],["2010e4c4a0f69ef2"]]},{"id":"2010e4c4a0f69ef2","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Steckdose einschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2060,"y":100,"wires":[["ccf86d233ef4f1d1"]]},{"id":"05c01f1b24710cdb","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Steckdose ausschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3970,"y":580,"wires":[[]]},{"id":"09ed23b48bd26ebb","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":3700,"y":580,"wires":[["05c01f1b24710cdb"],[]]},{"id":"79f1317fe8d08624","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Akkustand GESAMT über 20%?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"20.1","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.r331zeb4zeal0791_battery_level","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2660,"y":500,"wires":[["f6398b26698070ba"],["5ca254f4b768768f"]],"icon":"font-awesome/fa-battery-1"},{"id":"831c98b43c060b3f","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Steckdose einschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3960,"y":500,"wires":[[]]},{"id":"17d8417da10c3e49","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":3700,"y":500,"wires":[[],["831c98b43c060b3f"]],"icon":"node-red-contrib-home-assistant-websocket/ha-entity-switch.svg"},{"id":"15f8b22d692d2631","type":"change","z":"72f8ed8f4e4b62d7","name":"","rules":[{"t":"set","p":"var3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2700,"y":200,"wires":[["f75cd9514979a984"]]},{"id":"3ae0e297906a5d51","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"local_D2 DC Out an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.r331zeb4zeal0791_dc_12v_enabled","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1210,"y":420,"wires":[["1413229ab158e8c6"],["f0a697ba9d84d4c5"]]},{"id":"f0a697ba9d84d4c5","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"local_D2 USB Out an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.r331zeb4zeal0791_usb_enabled","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1210,"y":480,"wires":[["cad3f172b5befa00"],["09ed23b48bd26ebb"]]},{"id":"14d90f8b233b717b","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"local_D2 AC Out an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.r331zeb4zeal0791_ac_enabled","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1210,"y":340,"wires":[["b36a293cdbf7baa2"],["3ae0e297906a5d51"]]},{"id":"11cef522cf627db3","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Charge Limit auf 20% ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"20","halt_if_type":"num","halt_if_compare":"is","entity_id":"number.r331zeb4zeal0791_max_charge_level","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2640,"y":340,"wires":[[],["7087be14c39e1335"]]},{"id":"8841ad05f6dd5dcb","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Charge Input auf 120W ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"is","entity_id":"number.r331zeb4zeal0791_ac_charging_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2640,"y":400,"wires":[[],["a5b3ee7d25d83fd5"]]},{"id":"4a9f1d58ec2a2b74","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"local_D2 Power Import not 1","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"1","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.r331zeb4zeal0791_ac_in_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2420,"y":140,"wires":[["817be9f83369ede2"],[]]},{"id":"5c9e1d867b5ed4af","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"local_D2 Power Export not 1","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"1","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.local_d2_power_export_gesamt_2","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2420,"y":200,"wires":[["15f8b22d692d2631"],[]]},{"id":"f19cbec5c9123602","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":".local_d2_power_export_ac for 15min 0W ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.r331zeb4zeal0791_ac_out_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"15","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1760,"y":340,"wires":[["36af96432e4318a2"],["7428b852d57bc895"]]},{"id":"36af96432e4318a2","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"D2 AC off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.r331zeb4zeal0791_ac_enabled"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2100,"y":340,"wires":[["7428b852d57bc895"]]},{"id":"50c5d08829a6baa0","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":".local_d2_power_export_dc for 15min 0W ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.r331zeb4zeal0791_dc_out_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"15","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1760,"y":420,"wires":[["55c03861965d274a"],["7428b852d57bc895"]]},{"id":"55c03861965d274a","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"D2 DC off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.r331zeb4zeal0791_dc_12v_enabled"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2100,"y":420,"wires":[["7428b852d57bc895"]]},{"id":"1c3e66a03bd84e2f","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":".local_d2_power_export_USB C for 15min 0W ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.r331zeb4zeal0791_type_c_1_out_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"15","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1770,"y":480,"wires":[["6d6649395cebd1d5"],["7428b852d57bc895"]]},{"id":"b3d947c9c42cb452","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"D2 USB off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.r331zeb4zeal0791_usb_enabled"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2110,"y":500,"wires":[["7428b852d57bc895"]]},{"id":"6d6649395cebd1d5","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":".local_d2_power_export_USB3 for 15min 0W ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.r331zeb4zeal0791_usb_1_out_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"15","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1760,"y":540,"wires":[["b3d947c9c42cb452"],["7428b852d57bc895"]]},{"id":"cad3f172b5befa00","type":"delay","z":"72f8ed8f4e4b62d7","name":"","pauseType":"delay","timeout":"1700","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1470,"y":500,"wires":[["1c3e66a03bd84e2f"]]},{"id":"b36a293cdbf7baa2","type":"delay","z":"72f8ed8f4e4b62d7","name":"","pauseType":"delay","timeout":"1700","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1470,"y":340,"wires":[["f19cbec5c9123602"]]},{"id":"1413229ab158e8c6","type":"delay","z":"72f8ed8f4e4b62d7","name":"","pauseType":"delay","timeout":"1700","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1470,"y":420,"wires":[["50c5d08829a6baa0"]]},{"id":"f6398b26698070ba","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Akkustand MAIN über 20%?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"20.1","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.r331zeb4zeal0791_main_battery_level","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":2940,"y":480,"wires":[["e2db39612113e2ec"],["5ca254f4b768768f"]],"icon":"font-awesome/fa-battery-1"},{"id":"b0a85144eb64d5ae","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"false","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.ecoflow_einschalten","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":390,"y":100,"wires":[["22a8be686e1f8f24"],["b6aaf9ede691d7aa"]]},{"id":"373b5bcf19395cb2","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Steckdose einschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":160,"y":300,"wires":[["5b9389b2fcf91c13"]]},{"id":"b6aaf9ede691d7aa","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":160,"y":220,"wires":[["5b9389b2fcf91c13"],["373b5bcf19395cb2"]],"icon":"node-red-contrib-home-assistant-websocket/ha-entity-switch.svg"},{"id":"a07ded28dfae920f","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"input_boolean.ecoflow_einschalten off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.ecoflow_einschalten"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":850,"y":220,"wires":[["22a8be686e1f8f24"]]},{"id":"5b9389b2fcf91c13","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"input_boolean.ecoflow_einschalten 6s on ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.ecoflow_einschalten","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"6","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":470,"y":220,"wires":[["a07ded28dfae920f"],[]]},{"id":"e2db39612113e2ec","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Akkustand SLAVE über 20%?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"20.1","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.r331zeb4zeal0791_slave_battery_level","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":3290,"y":440,"wires":[["09ed23b48bd26ebb"],["5ca254f4b768768f"]],"icon":"font-awesome/fa-battery-1"},{"id":"df97296f356d84dd","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"input_boolean.hoher_verbrauch off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.hoher_verbrauch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3400,"y":760,"wires":[["79f1317fe8d08624"]]},{"id":"30107a540587c820","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"input_boolean.hoher_verbrauch 1min on ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"input_boolean.hoher_verbrauch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"2","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":3060,"y":760,"wires":[["df97296f356d84dd"],[]]},{"id":"6f6a788e83ebd060","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"Gesamtleistung Power is not 0","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1810,"y":700,"wires":[["21603d7d9301f0d4"],[]]},{"id":"21603d7d9301f0d4","type":"change","z":"72f8ed8f4e4b62d7","name":"","rules":[{"t":"set","p":"var1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2080,"y":700,"wires":[["3c5dd79d11d70c66"]]},{"id":"3c5dd79d11d70c66","type":"change","z":"72f8ed8f4e4b62d7","name":"sum1","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var1') - $flowContext('var2')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":2270,"y":760,"wires":[["6773939bb75450f4","e14e659083e52a9f"]]},{"id":"6dc524c0f6f7e4d2","type":"change","z":"72f8ed8f4e4b62d7","name":"","rules":[{"t":"set","p":"var2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2080,"y":760,"wires":[["3c5dd79d11d70c66"]]},{"id":"6773939bb75450f4","type":"switch","z":"72f8ed8f4e4b62d7","name":">100","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":2430,"y":760,"wires":[["ac40fe12bcd227cd"]]},{"id":"4c8ab679d743828c","type":"api-current-state","z":"72f8ed8f4e4b62d7","name":"local_D2 Power Import not 1","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"1","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.r331zeb4zeal0791_ac_in_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1810,"y":760,"wires":[["6dc524c0f6f7e4d2"],[]]},{"id":"ac40fe12bcd227cd","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"input_boolean.hoher_verbrauch on","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.hoher_verbrauch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2700,"y":760,"wires":[["30107a540587c820"]]},{"id":"837f28cd5c830935","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Charge Input auf Überschuss setzen","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.r331zeb4zeal0791_ac_charging_power"],"data":" { \"value\": payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3310,"y":160,"wires":[[]]},{"id":"7087be14c39e1335","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Charge Limit auf 20% setzen","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.r331zeb4zeal0791_max_charge_level"],"data":"{\"value\":20}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2940,"y":340,"wires":[[]]},{"id":"a5b3ee7d25d83fd5","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Charge Input auf 120W setzen","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.r331zeb4zeal0791_ac_charging_power"],"data":"{\"value\":10}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2950,"y":400,"wires":[[]]},{"id":"fb2ae28b20e8cec2","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"Charge Limit auf 100% setzen","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.r331zeb4zeal0791_max_charge_level"],"data":"{\"value\":100}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3290,"y":100,"wires":[[]]},{"id":"5ca254f4b768768f","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"D2 DC off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.r331zeb4zeal0791_dc_12v_enabled"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3380,"y":500,"wires":[["17d8417da10c3e49"]]},{"id":"e14e659083e52a9f","type":"switch","z":"72f8ed8f4e4b62d7","name":"<100","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":2430,"y":840,"wires":[["f4d52c4aed0dc226"]]},{"id":"f4d52c4aed0dc226","type":"api-call-service","z":"72f8ed8f4e4b62d7","name":"input_boolean.hoher_verbrauch off","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.hoher_verbrauch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2700,"y":840,"wires":[[]]},{"id":"4b1912ab.49dcdc","type":"server","name":"Home Assistant","addon":true}]

but in general you need to change the charge limit (max_charge_level) to a value under your actual SoC and ac_charging_power to 100 ( it will charge with 120W) to pass throught from the grid. if the SoC is below max_charge_level to reach the level again.

@SilverSurfer2000
Copy link

Thank you! I'll give it a try at the weekend. Which package are the nodes 'api-current-state' and 'api-call-service' from. I guess one of the Home Assistant pallettes?

@jegres1709
Copy link

jegres1709 commented Oct 13, 2023

yes, it´s "node-red-contrib-home-assistant-websocket"
If you have any suggestions to optimize this automation, feel free to share your opinion :)

@SilverSurfer2000
Copy link

Your flow is pretty much exactly, what I need for the Ecoflow charging cycle.

Especially the 'current state' node with the possibility to determine a time frame for a value to be consistently under/over a certain threshold is awesome.

However, I do not run a HomeAssistant server - is there somewhere a similar node for mqtt input?

@jegres1709
Copy link

jegres1709 commented Oct 15, 2023

Yes, there are mqtt in and mqtt out nodes in the network section. So you should be able to adjust it.

Here is my previous version with setting charge limit with mqtt. So maybe it will inspire you.

Details

[{"id":"32ba8bd3cfc5ea84","type":"tab","label":"Solar - EcoFlow","disabled":true,"info":"","env":[]},{"id":"1184b811a8d7179c","type":"inject","z":"32ba8bd3cfc5ea84","name":"Inject 4s","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"4","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":110,"y":100,"wires":[["2cad73f4899d30d0"]]},{"id":"27723804bd2b2686","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Gesamtleistung Power >= 60W","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"60","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":670,"y":200,"wires":[["ae537381567acc7f","bec9f9507627fdd0"],["1ef105c518524c98","3eee0952c7f359c5","d2489bdd51b362b7"]]},{"id":"1ef105c518524c98","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Gesamtleistung Power is not 0","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1370,"y":80,"wires":[["dfc86bc6658a3520"],[]]},{"id":"3eee0952c7f359c5","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"D2 Power Import not 1","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"1","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.d2_power_import","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1340,"y":140,"wires":[["a8d62d2a574eede9"],[]]},{"id":"dfc86bc6658a3520","type":"change","z":"32ba8bd3cfc5ea84","name":"","rules":[{"t":"set","p":"var1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1640,"y":80,"wires":[["74b3790314d3f28a"]]},{"id":"74b3790314d3f28a","type":"change","z":"32ba8bd3cfc5ea84","name":"sum","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var2') - $flowContext('var1') - $flowContext('var3') - 12","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1830,"y":140,"wires":[["96f69409948d8491"]]},{"id":"a8d62d2a574eede9","type":"change","z":"32ba8bd3cfc5ea84","name":"","rules":[{"t":"set","p":"var2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1640,"y":140,"wires":[["74b3790314d3f28a"]]},{"id":"705d1cfea3acc688","type":"api-call-service","z":"32ba8bd3cfc5ea84","name":"Charge Input auf Überschuss setzen","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"input_number","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_number.d2_charge_input"],"data":" { \"value\": \"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2290,"y":260,"wires":[[]]},{"id":"96f69409948d8491","type":"switch","z":"32ba8bd3cfc5ea84","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"50","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":2000,"y":140,"wires":[["705d1cfea3acc688","02460640bfcc06bc","ce0e7bbb01e46bf9","b05f326b9ec4a5da"]]},{"id":"9a939dfa189b7b4f","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Gesamtleistung Power <= -10W","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"-10","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":670,"y":100,"wires":[["c10d26d913731bb4"],[]]},{"id":"2cad73f4899d30d0","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Solar über 80W?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"80","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.shelly_25_channel_2_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":290,"y":100,"wires":[["9a939dfa189b7b4f","27723804bd2b2686"],["6a0a411fd38633b3"]]},{"id":"363b6aba5b2828c4","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Gesamtleistung Power >= 46W","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"46","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.gesamtleistung_power","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":810,"y":500,"wires":[["172fb4bc37ca4d9e","ae537381567acc7f","bec9f9507627fdd0"],[]]},{"id":"c10d26d913731bb4","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1000,"y":20,"wires":[["1ef105c518524c98","3eee0952c7f359c5","d2489bdd51b362b7"],["8b2bb5735f7a17c9"]]},{"id":"8b2bb5735f7a17c9","type":"api-call-service","z":"32ba8bd3cfc5ea84","name":"Steckdose einschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1000,"y":100,"wires":[["c10d26d913731bb4"]]},{"id":"6268cbfc4de91402","type":"api-call-service","z":"32ba8bd3cfc5ea84","name":"Steckdose ausschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_off","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1630,"y":580,"wires":[[]]},{"id":"9036adc4560073fe","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1380,"y":580,"wires":[["6268cbfc4de91402"],[]]},{"id":"172fb4bc37ca4d9e","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Akkustand über 20%?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"20","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.d2_power_state_of_charge_gesamt","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1120,"y":500,"wires":[["9036adc4560073fe"],["5f4f51d3e6adaa41"]],"icon":"font-awesome/fa-battery-1"},{"id":"ac9062e3495b04f5","type":"api-call-service","z":"32ba8bd3cfc5ea84","name":"Steckdose einschalten","server":"4b1912ab.49dcdc","version":5,"debugenabled":false,"domain":"homeassistant","service":"turn_on","areaId":[],"deviceId":["f6a442d2e24b369fe131e7349867f58e"],"entityId":["switch.steckdose_ecoflow_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1620,"y":500,"wires":[[]]},{"id":"5f4f51d3e6adaa41","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Steckdose an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.steckdose_ecoflow_switch","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1380,"y":500,"wires":[[],["ac9062e3495b04f5"]],"icon":"node-red-contrib-home-assistant-websocket/ha-entity-switch.svg"},{"id":"d2489bdd51b362b7","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"D2 Power Export not 1","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"1","halt_if_type":"num","halt_if_compare":"is_not","entity_id":"sensor.d2_power_export_gesamt","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1340,"y":200,"wires":[["0cde2cceda56b585"],[]]},{"id":"0cde2cceda56b585","type":"change","z":"32ba8bd3cfc5ea84","name":"","rules":[{"t":"set","p":"var3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1640,"y":200,"wires":[["74b3790314d3f28a"]]},{"id":"6a0a411fd38633b3","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"D2 DC Out an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.d2_dc_out","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":440,"y":420,"wires":[["363b6aba5b2828c4"],["36f7f01a99c66a0e"]]},{"id":"36f7f01a99c66a0e","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"D2 USB Out an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.d2_usb_out","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":520,"wires":[["363b6aba5b2828c4"],["892009ad33e500e9"]]},{"id":"c7b0f85e58fe9f19","type":"mqtt out","z":"32ba8bd3cfc5ea84","name":"","topic":"ecoflow/D2/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ec973db6908c7b25","x":2700,"y":100,"wires":[]},{"id":"81096d157b89ea99","type":"template","z":"32ba8bd3cfc5ea84","name":"Charge Limit auf 100% setzen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"from\":\"HA\",\"id\":\"{{payload}}\",\"moduleType\":2,\"operateType\":\"upsConfig\",\"params\":{\"maxChgSoc\": 100},\"version\":\"1.0\"}","output":"yaml","x":2410,"y":100,"wires":[["c7b0f85e58fe9f19"]]},{"id":"02460640bfcc06bc","type":"random","z":"32ba8bd3cfc5ea84","name":"random","low":"999999999","high":"999900000","inte":"true","property":"payload","x":2160,"y":100,"wires":[["81096d157b89ea99"]]},{"id":"f929f18728f7158c","type":"mqtt out","z":"32ba8bd3cfc5ea84","name":"","topic":"ecoflow/D2/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ec973db6908c7b25","x":1880,"y":360,"wires":[]},{"id":"ab071fd210162409","type":"template","z":"32ba8bd3cfc5ea84","name":"Charge Limit auf 20% setzen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"from\":\"HA\",\"id\":\"{{payload}}\",\"moduleType\":2,\"operateType\":\"upsConfig\",\"params\":{\"maxChgSoc\": 20},\"version\":\"1.0\"}","output":"yaml","x":1600,"y":360,"wires":[["f929f18728f7158c"]]},{"id":"6b5ccddf7302ea0f","type":"random","z":"32ba8bd3cfc5ea84","name":"random","low":"999999999","high":"999900000","inte":"true","property":"payload","x":1360,"y":360,"wires":[["ab071fd210162409"]]},{"id":"b05f326b9ec4a5da","type":"template","z":"32ba8bd3cfc5ea84","name":"Charge Input auf Überschuss setzen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"from\":\"HA\",\"id\":\"{{payload1}}\",\"moduleType\":5,\"operateType\":\"acChgCfg\",\"params\":{\"chgWatts\": {{payload}},\"chgPauseFlag\": 255},\"version\":\"1.0\"}","output":"yaml","x":2430,"y":180,"wires":[["39305ef87aabf412"]]},{"id":"ce0e7bbb01e46bf9","type":"random","z":"32ba8bd3cfc5ea84","name":"random","low":"999910000","high":"999999999","inte":"true","property":"payload1","x":2160,"y":180,"wires":[["b05f326b9ec4a5da"]]},{"id":"39305ef87aabf412","type":"mqtt out","z":"32ba8bd3cfc5ea84","name":"","topic":"ecoflow/D2/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ec973db6908c7b25","x":2700,"y":180,"wires":[]},{"id":"955fa975947f963b","type":"template","z":"32ba8bd3cfc5ea84","name":"Charge Input auf 120W setzen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"from\":\"HA\",\"id\":\"{{payload1}}\",\"moduleType\":5,\"operateType\":\"acChgCfg\",\"params\":{\"chgWatts\": 100,\"chgPauseFlag\": 255},\"version\":\"1.0\"}","output":"yaml","x":1610,"y":420,"wires":[["b4ab3171f73e76cd"]]},{"id":"7485d941952abe46","type":"random","z":"32ba8bd3cfc5ea84","name":"random","low":"999910000","high":"999999999","inte":"true","property":"payload1","x":1360,"y":420,"wires":[["955fa975947f963b"]]},{"id":"b4ab3171f73e76cd","type":"mqtt out","z":"32ba8bd3cfc5ea84","name":"","topic":"ecoflow/D2/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ec973db6908c7b25","x":1880,"y":420,"wires":[]},{"id":"892009ad33e500e9","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"D2 AC Out an?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"true","halt_if_type":"bool","halt_if_compare":"is","entity_id":"switch.d2_ac_out","state_type":"habool","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":440,"y":620,"wires":[["363b6aba5b2828c4"],["9036adc4560073fe"]]},{"id":"ae537381567acc7f","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Charge Limit auf 20% ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"20","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.d2_power_charge_limit","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1130,"y":360,"wires":[[],["6b5ccddf7302ea0f"]]},{"id":"bec9f9507627fdd0","type":"api-current-state","z":"32ba8bd3cfc5ea84","name":"Charge Input auf 120W ?","server":"4b1912ab.49dcdc","version":3,"outputs":2,"halt_if":"100","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.d2_power_charge_input","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"num"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1130,"y":420,"wires":[[],["7485d941952abe46"]]},{"id":"4b1912ab.49dcdc","type":"server","name":"Home Assistant","addon":true},{"id":"ec973db6908c7b25","type":"mqtt-broker","name":"","broker":"192.168.2.147","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

@mmiller7
Copy link

mmiller7 commented Dec 13, 2023

Has anyone noticed a change in how the MQTT reporting works?

My Delta Max 2000 just got a firmware update and seems to no longer be publishing anything to the "data" topic unless the app is open, and I can't figure out how the battery "knows" if the app is open or not? And closing the app it stops sending after just a few seconds.

I saw others having issues a few months ago, but mine didn't start acting up until after the firmware update tonight. Similar thing, only getting updates published if the app is open on a device. I don't have to restart anything so MQTT isn't dropping, I just need the app left open. Yes, using a unique random UUID.

Wondering if we need some kind of keepalive or heartbeat topic published required to let the servers know the client is still active?

@lwsrbrts
Copy link

Has anyone noticed a change in how the MQTT reporting works?

My Delta Max 2000 just got a firmware update and seems to no longer be publishing anything to the "data" topic unless the app is open, and I can't figure out how the battery "knows" if the app is open or not? And closing the app it stops sending after just a few seconds.

I saw others having issues a few months ago, but mine didn't start acting up until after the firmware update tonight. Similar thing, only getting updates published if the app is open on a device. I don't have to restart anything so MQTT isn't dropping, I just need the app left open. Yes, using a unique random UUID.

Wondering if we need some kind of keepalive or heartbeat topic published required to let the servers know the client is still active?

Technically speaking, MQTT isn't dropping, but the bridge connection is no longer receiving updates from those topics. If you close the Ecoflow app and then ensure it's dismissed (assuming you're using Android) then restart MQTT, you should see the data start to flow in to the MQTT server/bridge connection again.

If you open the Ecoflow app again, the data will continue to flow while the app is open but as soon as the app is put to sleep by the OS, the bridge connection will go stale again. The only solution to this is to ensure the app is dismisses/completely closed, restart MQTT and don't open the app again - that's what I've been doing for my Smart Home Panel for months. Yes it's a workaround but in the absence of a solution, that's what I do.

@mmiller7
Copy link

Has anyone noticed a change in how the MQTT reporting works?
My Delta Max 2000 just got a firmware update and seems to no longer be publishing anything to the "data" topic unless the app is open, and I can't figure out how the battery "knows" if the app is open or not? And closing the app it stops sending after just a few seconds.
I saw others having issues a few months ago, but mine didn't start acting up until after the firmware update tonight. Similar thing, only getting updates published if the app is open on a device. I don't have to restart anything so MQTT isn't dropping, I just need the app left open. Yes, using a unique random UUID.
Wondering if we need some kind of keepalive or heartbeat topic published required to let the servers know the client is still active?

Technically speaking, MQTT isn't dropping, but the bridge connection is no longer receiving updates from those topics. If you close the Ecoflow app and then ensure it's dismissed (assuming you're using Android) then restart MQTT, you should see the data start to flow in to the MQTT server/bridge connection again.

If you open the Ecoflow app again, the data will continue to flow while the app is open but as soon as the app is put to sleep by the OS, the bridge connection will go stale again. The only solution to this is to ensure the app is dismisses/completely closed, restart MQTT and don't open the app again - that's what I've been doing for my Smart Home Panel for months. Yes it's a workaround but in the absence of a solution, that's what I do.

After messing with a River2 unit I'm starting to wonder if we don't know about something that the app is "publishing" to announce its connected and open. Because the River2 doesn't update at all unless the app is open AND its also the "active device" on the phone screen...like somehow it can tell the difference between selected and just app is open. I'm wondering if we are missing at least one MQTT topic used for app management.

@Hardy62wo
Copy link

Hardy62wo commented Dec 13, 2023 via email

@mmiller7
Copy link

Hi, my actual firmware is 1.0.1.107 and everything is ok. In the app there is an announcement for a 1.0.1.111. With your infos i will not do an update! Thanks! Best regards Hardy Am 13. Dezember 2023 10:46:22 MEZ schrieb Lewis Roberts @.***>:

Has anyone noticed a change in how the MQTT reporting works? > > My Delta Max 2000 just got a firmware update and seems to no longer be publishing anything to the "data" topic unless the app is open, and I can't figure out how the battery "knows" if the app is open or not? And closing the app it stops sending after just a few seconds. > > I saw others having issues a few months ago, but mine didn't start acting up until after the firmware update tonight. Similar thing, only getting updates published if the app is open on a device. I don't have to restart anything so MQTT isn't dropping, I just need the app left open. Yes, using a unique random UUID. > > Wondering if we need some kind of keepalive or heartbeat topic published required to let the servers know the client is still active? Technically speaking, MQTT isn't dropping, but the bridge connection is no longer receiving updates from those topics. If you close the Ecoflow app and then ensure it's dismissed (assuming you're using Android) then restart MQTT, you should see the data start to flow in to the MQTT server/bridge connection again. If you open the Ecoflow app again, the data will continue to flow while the app is open but as soon as the app is put to sleep by the OS, the bridge connection will go stale again. The only solution to this is to ensure the app is dismisses/completely closed, restart MQTT and don't open the app again - that's what I've been doing for my Smart Home Panel for months. Yes it's a workaround but in the absence of a solution, that's what I do. -- Reply to this email directly or view it on GitHub: #1 (comment) You are receiving this because you were mentioned. Message ID: @.***>

Might actually have been a false alarm. I was attempting to update my HA YAML to poll the battery and...its working again. I think I may have forgotten another different device (tablet) had the app open still in the background from when I was trying to set my River2 up, and that was interfering with restarting the MQTT broker bridge.

I'm now observing the same behavior as others, where it stops if the app is used, and it resumes upon restarting the MQTT broker to restart the bridge.

@Ne0-Hack3r
Copy link

Has anyone noticed a change in how the MQTT reporting works?
My Delta Max 2000 just got a firmware update and seems to no longer be publishing anything to the "data" topic unless the app is open, and I can't figure out how the battery "knows" if the app is open or not? And closing the app it stops sending after just a few seconds.
I saw others having issues a few months ago, but mine didn't start acting up until after the firmware update tonight. Similar thing, only getting updates published if the app is open on a device. I don't have to restart anything so MQTT isn't dropping, I just need the app left open. Yes, using a unique random UUID.
Wondering if we need some kind of keepalive or heartbeat topic published required to let the servers know the client is still active?

Technically speaking, MQTT isn't dropping, but the bridge connection is no longer receiving updates from those topics. If you close the Ecoflow app and then ensure it's dismissed (assuming you're using Android) then restart MQTT, you should see the data start to flow in to the MQTT server/bridge connection again.
If you open the Ecoflow app again, the data will continue to flow while the app is open but as soon as the app is put to sleep by the OS, the bridge connection will go stale again. The only solution to this is to ensure the app is dismisses/completely closed, restart MQTT and don't open the app again - that's what I've been doing for my Smart Home Panel for months. Yes it's a workaround but in the absence of a solution, that's what I do.

After messing with a River2 unit I'm starting to wonder if we don't know about something that the app is "publishing" to announce its connected and open. Because the River2 doesn't update at all unless the app is open AND its also the "active device" on the phone screen...like somehow it can tell the difference between selected and just app is open. I'm wondering if we are missing at least one MQTT topic used for app management.

@mmiller7

I have not looked at it in a while but I believe the app will send an RTC update periodically while open once that starts and then stops the MQTT server stops echoing data to other subscribers not publishing that update... I have not proven that out 100% nor tried to re-create that behavior... instead I have HA watch for stale data (last update >1 minute) and restart mosquito if it sense that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests