Skip to content
/ ha-evcc Public

Home Assistant integration for evcc☀️🚘- optimized charging of electric vehicles, connecting your EV charger with your PV system. The integration use local polling (interval configurable) of the evcc API. Please note, that this integration is not official and not supported by the evcc developers. This project is not affiliated with evcc in any way.

License

Notifications You must be signed in to change notification settings

marq24/ha-evcc

Repository files navigation

Home Assistant Integration: evcc☀️🚘- Solar Charging (unofficial)

ha-logo  evcc-logo

I was surprised that looks like that there does not exist a simple Home Assistant integration for the very popular evcc. So before my first EV spawned at my driveway, I want to contribute a very simple & basic integration which allow you to control evcc objects simply via the default HA gui and use sensors and switches in your automations.

Please note, that this Home Assistant integration is not official and not supported by the evcc developers. I am not affiliated with evcc in any way. This integration is based on the evcc API and the evcc API documentation.

hacs_badge github BuyMeCoffee PayPal hainstall

Disclaimer

Please be aware, that we are developing this integration to best of our knowledge and belief, but cant give a guarantee. Therefore, use this integration at your own risk.

Requirements

  • A running & configured evcc instance in your network

Main features

  • Supporting all evcc API-POST & DELETE requests (except POST /api/settings/telemetry/<status>) to adjust the evcc settings, loadpoints and the corresponding vehicles

    • Loadpoint mode [Off, Solar, Min+Solar, Fast]
    • Phases to use [Auto, 1p, 3p]
    • Assign vehicles to loadpoints
    • Configure min & max charging currents
    • Configure cost limits (€ or CO₂)
    • Adjust home-battery settings
    • Adjust/create Vehicle & Loadpoint charging plan via HA-Services http://[YOUR-HA-INSTANCE]:8123/developer-tools/service
  • Supporting most of the other loadpoint and vehicle data that is available via the API - please let me know, if you miss some data - probably it just slipped through my attention during testing.

Example Dashboard

Just take a look at this sample Dashboard (showing Sensors from one load point):

sampledashboard

Installation

Before you start - there is a 'tiny' requirement!

You must have installed & configured an evcc instance in your network. This can be either a stand-alone installation (e.g via Docker) or as a HASS-IO-AddOn. This AddOn is available via the official evcc hassio-addon repository.

Step I: Install the integration

Option 1: via HACS

Open your Home Assistant instance and adding repository to HACS.

  1. Add a custom integration repository to HACS: https://github.com/marq24/ha-evcc
    Let me repeat: This is an HACS integration, not an HASS-IO AddOn, so you need to have HACS installed, and you need to add this as custom integration repository to HACS.
  2. Once the repository is added, use the search bar and type evcc☀️🚘- Solar Charging
  3. Use the 3-dots at the right of the list entry (not at the top bar!) to download/install the custom integration - the latest release version is automatically selected. Only select a different version if you have specific reasons.
  4. After you presses download and the process has completed, you must Restart Home Assistant to install all dependencies
  5. Setup the evcc custom integration as described below (see Step II: Adding or enabling the integration)

Option 2: manual steps

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called evcc_intg.
  4. Download all the files from the custom_components/evcc_intg/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. Setup the evcc custom integration as described below (see Step II: Adding or enabling the integration)

Step II: Adding or enabling the integration

You must have installed the integration (manually or via HACS before)!

Option 1: My Home Assistant (2021.3+)

Just click the following Button to start the configuration automatically (for the rest see Option 2: Manually steps by step):

Open your Home Assistant instance and start setting up a new integration.

Option 2: Manually steps by step

Use the following steps for a manual configuration by adding the custom integration using the web interface and follow instruction on screen:

  • Go to Configuration -> Integrations and add "evcc☀️🚘- Solar Charging" integration

Common further steps

  • Provide a unique name for the integration installation (will be used in each sensor entity_id) created by the integration
  • Provide the URL of your evcc web server (including the port) - e.g. http://your-evcc-server-ip:7070
  • [optional] Provide the area where the evcc installation is located

After the integration was added you can use the 'config' button to adjust your settings, you can additionally modify the update interval

Please note, that some of the available sensors are not enabled by default.

Use evcc with your Home Assistant sensor data

Please see the separate document where you can find examples how to provide your evcc instance with HA sensor data.

Are you are go-eCharger V3 (or higher) User?

Do you know, that as owners of a go-eCharger (V3+) there is no need to use evcc for solar surplus charging? Even without any additional hardware! Home Assistant and the go-eCharger APIv2 Connect Integration is all you need. Get all details from https://github.com/marq24/ha-goecharger-api2.

Accessing your vehicle SOC & Range when the vehicle is not connected to a loadpoint

By default, evcc and this integration focus on vehicles connected to a loadpoint, this implies that data like SOC or range are only available when the vehicle is actually connected.

Nevertheless, evcc provides this data in the configuration section (no matter of the connection state). If you want to access your vehicle SOC and range, when the vehicle is not connected to a loadpoint, you can do this by adding a command_line sensor to your Home Assistant configuration.yaml file.

Important

You need to know the technical vehicle_id. Depending on from your configuration this is either the value you have specified in the evcc.yaml file or it had been automatically generated.

In any case you can request: http://[YOUR_EVCC_IP]:7070/api/config/devices/vehicle and check the value of the name attribute to get your vehicle_id.

Note

You must authorize your request(s) with the evcc password.

Command-Line in your HA configuration.yaml

requesting http://[YOUR_EVCC_IP]:7070/api/config/devices/vehicle/[YOUR_VEHICLE_ID]/status will return a json like this one here

{
  "result": {
    "capacity": {
      "value": 84.68,
      "error": ""
    },
    "chargeStatus": {
      "value": "B",
      "error": ""
    },
    "range": {
      "value": 167,
      "error": ""
    },
    "soc": {
      "value": 39.5,
      "error": ""
    }
  }
}

Check if you have already a command_line section in your configuration.yaml file - if there is none - create one on as top level entry like this (the line ' - sensor: ...' must (obviously) be replaced with the complete sections shown further below):

command_line:
  - sensor: ...

Add in the command_line section of your configuration.yaml file the following content: sections with [CHANGE_ME:xxx] have to be modified to your requirements. E.g. assuming your assuming vehicle_id is ford_mach_e, then you have to replace [CHANGE_ME:YourVehicleId] with just ford_mach_e

  - sensor:
      name: '[CHANGE_ME:Your Vehicle SOC & Range]'
      unique_id: [CHANGE_ME:evcc_vehicle_soc_and_range]
      command: |-
        data='{"password":"[CHANGE_ME:YourEVCCPassword]"}'; ip='http://[CHANGE_ME:YourEVCCServerIP]:7070';\
        c=$(curl -H 'Content-Type: application/json' -d $data -ksc - $ip/api/auth/login -o /dev/null);\
        echo "${c}" | curl -ksb - $ip/api/config/devices/vehicle/[CHANGE_ME:YourVehicleId]/status
      json_attributes_path: '$.result.range'
      json_attributes:
        - value
      value_template: '{{ value_json.result.soc.value | float }}'
      unit_of_measurement: '%'
      # the scan_interval will be specified in seconds...
      # for update every 5min use 300 (60sec * 5min = 300sec)
      # for update every 15min use 900 (60sec * 15min = 900sec)
      # for update every 1h use 3600 (60sec * 60min = 3600sec)
      # for update every 24h use 86400 (60sec * 60min * 24h = 86400sec)
      scan_interval: 900

Here is a complete example assuming:

  • that your vehicle_id is: ford_mach_e
  • the IP of your evcc server is: 192.168.2.213
  • the EVCC password is: myEvCCPwd and you want to capture the soc as main entity information and the range as additional attribute of the entity that will be requested every 5 minutes:
  - sensor:
      name: 'My Ford Mach-E SOC & Range'
      unique_id: evcc_mach_e_soc_and_range
      command: |-
        data='{"password":"myEvCCPwd"}'; ip='http://192.168.2.213:7070';\
        c=$(curl -H 'Content-Type: application/json' -d $data -ksc - $ip/api/auth/login -o /dev/null);\
        echo "${c}" | curl -ksb - $ip/api/config/devices/vehicle/ford_mach_e/status
      json_attributes_path: '$.result.range'
      json_attributes:
        - value
      value_template: '{{ value_json.result.soc.value | float }}'
      unit_of_measurement: '%'
      scan_interval: 300

Want to report an issue?

Please use the GitHub Issues for reporting any issues you encounter with this integration. Please be so kind before creating a new issues, check the closed ones, if your problem have been already reported (& solved).

To speed up the support process you might like already prepare and provide DEBUG log output. In the case of a technical issue, I would need this DEBUG log output to be able to help/fix the issue. There is a short tutorial/guide 'How to provide DEBUG log' here - please take the time to quickly go through it.

For this integration you need to add:

logger:
  default: warning
  logs:
    custom_components.evcc_intg: debug

Advertisement / Werbung - alternative way to support me

Switch to Tibber!

Be smart switch to Tibber - that's what I did in october 2023. If you want to join Tibber (become a customer), you might want to use my personal invitation link. When you use this link, Tibber will we grant you and me a bonus of 50,-€ for each of us. This bonus then can be used in the Tibber store (not for your power bill) - e.g. to buy a Tibber Bridge. If you are already a Tibber customer and have not used an invitation link yet, you can also enter one afterward in the Tibber App (up to 14 days). [see official Tibber support article]

Please consider using my personal Tibber invitation link to join Tibber today or Enter the following code: 6o0kqvzf (six, oscar, zero, kilo, quebec, victor, zulu, foxtrot) afterward in the Tibber App - TIA!


References

About

Home Assistant integration for evcc☀️🚘- optimized charging of electric vehicles, connecting your EV charger with your PV system. The integration use local polling (interval configurable) of the evcc API. Please note, that this integration is not official and not supported by the evcc developers. This project is not affiliated with evcc in any way.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages