[SOLVED] Enphase Battery: Charge and discharge entities

So if I understand it correctly, you can trigger them manually and the settings have effect in the Envoy? But the issues is you can’t schedule them?

Yes, that’s an unfortunate fact. ( HA issue 123216 ) Haven’t found solutions yet.

Correct, I can trigger them manually in the app UI, but not using the scheduled option in HA.

Does that sound about right and perhaps a bug, or is there something wrong with my setup?

Ah I see, from the app it works, but not from HA. If you are on Envoy firmware 8.2.24xx or newer that this is expected. Starting with that firmware the Envoy has changed behavior that ignores these methods that used to work in older versions. :sob:

Still in search for alternatives, but little progress. Enphase is still “not really embracing” open-home.

1 Like

Thanks @catsmanac – I raised a ticket to Enphase regarding this (a while ago) and today they’ve come back with:

regarding the ability to control charging and discharging via API using Home Assistant.

At this time, we do not have this feature available in the UK. However, I will make sure to add it to our list of future feature requests and inform my team.

Thank you for your understanding!

Oh well!

Thanks for sharing, @phillll
So this basically means that manual charging will not be available soon even if the AI is already using it in the UK.
That’s bad news also for the rest of Europe.
:tired_face:

1 Like

Hi all, I recently got an enphase system and batteries and was disappointed to learn that the home assistant integration doesn’t work in the UK. I have managed to make this work via using Restful commands. I know it’s not quite using the local api, but it may still be useful for automations for some.

  1. Capture Needed Info from the Web App
    1. Go to the Enphase Web App (e.g., https://enlighten.enphaseenergy.com/) and log in.
    2. Open Chrome DevTools (right-click → Inspect → Network tab).
    3. Go to the battery settling where the Toggle setting is located (e.g., “Charge from Grid”) so the web app sends the request.
    4. In Network clear the current data then toggle the battery to charge
      5. find the request URL like:

https://enlighten.enphaseenergy.com/service/batteryConfig/api/v1/batterySettings/<BATTERY_ID>?userId=<USER_ID>

6.	Extract from the headers/body:
•	<BATTERY_ID> (e.g., 1234567)
•	<USER_ID> (e.g., 9876543)
•	e-auth-token (long token string)
•	The JSON payload (e.g., {"chargeFromGrid": false})

Note: The token may expire periodically. You’ll need to repeat these steps when that happens.
  1. Define a rest_command in Home Assistant

In configuration.yaml (or a separate YAML file you use), add:

rest_command:
  set_enphase_battery:
    url: "https://enlighten.enphaseenergy.com/service/batteryConfig/api/v1/batterySettings/{{ battery_id }}?userId={{ user_id }}"
    method: PUT
    headers:
      content-type: "application/json"
      e-auth-token: "<YOUR_TOKEN_HERE>"
      username: "{{ user_id }}"
    payload: >
      {
        "chargeFromGrid": {{ charge_value }}
      }

Key Points
• battery_id, user_id, and charge_value are template variables you pass when calling the service.
• e-auth-token: Replace <YOUR_TOKEN_HERE> with the token from DevTools.

  1. Call the Service

You can call rest_command.set_enphase_battery in Developer Tools → Services, a script, or an automation.

Example: Developer Tools → Services

rest_command.set_enphase_battery
data:
  battery_id: "1234567"
  user_id: "9876543"
  charge_value: "false"

Click Call Service and watch the response in your logs.

Example: Automation Snippet

automation:
  - alias: "Toggle Enphase Battery"
    trigger:
      - platform: state
        entity_id: switch.enphase_battery_toggle
        to: "on"
    action:
      - service: rest_command.set_enphase_battery
        data:
          battery_id: "1234567"
          user_id: "9876543"
          charge_value: "true"