Peblar Home EV Charger with Local REST API

Good evening,

I was already looking for while for an EV Walbox that could be quite easily controlled local by Home Assistant.
I found the Peblar Home and this device has the possibility to use a local REST API or MODbus API.
I am not a programmer but with some ChatGPT help(:wink:) I got it it running!
Unfortunate there is no Integration available but it wasn’t too difficult

Below link for the API details:
https://developer.peblar.com/

very cool! any chance you will publish the code as an addon? I’m thinking of buying a charger from Peblar.

yes of course! it is just a YAML file. I created a separate yaml file (peblar_charger.yaml) instead of putting it in my configuration file. this to keep the configuration file clean.

you can simply create this yaml file and add below to your configuration.yaml file:

homeassistant:
packages:
peblar_charger: !include peblar_charger.yaml

below the configuration for the Peblar REST API, I saved this as peblar_charger.yaml

#Key Configuration Elements:
# REST Sensors: These sensors retrieve data from the API endpoints and display it in Home Assistant. Replace <local_ip> with your device’s IP address and <your_api_token> with the actual token.
# REST Command: This allows you to change settings via the API, such as setting the charge current limit.
# Input Number & Automation: This example uses an input_number to set the charge current limit and an automation that triggers the REST command when the value changes.
#
# Customization:
# Modify the scan intervals as necessary.
# Add more sensors or commands based on other available API endpoints.

rest:
  # /// adjust here your local IP & API Token ///
  - resource: http://<local_ip>/api/wlac/v1/system
    scan_interval: 5
    headers:
      Authorization: "<your_api_token>"
    sensor:
      - name: "Charger Product Number"
        value_template: "{{ value_json.ProductPn }}"
      - name: "Charger Serial Number"
        value_template: "{{ value_json.ProductSn }}"
      - name: "Charger Firmware Version"
        value_template: "{{ value_json.FirmwareVersion }}"
      - name: "WLAN Signal Strength"
        value_template: "{{ value_json.WlanSignalStrength }}"
        unit_of_measurement: "dBm"
      - name: "Cellular Signal Strength"
        value_template: "{{ value_json.CellularSignalStrength }}"
        unit_of_measurement: "dBm"
      - name: "Charger Uptime"
        value_template: "{{ value_json.Uptime }}"
        unit_of_measurement: "s"
      - name: "Phase Count"
        value_template: "{{ value_json.PhaseCount }}"
      - name: "Force 1 Phase Allowed"
        value_template: "{{ value_json.Force1PhaseAllowed }}"
      - name: "Active Error Codes"
        value_template: "{{ value_json.ActiveErrorCodes }}"
      - name: "Active Warning Codes"
        value_template: "{{ value_json.ActiveWarningCodes }}"

  # /// adjust here your Local IP & API Token ///
  - resource: http://<local_ip>/api/wlac/v1/evinterface
    scan_interval: 5
    headers:
      Authorization: "<your_api_token>"
    sensor:
      - name: "Control Pilot State"
        value_template: "{{ value_json.CpState }}"
      - name: "Socket Lock State"
        value_template: "{{ value_json.LockState }}"
      - name: "Charge Current Limit"
        value_template: "{{ value_json.ChargeCurrentLimit }}"
        unit_of_measurement: "mA"
      - name: "Charge Current Limit Source"
        value_template: "{{ value_json.ChargeCurrentLimitSource }}"
      - name: "Charge Current Limit Actual"
        value_template: "{{ value_json.ChargeCurrentLimitActual }}"
        unit_of_measurement: "mA"
      - name: "Force 1 Phase"
        value_template: "{{ value_json.Force1Phase }}"

  # /// adjust here you Local IP & API token ///
  - resource: http://<local_ip>/api/wlac/v1/meter
    scan_interval: 5
    headers:
      Authorization: "<your_api_token>"
    sensor:
      - name: "Current Phase 1"
        value_template: "{{ value_json.CurrentPhase1 }}"
        unit_of_measurement: "mA"
      - name: "Current Phase 2"
        value_template: "{{ value_json.CurrentPhase2 }}"
        unit_of_measurement: "mA"
      - name: "Current Phase 3"
        value_template: "{{ value_json.CurrentPhase3 }}"
        unit_of_measurement: "mA"
      - name: "Voltage Phase 1"
        value_template: "{{ value_json.VoltagePhase1 }}"
        unit_of_measurement: "V"
      - name: "Voltage Phase 2"
        value_template: "{{ value_json.VoltagePhase2 }}"
        unit_of_measurement: "V"
      - name: "Voltage Phase 3"
        value_template: "{{ value_json.VoltagePhase3 }}"
        unit_of_measurement: "V"
      - name: "Power Phase 1"
        value_template: "{{ value_json.PowerPhase1 }}"
        unit_of_measurement: "W"
      - name: "Power Phase 2"
        value_template: "{{ value_json.PowerPhase2 }}"
        unit_of_measurement: "W"
      - name: "Power Phase 3"
        value_template: "{{ value_json.PowerPhase3 }}"
        unit_of_measurement: "W"
      - name: "Total Power"
        value_template: "{{ value_json.PowerTotal }}"
        unit_of_measurement: "W"
      - name: "Total Energy"
        value_template: "{{ value_json.EnergyTotal }}"
        unit_of_measurement: "Wh"
      - name: "Session Energy"
        value_template: "{{ value_json.EnergySession }}"
        unit_of_measurement: "Wh"

# Example of using the Patch method to set the charge current limit
# /// adjust here your local IP & API token
rest_command:
  set_charge_current_limit:
    url: "http://<local_ip>/api/wlac/v1/evinterface"
    method: patch
    headers:
      Authorization: "<your_api_token>"
    content_type: "application/json"
    payload: '{"ChargeCurrentLimit": {{ charge_current_limit }} }'

#  set_charge_current_limit_next_session:
#    url: "http://<local_ip>/api/wlac/v1/evinterface"
#    method: patch
#    headers:
#      Authorization: "<your_api_token>"
#    content_type: "application/json"
#    payload: '{"ChargeCurrentLimit": 6000}'

# Define REST commands for starting and stopping charging
#rest_command:
  start_charging:
    url: "http://<local_ip>/api/wlac/v1/evinterface"
    method: patch
    headers:
      Authorization: "<your_api_token>"
    content_type: "application/json"
    payload: '{"ChargeCurrentLimit": 16000}'  # Example value in milliAmps

  stop_charging:
    url: "http://<local_ip>/api/wlac/v1/evinterface"
    method: patch
    headers:
      Authorization: "<your_api_token>"
    content_type: "application/json"
    payload: '{"ChargeCurrentLimit": 0}'  # Setting current to 0 to stop charging

# Define a template switch for starting and stopping charging
switch:
  - platform: template
    switches:
      ev_charging:
        friendly_name: "EV Charging"
#        value_template: "{{ is_state('sensor.control_pilot_state', 'State C') }}"  # Check if charging is ongoing
        turn_on:
          service: rest_command.start_charging
        turn_off:
          service: rest_command.stop_charging

input_number:
  charge_current_limit:
    name: "Charge Current Limit"
    initial: 16000
    min: 0
    max: 16000
    step: 1000

automation:
  - alias: "Peblar Charge Current Limit"
    trigger:
      platform: state
      entity_id: input_number.charge_current_limit
    action:
      service: rest_command.set_charge_current_limit
      data_template:
        charge_current_limit: "{{ states('input_number.charge_current_limit') | int }}"
1 Like

Awesome! Thanks for sharing :slight_smile:

CC @frenck because I saw on Insta that he bought the same charger.

Thank you! Got the charger yesterday and up and running quickly thanks to you! (I had to upgrade firmware first)

Might I suggest to change these sensors as follows? That way you can track them in the Energy Dashboard!

    - name: "Peblar Total Energy"
      value_template: "{{ value_json.EnergyTotal }}"
      device_class: "energy"
      unit_of_measurement: "Wh"
      state_class: "total"
    - name: "Peblar Session Energy"
      value_template: "{{ value_json.EnergySession }}"
      unit_of_measurement: "Wh"
      state_class: "total_increasing"
      device_class: "energy"

Additionally, I for the slider, I prefer watts over Wh. However the API doc requires mA.

ChargeCurrentLimit integer

The maximum current per phase indicated towards the EV in milliAmpere by this API. Note that other factors can cause an even lower limit (e.g. thermal or dynamic load balancing).

However, somehow I have more feel with ‘3000’ watts then say 16000mA, so I did the following to have a better understanding with the limit:

rest_command:
  set_charge_current_limit:
    url: "http://192.168.2.128/api/wlac/v1/evinterface"
    method: patch
    headers:
      Authorization: "X"
    content_type: "application/json"
    payload: >
      {
        "ChargeCurrentLimit": {{ (states('input_number.charge_current_limit') | float / 230 * 1000) | int }}
      }

and:

input_number:
  charge_current_limit:
    name: "Charge Current Limit (Watts)"
    initial: 3680  # Equivalent to 16000 mA at 230V (16000 mA * 230V / 1000 = 3680W)
    min: 0
    max: 3680  # Max value for 16000 mA at 230V
    step: 100
    unit_of_measurement: W

Adding my current dashboard:

I update the api based when the slider changes:


alias: Peblar change speed when changing input
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_number.charge_current_limit
conditions: []
actions:
  - action: rest_command.set_charge_current_limit
    metadata: {}
    data: {}
mode: single

automations can be based on current tarrif, for example like this:

alias: Peblar Charge Current Limit - low
triggers:
  - entity_id:
      - input_boolean.peblar_charge_only_low_tarrif
    trigger: state
    from: "off"
    to: "on"
  - trigger: state
    entity_id:
      - sensor.zonneplan_current_tariff_group
    to: low
conditions:
  - condition: state
    entity_id: input_boolean.peblar_charge_only_low_tarrif
    state: "on"
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.zonneplan_current_tariff_group
        state: Low
actions:
  - action: input_number.set_value
    metadata: {}
    data:
      value: 3400
    target:
      entity_id: input_number.charge_current_limit


1 Like

@neu Good to hear you have it running👍🏻
Energy meters are a nice addition indeed. In my setup I have a separate kWh meter that I use for the energy dash.

I also use the charger in combination with dynamic energy pricing so I can charge at cheap rates. This required an automation that when I connect my car it will pauze the session till my dynamic price integration decides to start it again

By doing so I am no longer depending on the online services of my car to start / stop charging

1 Like

I am considering this charger as well, but I am not using HA but Domoticz and I am looking a the Modbus interface. But this has similar functions as this REST api.
How did you integrate price automation? Can you also change the charging mode between: time schedule, solar, load balancing?
My idea is to set the charger in a solar mode during the day, but change to time/price schedule after sunset. With this setup the car is charged during the day (when it is at home or when I get home) if there is sun. It takes the power what would be send back to the grid otherwise.
Am I correct you use the current limit to start/pause charging?

Hi,
As far as I know you can’t change the charge mode through MOD bus or REST API.
You can indeed start/stop the charging by changing the Current Limit setting. It is not very well described in the documentation but if you set a value below 6A it will stop charging. Anything above will start it.

Last Friday I received my Peblar charger, thanks with this thread everything up and running now!

Integrated it with EVCC and HomeAssistant, so can schedule it now based on solar charging or lowest dynamic prices. If you are interested integrating EVCC you can have a look here: https://github.com/hencou/ha-evcc-peblar

[edit] Got it working;

  • Configuration.yaml lines need to be indented. Just copying them from the post will result in an error that the integration is not found
  • Reloading YAML will not suffice, you need to restart
  • The sensor names as in the example do not contain Peblar, making them hard to find and identify
  • The sensors show under the Rest integration

Dear Floppus,

I’m quite new to the whole Home Assistant environment although I’ve managed to get a lot of stuff working. I can’t figure out though how to get my Peblar charger working in Home Assistant. Could you please explain to a beginner on how to do this? Thank you very much in advance.

Are you using the charger only in a scheduled time mode, I mean you are not using the builtin Solar modes? Based on the rates you switch it on.
Or did you built you own solar mode, so based on what the panels deliver (above a certain level) you switch the charger on/off. Or is the current limit not meant for this as this will switch it on/off multiple times during the day?
Does the charger require you to use the RFID card to start it or can you use it without it.

I’m only using it direct. Without the RFID card and builtin solar modes.