marstek-venus-rs485-node-red icon indicating copy to clipboard operation
marstek-venus-rs485-node-red copied to clipboard

Interface with other battery vendors (e.g. Anker Solarbank)

Open Jos1958 opened this issue 7 months ago • 14 comments

I recently found this HBC project and I am very interested to use the charging strategies for my battery. Instead of a Marstek Venus Battery I own an Anker Solarbank 3 Pro. I am already controlling the Anker Battery in Home Assistant. The Anker Integration is helas not working locally and uses the cloud api. Implementing a NOM strategy is not really feasible since there need to be at least 30 seconds between subsequent commands to the battery. Not really a problem since I am happy with the Anker NOM implementation.

I have updated this comment below for my latest findings and reply from Bob (12-may-2026). See https://github.com/Jos1958/marstek-venus-rs485-node-red/blob/main/home%20assistant/other-batteries/Anker-SB3/anker_to_m1_marstek.yaml for my implementation of HBC to Anker SolarBank 3 Pro interface.

Update 25-april-2026: A separate automation has now been developed that updates the Anker Battery for charge/discharge. https://github.com/Jos1958/marstek-venus-rs485-node-red/blob/main/home%20assistant/other-batteries/Anker-SB3/automation-hbc-for-anker.yaml

See also the Discord thread for further discussions: https://discord.com/channels/1422227123925680228/1507859984350842890

Can I just disable the self-consumption strategy since I read somewhere that many other strategies rely on the self-consumption strategy? For now I have the PID setup (P=0, I=0 and D=0) which will sort of disable the self-consumption.

However for a dynamic prices I would prefer to have more control over the strategy and not rely on the Anker 'smart' mode. Therefore I already installed the HBC project and I am now trying to implement the Marstek interface to the Anker Batteries.

The Marstek VenusV3-modbus-TCP-IP interface (marstek_m1_modbus_tcp.yaml) by Fonske is my starting point and I am trying to determine which sensors and templates are needed (readonly or update) for HBC.

Many sensors have a related template and for now I am assuming that I do not needed the sensor in those cases. Any comments on that? I have only implemented the templates from the modbus yaml and ignored the sensors

I am making good progress with implementing some of the sensors and templates but I am struggling a bit with the node-red flows since I am rather new on this subject. I found the usage of some (readonly) sensors in the flows and some on the dashboard but I miss the control of the battery. In flow 'Home Battery Start' I find a 'set mode (charge/discharge/stop)' and a 'set power' but when I click there seems to be nothing behind this node. How do I access the logic behind these nodes? The logic is in the 'Set batteries' node

Can I assume that these nodes are using the select (for forcible charge/discharge) and the number (for forcible charge or discharge power) to control the battery? Yes, the strategies will update the forcible charge/discharge and the forcible charge AND forcible discharge power

Any feedback on my approach would be appreciated aswell. Are there any other attempts to apply HBC to batteries of other vendors?

Below you will find my inventarisation of the sensors and templates that I think are required. I left out the ones that I think are not relevant/required for HBC but if I missed a sensor/template that is necessary please let me know.

I now have the following modbus sensors implemented:

  • name: "Marstek m1 Device Name" *** Implemented for Anker as Readonly Template (used by the HBC dashboard to display M1 Battery)
  • name: "Marstek m1 Battery Power" *** Implemented for Anker as Readonly Template (used by HBC in the 'Home Battery Start' Flow)
  • name: "Marstek m1 Battery State Of Charge" *** Implemented for Anker as Readonly Template (used by the HBC dashboard to display M1 Battery)
  • name: "Marstek m1 AC Power" *** Implemented for Anker as Readonly Template (used by the HBC dashboard to display M1 Battery)

The following modbus sensors will not be implemented since they have a related template:

  • name: "Marstek m1 Inverter State Number" *** NOT Implemented for Anker (see Template sensor.marstek_m1_inverter_state)
  • name: "Marstek m1 Backup Function Number" *** NOT Implemented for Anker (see Template select.marstek_m1_backup_function)
  • name: "Marstek m1 RS485 Control Mode Number" *** NOT Implemented for Anker (see Template select.marstek_m1_rs485_control_mode)
  • name: "Marstek m1 Forcible Charge Discharge Number" *** NOT Implemented for Anker (see Template select.marstek_m1_forcible_charge_discharge)
  • name: "Marstek m1 Charge To SOC Number" *** NOT Implemented for Anker (see Template number.marstek_m1_charge_to_soc)
  • name: "Marstek m1 Forcible Charge Power Number" *** NOT Implemented for Anker (see Template number.marstek_m1_forcible_charge_power)
  • name: "Marstek m1 Forcible Discharge Power Number" *** NOT Implemented for Anker (see Template number.marstek_m1_forcible_discharge_power)
  • name: "Marstek m1 User Work Mode number" *** NOT Implemented for Anker (see Template select.marstek_m1_user_work_mode)
  • name: "Marstek m1 Max Charge Power Number" *** NOT Implemented for Anker (see Template number.marstek_m1_max_charge_power)
  • name: "Marstek m1 Max Discharge Power Number" *** NOT Implemented for Anker (see Template number.marstek_m1_max_discharge_power)

I am looking at implementing the following templates: sensor:

  • name: "Marstek m1 Inverter State" *** Implemented for Anker (Readonly) (Used by HBC in the 'Home Battery Start' Flow), No update mode required in HBC?

select:

  • name: Marstek m1 RS485 Control Mode *** Set by HBC when switching between 'Full Control' and 'Manual Control' or 'Marstek Control'
  • name: Marstek m1 User Work Mode *** I assume that this mode is not read or updated by HBC
  • name: Marstek m1 Forcible Charge/Discharge *** HBC uses this to set the charge or discharge Mode
  • name: Marstek m1 Backup Function *** I assume this backup function is not used by HBC

number:

  • name: Marstek m1 Forcible charge Power *** HBC uses this to set the charge power in forcible charge mode
  • name: Marstek m1 Forcible discharge Power *** HBC uses this to set the discharge power in forcible discharge mode Remark: both forcible charge and discharge power are set to the same value in both modes (charge and discharge)
  • name: Marstek m1 Charge To SOC *** Not needed/used by HBC
  • name: Marstek m1 Max. Charge Power *** Implemented for Anker (Readonly for now), (used by the HBC dashboard to display M1 Battery)
  • name: Marstek m1 Max. Discharge Power *** Implemented for Anker (Readonly for now), (used by the HBC dashboard to display M1 Battery)

Jos1958 avatar May 04 '26 15:05 Jos1958

Hi Jos, amazing analysis already. Very interested in your progress. Some tips.

-- You will need to replace the "Get batteries information" and "Set batteries" sections of the 'Home Battery Start'-flow. Those two sections are Marstek specific atm.

Your above mentioned Select and Number sensors are used to actually command the Marstek batteries to charge/discharge, and are Marstek specific. (You can omit the Charge to SOC sensor though - that one is not used).

Set batteries for Anker: You will need to find the equivalents for the Anker battery to command a charge or discharge.

Why are the Set Mode and Set Power nodes empty? Have a look at the "Set Batteries" function node - the configuration is set there and then passed to those empty nodes.

gitcodebob avatar May 11 '26 19:05 gitcodebob

Thanks Bob, I did come much further with the implementation and managed to integrated the read-only part completely. Have a look for my implementation of the yaml file for the Anker battery: https://github.com/Jos1958/marstek-venus-rs485-node-red/blob/main/home%20assistant/packages/anker_to_m1_marstek.yaml

I have not implemented the set batteries yet for charge and discharge since that is complicated. I do have a couple of helpers in the yaml that are reacting on your HBC charge and discharge commands. I am afraid there are no equivalents for the Anker battery of the charge but I am planning to use the 'backup' mode with a max input limit. Discharge can be done with the 'manual' mode. I am not sure yet if I will try to implement this in yaml/jinja since I already have a working pyscript version that I can use to steer charging and discharging (for NOM) with the Anker Battery (and with my other battery from HomeWizard). May be if there is interest from other people for the Anker integration with HBC.

I think my yaml file could be used as a 'template' for other batteries. Especially when they DO HAVE a local api and specific charge and discharge modes :-) The Anker Battery only has a cloud api for now although there is rumour about a future modbus implementation.

Greetings Jos

Jos1958 avatar May 12 '26 17:05 Jos1958

I'm using the anker to M1 marstek.yaml from Jos1958 (Thanks again Jos). But unfortunately I get stuck (most likely due to not being familiar enough yet with HA and Node-RED. Many parts of the HBC dashboard are coming alive, but there's no charging or discharging of my Nexus battery (using a modbus inegration to link to the Solis inverter). Firstly I'm not sure what to do with the comment above: "-- You will need to replace the "Get batteries information" and "Set batteries" sections of the 'Home Battery Start'-flow. Those two sections are Marstek specific atm.

Your above mentioned Select and Number sensors are used to actually command the Marstek batteries to charge/discharge, and are Marstek specific. (You can omit the Charge to SOC sensor though - that one is not used).

Set batteries for Anker: You will need to find the equivalents for the Anker battery to command a charge or discharge.

Why are the Set Mode and Set Power nodes empty? Have a look at the "Set Batteries" function node - the configuration is set there and then passed to those empty nodes"

Secondly I get an error in the "Max charging power" flow, how can you see what causes the error?

Since its likely that many different batteries may want to connect to HBC, are you considering to create like an overview of the used entities and sensors including a description such that also the flows are working for many batteries?

In any case, I like the work done already! Groeten,

Mauricio

mauri13github avatar May 17 '26 14:05 mauri13github

Mauricio, I think you are looking at the wrong instructions. Look at the comments in my yaml file. Create a copy and replace the solarbank entities by the similar nexus entities. There is no need to change the HBC strategies. At the moment for the Anker only the helpers are updated so add there an update of the nexus charge mode and charge or discharge power. I can not help you there since I do not have a nexus battery. The yaml file itself is a good overview of the applicable entities.

Jos1958 avatar May 17 '26 18:05 Jos1958

Thanks Jos. Will give it another shot. What got me confused are the sections that related to the modes of your battery and the modbus interface. I will focus on changing only the charge mode and charging modes.

mauri13github avatar May 17 '26 18:05 mauri13github

Good plan. Only #23 is really important. #21 is only for an emergency stop so go to a standby if available. If you put the 6 helpers from the bottom of the file on your dashboard you can see what HBC is trying to do. Let me know which # you have trouble with perhaps I can provide some extra guidance.

Jos1958 avatar May 17 '26 21:05 Jos1958

Jos, so to check. In #23 the options are: 'stop', 'charge','discharge'. my Solis reacts on: 'None','Solis RC force battery charge', 'Solis RC force battery discharge'. Should I now replace in #23 the template options to the Solis options, as well as the helper # 3? Thanks in advance.

mauri13github avatar May 18 '26 18:05 mauri13github

Good question. I created the helpers to see what HBC is doing without actually involving the battery yet. Of course that is not the end goal. If you are happy with the results of the HBC strategies then you connect the battery. You can do that directly in #23 or with an automation that is triggered by a state change of the helper. If you stop using the helper then make sure you als feedback the charge state of your battery into #23 (with a reverse conversion). If you keep updating the helper then you do not need to do that.

Jos1958 avatar May 18 '26 22:05 Jos1958

Jos, thank for the welcome suggestions, indeed it maybe safer to react on the helper state. I will keep going at it. Bit busy on other stuff, so it may take some time. I'll get back.

mauri13github avatar May 19 '26 18:05 mauri13github

Started again and getting further now. But still some issues that I run into. I get first this error:

Image

Then:

Image

Could this be related to an issue in the yaml?

Image

I realise I'm asking a lot, but your help is very much appreciated.

mauri13github avatar May 21 '26 17:05 mauri13github

I found where you see those errors, in Visual Code Studio in Home Assistant. Ignore them because they are caused by the fact that Visual Code Studio is old and does not support these constructs in yaml. I see the same errors but the yaml is fine. What you can do is check if all the entities are created in home assistant. Have a look in the Settings -> System -> Logs if there are any errors for the yaml file. I am still at version 4.8.2 of the node-red flows so may be I have to upgrade to get the same problem. I do not see a "Link in" node in the Home Battery Start flow. Do you?

Jos1958 avatar May 21 '26 18:05 Jos1958

I am not sure what is happening in the 'Link in' node but I found it in my version aswell. It seems to have corrected itself in your next log so may be we should not worry about it to much at the moment. I noticed something else in your second log: "Battery M1 (SKIP): skipped because RS485 is not 'enable'"

Image

That is not ok. RS485 Control Mode should be 'enable'

Did you change anything to #21 and the related helper 'input_select.marstek_m1_anker_helper_rs485_control_mode' for your battery?

It enables the modbus interface for the Marstek device but there is no modbus on the Anker Battery. So there is nothing similar in the Anker Battery for this control mode and it is not really needed to control the battery power. Apparently somewhere in the flow it is checked if the control mode is 'enable' and when not the strategy is stopped!

This helper should go to 'enable' when you switch from Control Mode: 'Manual control' to: 'Full Control' in HBC.

Image Image

Do you still have all the helpers?

I have put a card on my desktop to follow the behavior of the helpers, may be that can help you to find the reason why the control mode is not 'enable':

type: entities
entities:
  - entity: input_select.marstek_m1_anker_helper_rs485_control_mode
    name: Control Mode Helper for Anker
  - entity: input_select.marstek_m1_anker_helper_user_work_mode
    name: User Work Mode Helper for Anker
  - entity: input_select.marstek_m1_anker_helper_forcible_charge_discharge
    name: Forcible Charge/Discharge Mode
  - entity: input_number.marstek_m1_anker_helper_forcible_charge_power
    name: Forcible Charge Power (W)
  - entity: input_number.marstek_m1_anker_helper_forcible_discharge_power
    name: Forcible Discharge Power (W)
  - entity: input_number.marstek_m1_anker_helper_charge_to_soc
    name: Charge to SOC (%)
  - entity: input_select.marstek_m1_anker_helper_backup_function
    name: Backup Function
title: Marstek M1 to Anker Helpers
Image

Jos1958 avatar May 22 '26 06:05 Jos1958

Hello Jos,

Several things prevented me sofar to get HBC to come alive. -Node-RED made my HA system collapse a few times, so I have completely re-installed including the flows. -Adding the number entities (#11 to #15) would just not happen. It seems that HA does not want these entities created using the "default_entity_id" statement. By using below example it created the entities:

  • number:
    • name: "Marstek M1 Max Charge Power" unique_id: marstek_m1_max_charge_power

As mentioned HBC has come to live for my Zonneplan Nexus battery configuration (using Solis S6 Inverter). I will test the behaviour of the helpers as suggested and if all seems to work I will try it control HBC on the "real thing"

Many thanks for the help!

mauri13github avatar May 26 '26 18:05 mauri13github

Strange, I cannot explain that, perhaps you have another entity already with the same unique_id in the HA database. Are you using discord already for the discussing the HBC configurations? Bob has added an extra thread for other batteries and I have added some pictures that might help you to configure the nexus battery: https://discord.com/channels/1422227123925680228/1507859984350842890 It would be really nice if you can make it work. I also created the update part for the Anker battery (see https://github.com/Jos1958/marstek-venus-rs485-node-red/blob/main/home%20assistant/other-batteries/Anker-SB3/automation-hbc-for-anker.yaml).

I added another extra number with SOC2 and unique_id sb2 but it was created without any problems after reloading all yaml configurations:

- number:
      - name: "Marstek M1 Charge To SOC2 (for Anker SB3)"
        default_entity_id: number.marstek_m1_charge_to_soc2
        unique_id: marstek_m1_charge_to_soc_sb2
        unit_of_measurement: "%"
        state: "{{ states('input_number.marstek_m1_anker_helper_charge_to_soc') }}"
        min: 12
        max: 100 
        step: 1        
        set_value:
          - service: input_number.set_value
            target:
              entity_id: input_number.marstek_m1_anker_helper_charge_to_soc
            data:
              value: "{{ value }}"

Jos1958 avatar May 26 '26 19:05 Jos1958