Summary
Here I have collected a selection of MQTT entities to include EVCC in HA. Also pay attention to the later messages with updates by others.
Updated configuration:
mqtt:
select:
- name: evcc_mode
unique_id: uniqueid__evcc_mode_select
icon: mdi:tune-variant
state_topic: "evcc/loadpoints/1/mode"
command_topic: "evcc/loadpoints/1/mode/set"
availability_topic: "evcc/status"
options:
- "off"
- "now"
- "minpv"
- "pv"
- name: evcc_phases
unique_id: uniqueid__evcc_phases_select
icon: mdi:backburger
state_topic: "evcc/loadpoints/1/phasesEnabled"
ā¦
Integration available
Since 2024-05 an integration is available! I recommend to use that one instead
Hey friends,
EVCC is a famous software to control your car charging at home. The software offers MQTT support and publishes a decent amount of data points.
Iād like to integrate those in Home Assistant. Did anyone already build the gross of MQTT sensor definitions? Would be great to exchange in this forum. In a few days time I might be able to build and publish a configuration myself.
Thanks and best!
3 Likes
s_ash
(sash)
April 10, 2022, 8:03pm
2
Hi Thom,
iām having the same question/issue and iām not sure as MQTT will be the best practive to integrate EVCC into HA.
EVCC is also able to get these walues per http request. Iāve never seen a simple sample to get that to my needsā¦
How is your progress? Have you integrated evcc already?
br
s_ash
Hey,
MQTT is well established in Home Assistant and I doubt integrating using the HTTP API would be easier. According to their documentation both solutions offer the same information and control: API | evcc - Sonne tanken āļøš
That said, yes! I defined a few entities and have some early use cases implemented for myself. Beware: My setup consists of one charger supporting 1P/3P switching with one car associated to it. However, the car is not supported by evcc, therefore no SoC specific entities in the code below. You certainly want to define these for your setup
Best, enjoy! Please share your modifications, additions, and improvements.
select:
- platform: mqtt
# EDIT: Please see updated code further down.
What I didnāt share are my german friendly names for these entities. One, because you might not find them useful, but secondly because I did not define a lot of them yet This would look like this:
homeassistant:
customize:
number.evcc_min_current:
friendly_name: "Garage Wallbox Minimale StromstƤrke"
select.evcc_mode:
friendly_name: "Garage EVCC Modus"
1 Like
Hi Thom,
thanks for sharing. Do you also have this setup to integrate into the energy dashboard of HA?
If so could you also share the yaml for that? For example the Battery sensor gives out a ā-ā reading on discharge and a ā+ā reading on charge. But HA expects to separate sensors for the battery charge.
In case someone was trying to set this up as well. I figured it out myself. Its pretty simple with some custom sensors
Hereās the yaml:
# evcc template
- sensor:
- name: "EVCC Battery Power Charging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, 0 - states('sensor.evcc_battery_power_w') | float(default=0)) }}"
- name: "EVCC Battery Power Discharging"
unit_of_measurement: W
device_class: power
state: "{{ max(0, states('sensor.evcc_battery_power_w') | float(default=0)) }}"
- name: "EVCC Energy Export"
unit_of_measurement: W
device_class: power
state: "{{ max(0, 0 - states('sensor.evcc_grid_power_w') | float(default=0)) }}"
- name: "EVCC Energy Import"
unit_of_measurement: W
device_class: power
state: "{{ max(0, states('sensor.evcc_grid_power_w') | float(default=0)) }}"
- name: "EVCC PV Generation"
unit_of_measurement: W
device_class: power
state: "{{ max(0, states('sensor.evcc_pv_power_w') | float(default=0)) }}"
#EVCC integration
- platform: integration
source: sensor.evcc_battery_power_charging
name: "EVCC Total Battery Energy Charged"
unit_prefix: k
method: left
- platform: integration
source: sensor.evcc_battery_power_discharging
name: "EVCC Total Battery Energy Discharged"
unit_prefix: k
method: left
- platform: integration
source: sensor.evcc_energy_import
name: "EVCC Grid Import"
unit_prefix: k
method: left
- platform: integration
source: sensor.evcc_energy_export
name: "EVCC Grid Export"
unit_prefix: k
method: left
- platform: integration
source: sensor.evcc_pv_generation
name: "EVCC PV Generation kwh"
unit_prefix: k
method: left
5 Likes
gelse
(Gelse)
July 3, 2022, 9:10am
6
you have a typo in uniqueid__evcc_pc_power_w
oh and ā¦
BIG thanks !
and what?
You are right, Iāve corrected the typo, even though it doesnāt really matter
Beware,
updates to the code above needed after https://github.com/evcc-io/evcc/pull/3714
Updated configuration:
mqtt:
select:
- name: evcc_mode
unique_id: uniqueid__evcc_mode_select
icon: mdi:tune-variant
state_topic: "evcc/loadpoints/1/mode"
command_topic: "evcc/loadpoints/1/mode/set"
availability_topic: "evcc/status"
options:
- "off"
- "now"
- "minpv"
- "pv"
- name: evcc_phases
unique_id: uniqueid__evcc_phases_select
icon: mdi:backburger
state_topic: "evcc/loadpoints/1/phasesEnabled"
command_topic: "evcc/loadpoints/1/phasesEnabled/set"
availability_topic: "evcc/status"
options:
- "0"
- "1"
- "3"
#############################################################################
sensor:
- name: evcc_charge_power_w
unique_id: uniqueid__evcc_charge_power_w
icon: mdi:car-electric
state_topic: "evcc/loadpoints/1/chargePower"
value_template: "{{ value | round(0) }}"
unit_of_measurement: "W"
state_class: measurement
availability_topic: "evcc/status"
- name: evcc_charged_energy_kwh
unique_id: uniqueid__evcc_charged_energy_kwh
icon: mdi:battery-charging-high
state_topic: "evcc/loadpoints/1/chargedEnergy"
value_template: "{{ (value | float / 1000) | round(4) }}"
unit_of_measurement: "kWh"
availability_topic: "evcc/status"
- name: evcc_charged_energy_self_kwh
unique_id: uniqueid__evcc_charged_energy_self_kwh
icon: mdi:battery-charging-high
state_topic: "evcc/site/savingsSelfConsumptionCharged"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "kWh"
availability_topic: "evcc/status"
- name: evcc_charged_energy_grid_kwh
unique_id: uniqueid__evcc_charged_energy_grid_kwh
icon: mdi:battery-charging-high
state_topic: "evcc/site/savingsGridCharged"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "kWh"
availability_topic: "evcc/status"
#############################################################################
- name: evcc_phases_active
unique_id: uniqueid__evcc_phases_active
icon: mdi:backburger
state_topic: "evcc/loadpoints/1/phasesActive"
value_template: "{{ value | round(0) }}"
availability_topic: "evcc/status"
- name: evcc_charge_duration_s
unique_id: uniqueid__evcc_charge_duration_s
icon: mdi:timer-settings-outline
state_topic: "evcc/loadpoints/1/chargeDuration"
value_template: "{{ value | round(0) }}"
unit_of_measurement: "s"
availability_topic: "evcc/status"
#############################################################################
- name: evcc_charge_current_l1_a
unique_id: uniqueid__evcc_charge_current_l1_a
icon: mdi:current-ac
state_topic: "evcc/loadpoints/1/chargeCurrents/l1"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "A"
availability_topic: "evcc/status"
- name: evcc_charge_current_l2_a
unique_id: uniqueid__evcc_charge_current_l2_a
icon: mdi:current-ac
state_topic: "evcc/loadpoints/1/chargeCurrents/l2"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "A"
availability_topic: "evcc/status"
- name: evcc_charge_current_l3_a
unique_id: uniqueid__evcc_charge_current_l3_a
icon: mdi:current-ac
state_topic: "evcc/loadpoints/1/chargeCurrents/l3"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "A"
availability_topic: "evcc/status"
#############################################################################
- name: evcc_pv_power_w
unique_id: uniqueid__evcc_pc_power_w
icon: mdi:home-lightning-bolt-outline
state_topic: "evcc/site/pvPower"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "W"
availability_topic: "evcc/status"
- name: evcc_battery_power_w
unique_id: uniqueid__evcc_battery_power_w
icon: mdi:home-lightning-bolt-outline
state_topic: "evcc/site/batteryPower"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "W"
availability_topic: "evcc/status"
- name: evcc_grid_power_w
unique_id: uniqueid__evcc_grid_power_w
icon: mdi:home-lightning-bolt-outline
state_topic: "evcc/site/gridPower"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "W"
availability_topic: "evcc/status"
- name: evcc_home_power_w
unique_id: uniqueid__evcc_home_power_w
icon: mdi:home-lightning-bolt-outline
state_topic: "evcc/site/homePower"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "W"
availability_topic: "evcc/status"
#############################################################################
- name: evcc_savings_self_consumption_percent
unique_id: uniqueid__evcc_savings_self_consumption_percent
icon: mdi:cash-multiple
state_topic: "evcc/site/savingsSelfConsumptionPercent"
value_template: "{{ value | round(1) }}"
unit_of_measurement: "%"
availability_topic: "evcc/status"
- name: evcc_savings_amount
unique_id: uniqueid__evcc_savings_amount
icon: mdi:cash-multiple
state_topic: "evcc/site/savingsAmount"
value_template: "{{ value | round(2) }}"
unit_of_measurement: "ā¬"
availability_topic: "evcc/status"
#############################################################################
binary_sensor:
- name: evcc_loadpoint_enabled
unique_id: uniqueid__evcc_loadpoint_enabled
icon: mdi:ev-station
state_topic: "evcc/loadpoints/1/enabled"
payload_on: "true"
payload_off: "false"
#device_class: problem
availability_topic: "evcc/status"
- name: evcc_loadpoint_connected
unique_id: uniqueid__evcc_loadpoint_connected
icon: mdi:ev-station
state_topic: "evcc/loadpoints/1/connected"
payload_on: "true"
payload_off: "false"
#device_class: problem
availability_topic: "evcc/status"
- name: evcc_loadpoint_charging
unique_id: uniqueid__evcc_loadpoint_charging
icon: mdi:ev-station
state_topic: "evcc/loadpoints/1/charging"
payload_on: "true"
payload_off: "false"
#device_class: problem
availability_topic: "evcc/status"
#############################################################################
number:
- name: evcc_min_current
unique_id: uniqueid__evcc_min_current
icon: mdi:current-ac
state_topic: "evcc/loadpoints/1/minCurrent"
command_topic: "evcc/loadpoints/1/minCurrent/set"
availability_topic: "evcc/status"
min: 6
max: 16
step: 0.25
unit_of_measurement: "A"
- name: evcc_max_current
unique_id: uniqueid__evcc_max_current
icon: mdi:current-ac
state_topic: "evcc/loadpoints/1/maxCurrent"
command_topic: "evcc/loadpoints/1/maxCurrent/set"
availability_topic: "evcc/status"
min: 6
max: 16
step: 0.25
unit_of_measurement: "A"
- name: evcc_buffer_soc
unique_id: uniqueid__evcc_buffer_soc
icon: mdi:label-percent-outline
state_topic: "evcc/site/bufferSoc"
command_topic: "evcc/site/bufferSoc/set"
availability_topic: "evcc/status"
min: 1
max: 100
unit_of_measurement: "%"
- name: evcc_priority_soc
unique_id: uniqueid__evcc_priority_soc
icon: mdi:label-percent-outline
state_topic: "evcc/site/prioritySoc"
command_topic: "evcc/site/prioritySoc/set"
availability_topic: "evcc/status"
min: 1
max: 100
unit_of_measurement: "%"
- name: evcc_residual_power
unique_id: uniqueid__evcc_residual_power
icon: mdi:label-percent-outline
state_topic: "evcc/site/residualPower"
command_topic: "evcc/site/residualPower/set"
availability_topic: "evcc/status"
min: -5000
max: +5000
unit_of_measurement: "W"
#############################################################################
homeassistant:
customize:
number.evcc_min_current:
friendly_name: "Garage Wallbox Minimale StromstƤrke"
select.evcc_mode:
friendly_name: "Garage EVCC Modus"
16 Likes
amann
(Korbinian Amann)
January 18, 2023, 3:01pm
11
Moin
Magst du mir sagen, wo die Config Schnipsel eingefĆ¼gt werden mĆ¼ssen ?
Danke fĆ¼r die Hilfe.
distel
January 21, 2023, 10:52am
13
Hi,
Is there a topic for t he batterySoC ?
In @ThomDietrich fist post there is betterySoC but I do not get values when I added
- name: evcc_battery_soc
unique_id: uniqueid__evcc_battery_soc
state_topic: "evcc/site/batterySoC"
icon: mdi:label-percent-outline
value_template: "{{ value | round(1) }}"
availability_topic: "evcc/status"
unit_of_measurement: "%"
Is there a way to find all topics published by evcc?
Thank you
letsid
EDIT:
I found the solution:
evcc/site/batterySoc
and not SoC
I used MQTT Explorer (as a Home Assistant add on) to look into the topics.
Here is the corrected sensor:
- name: evcc_battery_soc
unique_id: uniqueid__evcc_battery_soc
state_topic: "evcc/site/batterySoc"
icon: mdi:label-percent-outline
value_template: "{{ value | round(1) }}"
availability_topic: "evcc/status"
unit_of_measurement: "%"
2 Likes
They have changed a few API and MQTT names the last couple of releases. The screenshot in my first post should not be your reference
Checking the MQTT broker for published messages beyond what I use is anyhow a good idea. Any MQTT client will do the job. I can recommend MQTT Explorer.
1 Like
distel
January 21, 2023, 1:11pm
15
Thank you for your reply.
I did find mqtt explorer meanwhile and edited my question with the solution
Hi,
does anyone know, how to integrate the entire evcc webpage in the side panel as it is done when using the home assistant addon from evcc?
Leedrag
February 24, 2023, 10:51am
18
When putting it at the end of my evcc.yaml I got an error and evcc didnt start.
How should my evcc.yaml look like?
Let me rephrase that. You took a snippet of valid Home Assistant configuration and added it to the end of your evcc configuration. Hope you can hear the irony in this
What Iāve posted must be part of your Home Assistant configuration. The code must go in a file under <HomeAssistantConfig>/packages/evcc-or-similar-name.yaml
. In order to load that file you need to also enable packages in your <HomeAssistantConfig>/configuration.yaml
. Read:
Related to Packages as a default part of the yaml based configuration
Thx a lot. I have overlook your reply aboveā¦
It works nearly perfectly now. The only thing missing is that I canāt use the sensors for the energy dashboard. Is it only my problem or do we need to configure the sensors differently?
nicx
March 19, 2023, 9:16pm
21
any hint regarding the ha energy dashboard sensors asked by @Leedrag ?