A Home Assistant integration for monitoring EnBW electric vehicle charging stations in Germany and tracking how green the energy is when charging your EV.
- Car Green-Charging Tracker: Add your car and its GPS tracker to see live CO₂ intensity and accumulated charging stats using the Electricity Maps Home Assistant integration
- Persistent Accumulators: Energy, CO₂, and cost totals survive Home Assistant restarts — nothing is lost
- Proximity-Based Billing: Costs are automatically billed when the car is near a configured station. One-off session base fees are applied once per session start; per-kWh cost accrues continuously
- Multiple Station Types: EnBW public stations, custom home wallboxes, and temporary one-off stops — all handled with accurate billing
- Auto-Discovery: Optionally let SmartCharge detect nearby EnBW stations automatically while the car is charging and prompt you to add them
- Easy Configuration: Search nearby stations on a map or enter a station ID directly — one config entry per station
- Custom Friendly Name: Set a custom static part of the sensor's friendly name during setup or reconfiguration
- Single Entity per Station: One sensor per station showing
availableoroccupied, with a dynamic name like2 / 5 - StationName. For stations with more than 9 charge points, the available count is spaced (e.g.1 0 / 10 - StationName) - Charge Point Details: Every charge point's status, power, and connector type exposed as entity attributes
- Occupancy Tracking: Persistent occupancy histograms by hour-of-day and weekday, accumulating over time and surviving restarts
- Map Integration: GPS coordinates as attributes so the sensor appears on the HA map
- Click the badge above, or go to HACS → Integrations → search for "SmartCharge"
- Install the integration
- Restart Home Assistant
- Download the integration files into your
custom_componentsdirectory:custom_components/smartcharge/ - Restart Home Assistant
- Go to Settings → Devices & Services
- Click "Add Integration"
- Search for "SmartCharge"
- Choose what to add: a Car (green-charging tracker) or a Charging Station
- Enter a Car Name, the Car Device Tracker entity, the Charging Power sensor entity (in kW), an optional Odometer sensor (in km, for per-km stats), and the CO₂ Intensity entity (e.g. from the Electricity Maps integration — auto-selected if found)
Six sensors are created and grouped under a single device named after the car.
To track multiple cars, add the integration once per car.
Choose from five station types:
Drag the map pin to your area, adjust the radius, pick a station from the results, and configure the update interval and tariff.
Manually look up a station on the EnBW map and enter its ID.
Search for an EnBW station at the car's current GPS position. The search expands from 50 m → 100 m → 200 m until a station is found.
Register a one-off charging stop using the car's current GPS position as the station location. The entry is automatically deleted once the car's odometer increases — i.e., after driving away. Requires at least one car entry to be configured.
Add a fixed wallbox at the car's current GPS location. Provide a live price entity (ct/kWh) and optionally a live CO₂ intensity entity (gCO₂/kWh). When a CO₂ entity is provided it takes priority over the car's configured CO₂ entity. Requires at least one car entry to be configured.
Note: Temporary stations and wallboxes create a lightweight config entry with no sensor entities. They exist solely to supply location and tariff data to the car tracker's proximity-billing logic.
When Automatically discover charging stations while charging is enabled in the car options, SmartCharge will search for nearby EnBW stations each time the car starts charging at an unrecognised location. If stations are found, a notification appears in the HA UI prompting you to add the station permanently. Only one discovery attempt is made per charging session.
When you add a Car config entry, SmartCharge creates a device grouping six sensors per car. All sensors update together every poll cycle (≈ 5 minutes).
| Sensor | State | Unit | Icon |
|---|---|---|---|
| CO2 Intensity | Live grid CO₂ at the car's GPS location | gCO₂/kWh | mdi:molecule-co2 |
| Accumulated Energy | Total kWh charged (persisted across restarts) | kWh | mdi:ev-station |
| Accumulated CO2 | Total gCO₂ produced for that energy (persisted) | gCO₂ | mdi:smog |
| Accumulated Cost | Total charging cost — proximity billing (persisted) | EUR | mdi:currency-eur |
| CO2 per km | Average gCO₂ per km driven (requires odometer) | gCO₂/km | mdi:leaf |
| Cost per km | Average charging cost per km driven | EUR/km | mdi:cash-marker |
The CO2 Intensity sensor has no additional attributes. CO₂ and cost accumulators are persisted across restarts.
When the car is within range of a configured station that has a tariff set, charging costs are billed automatically:
- A base fee (if configured) is added once when a new charging session begins
- A per-kWh cost accrues continuously while charging at that station
- A billing session ends when power drops to zero or the car moves away
For wallboxes, the price is read live from the configured price entity each poll cycle.
For temporary stations, the tariff is fixed at the time of adding.
Use the integration entry → Reconfigure to update the car name, device tracker, power sensor, odometer sensor, CO₂ intensity entity, or auto-discovery toggle. The same settings are also accessible under Configure (Options).
If you prefer to enter a station ID directly, you can find it using your browser's developer tools:
- Open the EnBW charging map
- Open your browser's developer tools (press
F12), then go to the Network tab - Click on a charging station on the map
- In the Network tab, look for a request to the EnBW API, e.g.:
https://enbw-emp.azure-api.net/emobility-public-api/api/v1/chargestations/134057 - The number at the end of the URL (e.g.
134057) is the station ID
Tip: You can also find the API subscription key in the request headers under
Ocp-Apim-Subscription-Keyif you want to set a manual key in the integration options.
Each config entry creates a device in HA. Going to Settings → Devices & Services → SmartCharge shows a device card per car or station.
- Car device: named after the car name you entered during setup. Independent top-level device.
- SmartCharge hub device: a single parent device created automatically when you add your first charging station.
- Station devices: each station is a child of the SmartCharge hub, named after its static friendly name (e.g.
MVV_station_829151). Clicking the hub shows all stations underneath it.
Temporary stations and wallboxes have no associated sensor entities or device card — they are configuration-only entries invisible on the Devices page.
See the Car Tracking section above.
- State:
available(at least one charge point is free) oroccupied(all charge points in use) - Dynamic Name: Updates to show availability, e.g.
2 / 5 - Hauptstraße 10, Stuttgart. For stations with more than 9 charge points, the available count is spaced (e.g.1 0 / 10 - StationName). - Icon: Switches between
mdi:ev-stationandmdi:ev-station-unavailable
total_charge_points: Total number of charge points at the stationavailable_count: Number of currently available charge pointsoccupied_count: Number of currently occupied charge pointslatitude/longitude: GPS coordinates (enables map display)address: Physical address- Per charge point (keyed by EVSE ID): Status, power in kW, and connector type, e.g.
available | 50 kW | CCS occupancy_weekday: Average occupancy % by day of week (accumulated over time)occupancy_hourly: Average occupancy % by hour of day (accumulated over time)
| Entry type | Reconfigure | Options (Configure) |
|---|---|---|
| Car | Car name, tracker, power sensor, odometer, CO₂ entity, auto-discovery | CO₂ entity, auto-discovery |
| EnBW Station | Update interval, friendly name, tariff | Update interval, API key mode, tariff |
| Wallbox | Price entity, CO₂ entity | Price entity, CO₂ entity |
| Temporary Station | Tariff price, base fee | Tariff price, base fee |
You can visualize the occupancy data as color-coded bar charts using the Plotly Graph Card (install via HACS → Frontend).
type: custom:plotly-graph
raw_plotly_config: true
defaults:
entity:
type: bar
showlegend: false
marker:
colorscale: Portland
cmin: 0
cmax: 100
xaxes:
type: category
showgrid: true
yaxes:
range: [0, 100]
title: Occupancy %
dtick: 25
showgrid: true
entities:
- entity: &station sensor.YOUR_STATION_availability
name: Hourly
x: $ex Object.keys(meta.occupancy_hourly || {})
"y": $ex Object.values(meta.occupancy_hourly || {})
marker:
color: $ex Object.values(meta.occupancy_hourly || {})
- entity: *station
name: Weekly
x: $ex Object.keys(meta.occupancy_weekday || {})
"y": $ex Object.values(meta.occupancy_weekday || {})
xaxis: x2
yaxis: y2
marker:
color: $ex Object.values(meta.occupancy_weekday || {})
layout:
title: Station Occupancy
height: 500
grid:
rows: 2
columns: 1
subplots: [[xy], [x2y2]]
roworder: top to bottom
xaxis:
dtick: 2Note: Replace
sensor.YOUR_STATION_availabilitywith your actual station entity ID. The YAML anchor (&station/*station) ensures the entity is defined only once. Themetavariable provides direct access to the entity's attributes. Bar colors follow a continuous gradient (Portland colorscale) from low (blue) to high (red) occupancy. Other built-in colorscales:Jet,RdYlGn_r,YlOrRd,Viridis— see Plotly colorscales.
service: smartcharge.refresh_dataautomation:
- alias: "Notify when charging station available"
trigger:
platform: state
entity_id: sensor.my_station_availability
to: "available"
action:
- service: notify.mobile_app_phone
data:
title: "Charging Station Available"
message: >
{{ state_attr('sensor.my_station_availability', 'available_count') }}
charge point(s) now free!- Check that your station ID is correct on the EnBW map
- Verify internet connectivity
- Review Home Assistant logs for errors (
custom_components.smartcharge)
If you see electricityMap returned HTTP 401 in the logs, your API key is invalid or expired. Update it via Settings → Devices & Services → SmartCharge → Reconfigure (or Configure) on the car entry. The warning is logged once and then suppressed until the key is updated.
Energy, CO₂, and cost accumulators are persisted to .storage/smartcharge.car.<entry_id> and survive restarts. If values appear to reset, check that the .storage folder is writable and not excluded from your backup strategy.
- Check the update interval setting in the integration options
- Verify the API is accessible
- Restart the integration
For a local non-Docker approximation of the CI checks, run:
python scripts/validate_local.pyThe script validates JSON metadata, checks that strings.json and translations/en.json stay in sync, and runs black --check plus flake8.
For community discussions:
MIT License - See LICENSE file for details
For issues and feature requests, please open an issue.
