CTEK Chargestorm EV-charger Intergration

Check of the broker in HA is connecting to localhost. I have notice that it changes sometimes. Try to connect to the broker with MQTT Explorer.

Thank you for the help, but as usual when you have a strange and difficult problem, the solution lie somewhere completely different.
Anyhow, problem solved!

Sharing my sensor config.
This is my sensors for CTEK, I made three groups, with first them main meter, then the EV Charger and finally the EV Status.
I did a workaround to handle if I got any misreading with a zero value in the energy consumption, since that difference will make the statistics unusable in the HA Energy metering tab, by giving you a kWh value of the total usage from your device, instead of only the delta for kWh used in one hour.
I solved this by using the previous reading, If I got a zero value.
I also translated to Swedish, but for those not fluent, I’m sorry, but her’s a short dictionary :slight_smile: :

  • Elcentral - Fusebox
  • Ström - Current
  • Effekt - Power
  • Fas - Power phase
  • Elbilsladdare - EV Charger
# Ctek, Chargestorm Car Charger
# Main Meter
- platform: mqtt
  name: "Elcentral Energikonsumtion [kWh]"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: >
    {% if value_json['energy'] == 0 %}
      {{ states('sensor.elcentral_energikonsumtion_kwh') }}
    {% else %}
      {{value_json['energy'] | multiply(0.001) | round | float }}
    {% endif %}
  unit_of_measurement: "kWh"
  state_class: "total_increasing"
  device_class: "energy"


- platform: mqtt
  name: "Elcentral Ström Fas 1"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['current'][0] | round(2) }}"
  unit_of_measurement: "A"
  state_class: "measurement"
  device_class: "current"
  
- platform: mqtt
  name: "Elcentral Ström Fas 2"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['current'][1] | round(2) }}"
  unit_of_measurement: "A"
  state_class: "measurement"
  device_class: "current"

- platform: mqtt
  name: "Elcentral Ström Fas 3"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['current'][2] | round(2) }}"
  unit_of_measurement: "A"
  state_class: "measurement"
  device_class: "current"
  
- platform: mqtt
  name: "Elcentral Volt Fas 1"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['voltage'][0] | round(2) }}"
  unit_of_measurement: "V"
  state_class: "measurement"
  device_class: "voltage"

- platform: mqtt
  name: "Elcentral Volt Fas 2"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['voltage'][1] | round(2) }}"
  unit_of_measurement: "V"
  state_class: "measurement"
  device_class: "voltage"
  
- platform: mqtt
  name: "Elcentral Volt Fas 3"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['voltage'][2] | round(2) }}"
  unit_of_measurement: "V"
  state_class: "measurement"
  device_class: "voltage"

- platform: mqtt
  name: "Elcentral Effekt"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['power'] | multiply(0.001) | round(2) | float }}"
  unit_of_measurement: "kW"
  state_class: "measurement"
  device_class: "power"
  
- platform: mqtt
  name: "Elcentral Frekvens"
  state_topic: "CTEK/CBID/mainMeter/em"
  value_template: "{{value_json['frequency'] | round(2) }}"
  unit_of_measurement: "Hz"
  icon: mdi:sine-wave
  state_class: "measurement"


# EV Charger
- platform: mqtt
  name: "Elbilsladdare Energikonsumtion [kWh]"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['energy'] | multiply(0.001) | round | float }}" 
  unit_of_measurement: "kWh"
  state_class: "total_increasing"
  device_class: "energy"
 
- platform: mqtt
  name: "Elbilsladdare Effekt"
  state_topic: "CTEK/CBID/evse1/em"
  unit_of_measurement: "W"
  state_class: "measurement"
  device_class: power
  value_template: "{{ value_json.power | round(2) }}"

- platform: mqtt
  name: "Elbilsladdare Ström Fas 1"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['current'][0] | round(2) }}"
  unit_of_measurement: "A"
  state_class: "measurement"
  device_class: "current"

- platform: mqtt
  name: "Elbilsladdare Ström Fas 2"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['current'][1] | round(2) }}"
  unit_of_measurement: "A"
  state_class: "measurement"
  device_class: "current"
  
- platform: mqtt
  name: "Elbilsladdare Ström Fas 3"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['current'][2] | round(2) }}"
  unit_of_measurement: "A"
  state_class: "measurement"
  device_class: "current"
  
- platform: mqtt
  name: "Elbilsladdare Volt Fas 1"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['voltage'][0] | round(2) }}"
  unit_of_measurement: "V"
  state_class: "measurement"
  device_class: "voltage"

- platform: mqtt
  name: "Elbilsladdare Volt Fas 2"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['voltage'][1] | round(2) }}"
  unit_of_measurement: "V"
  state_class: "measurement"
  device_class: "voltage"
  
- platform: mqtt
  name: "Elbilsladdare Volt Fas 3"
  state_topic: "CTEK/CBID/evse1/em"
  value_template: "{{value_json['voltage'][2] | round(2) }}"
  unit_of_measurement: "V"
  state_class: "measurement"
  device_class: "voltage"

# EV Status
- platform: mqtt
  name: "Elbilsladdare Status"
  icon: mdi:ev-station
  state_topic: "CTEK/CBID/evse1/status"
  value_template: "{% if value_json.state == 'AVAL' %}TillgÀnglig, ingen elbil ansluten.\
                   {% elif value_json.state == 'PAUS' %}Paus, laddstationen medger inte laddning.\
                   {% elif value_json.state =='EVRD' %}Elbilen Àr klar.\
                   {% elif value_json.state =='CHRG' %}Laddning pÄgÄr.\
                   {% elif value_json.state =='FLTY' %}FEL, nÄgot Àr felaktigt.\
                   {% elif value_json.state =='DSBL' %}Inaktiverad.\
                   {% elif value_json.state =='CONN' %}Elbilen Àr ansluten, vÀntar pÄ autentiering.\
                   {% elif value_json.state =='NCRQ' %}Ingen laddning efterfrÄgas av elbilen.\
                   {% elif value_json.state =='AUTH' %}Autentierad, vÀntar pÄ att elbilen skall enslutas.\
                   {% elif value_json.state =='INVL' %}Ogiltig, nÄgot Àr felaktigt.\
                   {% elif value_json.state =='GONE' %}Elbilen Àr frÄnkopplad.\
                   {% elif value_json.state =='DONE' %}Laddsessionen Àr avslutad.\
                   {% elif value_json.state =='SUHT' %}TillfÀlligt tillstÄnd för paus.\
                   {% elif value_json.state =='STHT' %}TillfÀlligt tillstÄnd för att stoppa laddsessionen.\
                   {% endif %}"

Hi,

Have now got access to CTEK GUI and have a question how you configured LAN access? Was it possible to enable LAN or WIFI without messing up 3G settings that is in use today? At least it is the way device communicate to cloud for me.

Best regards
Patric

Hi all.

Now there is a OCPP integration in HACS that has been verified with chargestorm connected 2. If using that it’s probably possible to use Node Red to manage smart charging :grinning: in other words load when solar panels are producing electricity.

Hi. I bought my from in Vattenfall InCharge but changed backend to CTEK. InCharge used 3G. But I installed a LAN cable aswelI. The default settings for LAN was DHCP so it worked straight away :wink: don’t think the LAN settings change the 3G/4G settings. But changing the OCPP will affect your communication.

Hi,

I’ve been reading data from my Chargestorm for a while now, but I can’t get any energy data any longer, the “em” topic is missing, I only have “meterinfo” under evse1 which only gives me the serialnumber.
What firmware are you on? I suspect that something has changed after an update, I’m on R3.11.22.

First of all, thanks a lot for a lot of help from this thread. Thanks to you guys here my Chargestorm Connected 2 is now visible with HA, very appreciated.

I also wonder if there is a way to start and stop the charging over MQTT from HA? I can’t use OCPP for that because it is being used between the charger and my Ferroamp EnergyHub. It would be amazing to be able to steer charging to the hours with the lowest price.

You actually don’t have to use OCPP to have load balancing with a Ferroamp EnergyHub, you can do load balancing with MQTT. Unfortunately there seems to be no way to control the CC2 from MQTT.

Which firmware version are you on? I have lost my energy meter data from MQTT.

Hi

Have you checked with MQTT Explorer?

Yes.
image

Hmm

Looks strange you should see the ev meter1 (and two if you have double connectors) and also the meter if you have loadbalancing.

If you use Taking Charge you can create a ticket to ctek in the App. I changed my backend from Vattenfall (InCharge) to ctek.

I don’t remember if there is a option for what to send in the CCU. Easiest is to connect the CCU to a computer and check the configuration.

Yeah, It’s really strange
 It’s been working fine previously. I’ve been connected to the charger with the USB-interface from my PC but I can’t really find any setting that seems incorrect. I also have a been in contact to the support but they claim nothing is wrong.

I have now set up to read some messages to HA, but I get an irritating error. every other second the values change between actual values and Unavailable. I use the MQTT broker in CTEK Chargestorm 2. Can it be a good idea to use an “external” MQTT Broker in HA?
SkÀrmbild 2023-01-24 183547
and one second later
SkÀrmbild 2023-01-24 183511

Du you use Wi-Fi or LAN to the equipmemt? How does it look in MQTT Explorer? Is the broker receiving messages without valuta? I have no problem at all. The equpmemt is LAN connected.

It’s connected by LAN. If I look in MQTT Explorer it’s almost the same and the values is “blinking”. I disabled it two days ago and enabled it again today and now it’s stable, so the issue is gone.

building on @toolonghere excellent template, here is the same using the new mqtt configuration

replace CBID with the station id of your charger. find it by listening to CTEK/# topics on the broker

mqtt:
  sensor:
    # Ctek, Chargestorm Car Charger
    # Main Meter
    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Energikonsumtion [kWh]'
      value_template: >
          {% if value_json['energy'] == 0 %}
            {{ states('sensor.elcentral_energikonsumtion_kwh') }}
          {% else %}
            {{value_json['energy'] | multiply(0.001) | round | float }}
          {% endif %}
      unit_of_measurement: 'kWh'
      state_class: 'total_increasing'
      device_class: 'energy'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Ström Fas 1'
      value_template: "{{value_json['current'][0] | round(2) }}"
      unit_of_measurement: 'A'
      state_class: 'measurement'
      device_class: 'current'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Ström Fas 2'
      value_template: "{{value_json['current'][1] | round(2) }}"
      unit_of_measurement: 'A'
      state_class: 'measurement'
      device_class: 'current'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Ström Fas 3'
      value_template: "{{value_json['current'][2] | round(2) }}"
      unit_of_measurement: 'A'
      state_class: 'measurement'
      device_class: 'current'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Volt Fas 1'
      value_template: "{{value_json['voltage'][0] | round(2) }}"
      unit_of_measurement: 'V'
      state_class: 'measurement'
      device_class: 'voltage'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Volt Fas 2'
      value_template: "{{value_json['voltage'][1] | round(2) }}"
      unit_of_measurement: 'V'
      state_class: 'measurement'
      device_class: 'voltage'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Volt Fas 3'
      value_template: "{{value_json['voltage'][2] | round(2) }}"
      unit_of_measurement: 'V'
      state_class: 'measurement'
      device_class: 'voltage'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Effekt'
      value_template: "{{value_json['power'] | multiply(0.001) | round(2) | float }}"
      unit_of_measurement: 'kW'
      state_class: 'measurement'
      device_class: 'power'


    - state_topic: 'CTEK/CBID/mainMeter/em'
      name: 'Elcentral Frekvens'
      value_template: "{{value_json['frequency'] | round(2) }}"
      unit_of_measurement: 'Hz'
      icon: mdi:sine-wave
      state_class: 'measurement'

    # EV Charger
    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Energikonsumtion [kWh]'
      value_template: "{{value_json['energy'] | multiply(0.001) | round | float }}"
      unit_of_measurement: 'kWh'
      state_class: 'total_increasing'
      device_class: 'energy'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Effekt'
      unit_of_measurement: 'W'
      state_class: 'measurement'
      device_class: power
      value_template: '{{ value_json.power | round(2) }}'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Ström Fas 1'
      value_template: "{{value_json['current'][0] | round(2) }}"
      unit_of_measurement: 'A'
      state_class: 'measurement'
      device_class: 'current'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Ström Fas 2'
      value_template: "{{value_json['current'][1] | round(2) }}"
      unit_of_measurement: 'A'
      state_class: 'measurement'
      device_class: 'current'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Ström Fas 3'
      value_template: "{{value_json['current'][2] | round(2) }}"
      unit_of_measurement: 'A'
      state_class: 'measurement'
      device_class: 'current'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Volt Fas 1'
      value_template: "{{value_json['voltage'][0] | round(2) }}"
      unit_of_measurement: 'V'
      state_class: 'measurement'
      device_class: 'voltage'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Volt Fas 2'
      value_template: "{{value_json['voltage'][1] | round(2) }}"
      unit_of_measurement: 'V'
      state_class: 'measurement'
      device_class: 'voltage'


    - state_topic: 'CTEK/CBID/evse1/em'
      name: 'Elbilsladdare Volt Fas 3'
      value_template: "{{value_json['voltage'][2] | round(2) }}"
      unit_of_measurement: 'V'
      state_class: 'measurement'
      device_class: 'voltage'


    # EV Status
    - state_topic: 'CTEK/CBID/evse1/status'
      name: 'Elbilsladdare Status'
      icon: mdi:ev-station
      value_template: "{% if value_json.state == 'AVAL' %}TillgÀnglig, ingen elbil ansluten.\
                       {% elif value_json.state == 'PAUS' %}Paus, laddstationen medger inte laddning.\
                       {% elif value_json.state =='EVRD' %}Elbilen Àr klar.\
                       {% elif value_json.state =='CHRG' %}Laddning pÄgÄr.\
                       {% elif value_json.state =='FLTY' %}FEL, nÄgot Àr felaktigt.\
                       {% elif value_json.state =='DSBL' %}Inaktiverad.\
                       {% elif value_json.state =='CONN' %}Elbilen Àr ansluten, vÀntar pÄ autentiering.\
                       {% elif value_json.state =='NCRQ' %}Ingen laddning efterfrÄgas av elbilen.\
                       {% elif value_json.state =='AUTH' %}Autentierad, vÀntar pÄ att elbilen skall enslutas.\
                       {% elif value_json.state =='INVL' %}Ogiltig, nÄgot Àr felaktigt.\
                       {% elif value_json.state =='GONE' %}Elbilen Àr frÄnkopplad.\
                       {% elif value_json.state =='DONE' %}Laddsessionen Àr avslutad.\
                       {% elif value_json.state =='SUHT' %}TillfÀlligt tillstÄnd för paus.\
                       {% elif value_json.state =='STHT' %}TillfÀlligt tillstÄnd för att stoppa laddsessionen.\
                       {% endif %}"


Yeastersay m I lost all MQTT values from the em340 in my central. So the loadbalancing didn’t work. After checking all cables and restarting the evse unit I restarted the whole house. The meter in my central was restarted and everything works again. That was kind of strange. Ctek support has never heard that the em340 modbus would hang. But perhaps there is a first time for everything. Has anyone else seen this behaviour with the em340 for loadbalancing?

I don’t think it has lost all values as in your case. What has happened is that the charger energy meter has reported 0 instead of the correct value, causing HA sensors to reset and energy panel to show wrong consumption (7000kWh charged in a month).