ATMOCE / ATMOZEN solar battery control using MODBUS

This is my very first integration (which is not a fork of anything else), and aimed high (for silver quality), so that everything is well documented, there is a config flow and cloud connection fallback in case local control is not working / MODBUS not enabled in your setup.

Features

  • 27 sensor entities — grid, PV, battery, system and computed metrics
  • Full battery control — force charge/discharge, set target SOC, duration and power
  • “Administrado por batería” button — one-tap return to automatic self-managed mode
  • Battery model selector in setup — MS-7K-U pre-configured, manual entry for other models
  • Automatic Modbus→Cloud fallback (optional) if the gateway is temporarily unreachable
  • Active data source sensor — always know whether you are reading Modbus or Cloud
  • Computed sensors — autonomy hours, PV self-consumption rate, battery health
  • Diagnostics support — exportable debug info with sensitive fields redacted
  • Bilingual — English and Spanish UI out of the box

Please check it out!!! it is on beta test now, active development so if you encounter any bug I’ll be happy to iron it out

pacorola/Atmoce_battery_HA: ATMOCE battery support in Home Assistant

As it uses the gateway for connection, also monitors all PV sensors so if you have ATMOCE panels or mirco inverters , this integration should also work.

1 Like

Hello,

I was verry happy to see this available. Thank you for your work.
I have installed it last night but was not able to connect to Atmoce gateway. On my phone I looked in the Atmozen App → Settings ->3rd Party System, and here I saw the IP of the gateway for wifi, and that ModBus-Tcp is enabled.
I oppened HA and try to connect to the gateway, but got the following message: “unknown error occured” and I am stuck here

Sole clarifications

Info: In Atmoce Integration the port selected to connect is the same between app and gateway, also I see a sliding bar in the bottom and there it states “slave”. I do not know the purpose of that to be honest.

Info 2: in the Atmoce android app under modbus I can see the IP of the Home Assistant under “Connect Client” but there seems to not to anything, it’s just like a list of info.

I hope you can help me in connecting to the Atmoce Battery.

Regards from Romania

Thanks! One contributor identified a problem with the latest Home Assistant version wich bumped pymodbus and so the integration was connecting, but not “speaking” to the gateway properly. It is now fixed and tested! Please update via HACS and report if it’s fixed for you as well.

Should it fail again, do you have anything in your system log that helps me trace the error? You can also activate debug, once we identify the regression in the config flow it will be surely easily fixed

1 Like

Thanks for your quick support. It worked.

One other point though, I see that there are still some modes in Spanish :slight_smile: …(I hope I got it right). I could modify on my side but I think it makes sense to change at your side.
In question:

  • battery command
  • forced mode Type
    Also is it normal that dispatch power can only be a value with x.x5 value at the end?

Thanks

Thanks!!! I am very happy its helping you!!! I will attempt to fix the bug you mention, perhaps its in controls.py. Regarding translation, in the weekend I will see why the value is not translated. Expect an update soon!

Hello,

You’ve just made my day! I’m going to install it as soon as I get home.

I have a quick question: is it possible to manage the battery discharge settings? Specifically:

  • During the day: Stay in automatic mode (charge/discharge managed by solar production and home consumption).
  • At night (e.g., from 10 PM): Set the battery to discharge at a FIXED power of XXX watts (for example, a 400W limit from 10 PM to 6 AM). This is to prevent the Atmoce battery from being completely drained by charging my electric vehicle.

YES you can!!! You can try using (adapting to your setup) these two automations:

FIRST - Activation of night discharge rate at 22hj (for example)

alias: "Atmoce - Descarga nocturna limitada"
trigger:
  - platform: time
    at: "22:00:00"
action:
  - service: switch.turn_on
    target:
      entity_id: switch.atmoce_remote_control
  - service: number.set_value
    target:
      entity_id: number.atmoce_forced_power
    data:
      value: 0.4        # 400W en kW
  - service: select.select_option
    target:
      entity_id: select.atmoce_forced_mode_type
    data:
      option: "Duration"
  - service: number.set_value
    target:
      entity_id: number.atmoce_forced_duration
    data:
      value: 480        # 8 horas hasta las 06:00
  - service: select.select_option
    target:
      entity_id: select.atmoce_battery_command
    data:
      option: "Forced discharge"

SECOND, at the morning (For example 6:00) return to automatic battery management

alias: "Atmoce - Volver a modo automático diurno"
trigger:
  - platform: time
    at: "06:00:00"
action:
  - service: button.press
    target:
      entity_id: button.atmoce_administrado_por_bateria

Just paste the automations and then change values as you please.

However, be warned, This does not mean the battery discharge is limited to that amount, but that is FORCED, alas, I would tweak the first automation to wait for your car to plug in and the second one to trigger at morning or as soon as the car or the charger reports it’s finished.

If you have a “dumb” charger, let me recommend you to install a wifi clamp (even relatively cheap ones work) in your charger box, I did that on mine and its a dirt cheap and effective way of monitoring charges. But i will see wether I can implement this via integration, it would be very cool!

1 Like

Hello guys.

Great work, I checked the new release and all seamns to work fine, both translations and value selection
I am also using the automation to discharge to grid with a set value because the atmoce battery is feeding back into a deye inverter as micro inverter. Works great so far

Hi there,
First of all, thanks again for the amazing work.
I’ve spent the weekend using it and tweaking it to fit my system and my needs. It’s absolutely great!

1 Like

Hello Marius, I have the same problem as you. Is there any fix?
Thank you!

Solved, for me I had to update the home assistant to a newer version, now is working.

Hello, I have a problem connecting too. In atmozen I have enabled TCP and I have 3 ip’s (FE1 to Device, FE2 to Router and Wifi). My gateway is connected through Wifi. I have tried to connect with all ip’s, to port 502 (as in the app), and both 0,1 slave, but i keep getting cannot_connect error. If you could help me that would be great!

Hi Alex. please raise an issue at GitHub - pacorola/Atmoce_battery_HA: ATMOCE battery support in Home Assistant · GitHub and if you can look at your home assistant log for any clue. The IP should be the one of the gateway, and you specifically need modbus enabled on the app. Did you check the FAQ at the github page?

Yes, the modbus is enabled, but I think it’s not an issue with the integration. If I try to ping the IP from my computer it gives host unreachable, although it appears in the router DHCP list as active. I didn’t manage to figure it out, but I will keep trying