[SOLVED] Enphase Battery: Charge and discharge entities

Hi Patrick,

of course - I am happy to help.

Charge:

{{ states('sensor.solar_batterie_1_2_3_akt_w') | int *-1 if states('sensor.solar_batterie_1_2_3_akt_w') | int  < 0 else 0 }}

Whereas solar_batterie_1_2_3_akt_w is just the sum of the individual battery values sensor.encharge_xxxxx_leistung

For discharge I have this template with the same input value (sum mentioned above)

{{ states('sensor.solar_batterie_1_2_3_akt_w') | int *1 if states('sensor.solar_batterie_1_2_3_akt_w') | int > 0 else 0 }}

For the total in kWh the Riemann (for charging) is:
(I think I created it with the default values):

3 Likes

Perfect. Thanks so much.

1 Like

Has the rest command for changing cloud-only settings been working for people the past couple weeks? I’ve had a few rounds of it working, then needing another token and/or more cookie data, then not working.

It looks to me like this solution is still variable within the Uk just needs a little work as it requires a 1. GET to pull schedules 2. logic to work out what schedule to update 3. PUT request for new schedule 4. POST to validate schedule

I think with a bit of effort the token could be refreshed also if you are willing to put your username and password into the script.

Would anyone else find this useful in the UK?

1 Like

Hello, I’m interested in those entities you show in the picture where you can select the Storage Mode profile, a toggle to enable or disable the Charge from the grid and others I don’t see them in my official Enphase integration. I have the firmware 8.3.10708.30. Any idea how to get those entities? Thanks in advance.

EDIT: Never mind, I just found them but not coming from Envoy 122xxxxxx but from Empower 122xxxxxx. The only one I’m missing is the Restrict discharge battery toggle. I’ll follow what @chinedu40 shared. Thanks all.

Hi, looks like it’s changed and requires a few more

disclaimer_type: itc
schedule_type: cfg
force_schedule_opted: true
charge_from_grid: true
accepted_itc_disclaimer: true

I’ve been trying to get it to work, but haven’t been able to. Have you updated yours, and does it work in October 2025?

Ok, i know this is a really old post but I’m trying to set this up. on HA Developer Tools ā€œServicesā€ doesn’t exist. I believe this is now Actions, but I can’t create this action (sorry, new to HA). How do I do this please?

OK, i’ve got further. I’m trying to set dtgControl (Discharge to Grid) but I’m getting a 403 back, strangely the error I’m getting is:
Payload: b'{"dtgControl":{"enabled":true}}
Even though I’m specifying:
payload: '{"dtgControl":{"enabled":{{ charge_value }}}}'

not sure where the extra b’ is coming from though (or if that’s the actual issue)

your enphase system is allowed to discharge on the Grid ? i guess it s perhaps no more allowed
perhaps @catsmanac can help you

and did you checked the @chinedu40 github ?

Hi, sorry for the delay responding, looks like I don’t get an email with an update.

Yes I can discharge to grid, option is there and setable in the app.

When I go to the use I see:
{"type":"battery-details","timestamp":"2026-01-03T21:32:22.098122548Z","data":{"supportsMqtt":true,"pollingInterval":60,"drEventActive":false,"drEventMode":"","profile":"self-consumption","prevProfile":null,"batteryBackupPercentage":0,"requestedConfigMqtt":{},"requestedConfig":{},"stormGuardState":"disabled","showStormGuardAlert":false,"stormAlertMessage":null,"acceptedItcDisclaimer":"2025-11-20T11:39:09.054Z","hideChargeFromGrid":true,"envoySupportsVls":true,"chargeBeginTime":0,"chargeEndTime":300,"veryLowSoc":5,"veryLowSocMin":5,"veryLowSocMax":25,"chargeFromGrid":true,"chargeFromGridScheduleEnabled":true,"batteryBackupPercentageMax":100,"batteryBackupPercentageMin":10,"previousBatteryBackupPercentage":{"self-consumption":0,"cost_savings":30,"backup_only":100,"expert":30},"systemTask":false,"dtgControl":{"show":true,"showDaySchedule":true,"enabled":false,"locked":false,"scheduleSupported":true,"startTime":960,"endTime":1140},"cfgControl":{"show":true,"showDaySchedule":true,"enabled":true,"locked":false,"scheduleSupported":true,"startTime":null,"endTime":null,"forceScheduleSupported":false,"forceScheduleOpted":true},"rbdControl":{"show":true,"showDaySchedule":true,"enabled":false,"locked":false,"scheduleSupported":true,"startTime":null,"endTime":null},"powerMatchControl":null,"devices":null}}

So it looks like I need to set the subsection ā€œenabledā€ in ā€œdtgControlā€

I can’t seem to find a github link I’m afraid

Hi @dave2318

That means you can for exemple Charge the battery if you see that wetter will be not good ? Because this funtion is only available for USA …
Thx for feedback

Hi, I really like the integration of Enphase on Home Assistant. I was doing tests this weekend and found 2 things that are not working great.

  1. If I disable the charge from grid while I’m in SC through the Enphase UI the battery start discharging as it seems to also disable the schedule. But if I do it through HA it keep charging to 100% from solar and runs the house using the grid. It seems to keep the schedule and disables the grid charging only. In my version of Enphase (Canada) I have Enable trigger to charge from grid but also a checkmark for a schedule when this is allowed but seems to be also to keep the battery at 100% even if charge from grid is disabled through HA. I checked in HA and I could not find a trigger for this schedule thing.
  2. Not sure if this is an issue or just a one off but I tried to disable grid from HA and it did something weird the first time I did second was OK. As soon as I did so my solar production went to 0 and only the battery was being used to power the house. Yet if I do the same via the Enphase UI solar production is possible and used by the house in conjunction with the battery. Second time it worked as intended.

Im also waiting to see if Enphase can put me in a DIY installer setup to see if I get even more options. TBD. I will update once this is done.

Hi @sdionne000 - greetings to Canada.

I am based in Germany, so my experience / system configuration might not by applicable 100%.
However, here are my two cents to your questions:

  1. I guess this is how it’s designed. If you disable charge from grid, it will not charge and the schedule is deactivated as well (which makes sense from my POV). On my system I can set a separate schedule to block the battery during a specific schedule.
  2. The HA to enphase API is very limited, so I cannot set anything regarding operation Mode (SC / AI) or battery behavior.

However, I use the AI since quite a while and it seems to work properly:

  1. When power is cheap and high prices umcoming, the battery will be charged from grid and discharged later to power the house.
  2. When I charge my EV and the power is cheap, the EV will be charged from the grid and the battery will be blocked (not dicharged).
    Sometimes it even charges both on low power rates: the battery AND the EV.

a { text-decoration: none; color: #464feb; } tr th, tr td { border: 1px solid #e6e6e6; } tr th { background-color: #f5f5f5; }

You’re probably already set as an installer, — otherwise you wouldn’t be able to activate the ā€œcharge battery from gridā€ option.
The installer activation is actually very quick to do over the phone… Enphase usually enables it without asking any questions.

I also think the Enphase options are the same across countries — at least that’s how it works for me.

Make sure to create an issue directly here:
GitHub - chinedu40/hacs_enphase_envoy_cloud: Home assistant enphase cloud hacs integration
With the HACS version, bugs will be fixed much faster.

Yes for me that is also correct :slight_smile:

1 Like

So, I finally have it working! I found this and it worked perfectly!

I can now run automations to turn on and off charge from grid, discharge to grid, restrict battery discharge and set schedules.

Hi @dave2318

That’s awesome!
Thank you very much for sharing.

I assume this only works if ā€œself-consumptionā€ is active (not AI)?
Second question: Does this work in parallel with the official enphase integration?

Thanks!

EDIT:
Never mind - I see that it only works on self-consumption mode (which makes sense)

Hi nco3

Check also here you have all information wallbox / battery / HEating pump …

1 Like