Peblar Home EV Charger with Local REST API

updated the firmware (1.6.x) , now it works over wifi, got the installation adopted in HA

Funny, found out today that Peblar uses same API as Coolblue Bluebuilt which supposed to be selfbuild of Coolblue but appearantly uses same Firmware as Peblar. So thanks for all the work you already did, gonna help me a lot to integrate the Bluebuilt Charger into HAS

I also have a Eneco Connectric recently installed. It actually never worked, and Eneco just informed me they will replace it :slight_smile: If the new unit would not come with FW 1.6.x, I am wondering if it is worth updating myself. For me this is for a leasin car (Aplhabet) and hence I want to make sure my charging sessions are still going to be reimbursed. Is it the same for you, can you confirm this all works as intended if you manually update FW?

I am also wondering how it all works with the badge reader? If you connect the car and badge to start a session, will the session stay active if you stop the charging via HA? Can you simply resume charging without needing to badge again?

EDIT: someone knows of a list of error codes these chargers throw? I see the HA integration can read the error codes, so mine throws all kind of error codes (mostly er1400 & er1056), now I am wondering what they mean :wink:

Hi Dennis,

I have a VanMossel wallchasrger, which is also a white label Peblar.

Updating the charger to the latest Peblar was no issue, after updating reimbursing is still working.

The session will start as soon you start by using the badge, and will stop when you disconnect the cable. Starting and stopping charging by HA has no effect on this, HA is essentially only controlling the charge current.

Great to hear. In the mean time I also updated and can confirm it all works fine with Eneco also. Makes this integration really useful.

@frenck Thanks for the efforts! Looks really nice.
Set-up was a breeze as well! Some things not working (yet) but could be user error.

For reference if someone has a similar set-up. I’m using a ā€œchargepointā€ branded peblar running 1.7.0 firmware.
EV hasn’t been delivered yet at time of writing, so can’t comment on the sensor info yet.

  • The setting ā€œsmart chargingā€ can be set to default, fast solar, smart solar, pure solar and scheduled. Charger correctly changes the setting.
  • restart works.
  • Charge limit does not respond. The charger doesn’t update when changing it in home assistant and home assistant doesn’t update when changing it on the charger.

@frenck I do have a question though.
The ā€œSolar Charging measurement sourceā€ is disabled as it was not set-up by the installer. Do you know if I can get the info from home assistant, or if I’m forced to go the homewizard route. I’ll need to contact Chargepoint anyhow as setting the solar charging measurement source involves recommissioning.

As it’s a company charger, I’m not allowed to recommission or perform a factory reset. Otherwise if you want to test some stuff, feel free to contact me.

Hi,

The charge limit does work, but as mentioned some posts above, there are actually 2 ā€œcharge limitsā€. In the Peblar web interface, you can set a ā€œhardā€ charge limit, meaning an absolute limit which the charger should never ever cross to avoid tripping your circuit breaker. Next to that, there is the actual charge current you can limit during a charging session, more dynamically. The ā€œcharge limitā€ you can adjust in home assistant is the latter one. Start a charging session and change the charge limit number and you will see the power delivered to your car drop. You will also see this reflected in the peblar webinterface when looking at the actual charging session.

I know it is a bit confusing, but it does actually work and does what it is supposed to do. I have an automation running that continuously adjusts the charge limit to implement my own version of ā€œsolar chargingā€ by adjusting the ā€œcharge limitā€ via home assistant and it works perfect. The reason I don’t rely on the built-in solar charging is that it has no knowledge of my home battery and the ā€œsolar chargingā€ has hence no way of knowing if the power delivered to the charger is coming form my solar panels or from my home battery. Hence it tends to fully drain the home battery, which is not what I want. Home assistant knows all and can implement much smarter control :smiley:

1 Like

Hi tjafbe,

Thanks for the clarification. That makes a lot of sense. As I’ve said above, I haven’t had my car delivered yet, so no way to test the charging sessions yet.

Would you mind sharing your own setup of the solar charging? I believe I have a pretty similar setup to you and I feel it would be a good source of inspiration to see how someone else solves it.

Thanks in advance!

Sure, I am willing to share, though I am certain I probably violate quite a few good, common coding practices :slight_smile:

Anyway, before diving into my own -probably very messy - code, you might prefer to simply install via HACS the evcc-io add-on (GitHub - marq24/ha-evcc: 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.) ? I do not have any personal experience, I just recently found out about it, and I think it could probably do all the below and probably better than I do?

Anyway, my logic is as follows:

  1. I want to always make sure at the end of the (solar) day my home battery is as full as possible so I can get through the evening/night without having to draw from the grid. This has priority over charging my EV. I have switches to force charging if needed. I have no logic for minimum EV charge to maintain, though that could be added for sure.
  2. Minimizing how much I draw from the grid has for me higher priority than trying to maximize my own solar use. This means that my logic favors slightly to inject into, rather than draw from the grid. You might have different priorities.
  3. I always charge the home battery first to 20%.
  4. When the home battery has reached 20%, I divide the solar power (minus house consumption) between home battery and EV with a predetermined 1500W reserved to charge the home battery and the remainder goes to the EV. You will need to adjust for what works for you.
  5. When the home battery reached 95%, I divert almost all solar to the car.

To achieve this, I have 2 helpers:

  • input_boolean.car_force_charging: If this is on, this automation doesn’t run. This when I just need to charge the car no matter what.
  • input_boolean.solar_charge_car_first: when this is on, it will immediately start charging the EV when there is sufficient solar, and won’t first try to charge the home battery. I use this when I know I will take the car early in the morning for example.

I have a template sensor (sensor.solar_production_remaining_excl_home_battery_charge) that calculates at any point in time how much excess solar I will have. This is based on solar forecast data (I use open-meteo), how empty my home battery is and my average house consumption. This is really approximate, but it works for my purposes. I need 9kWh to fully charge my home battery, that is the number 9 in my template sensor.

- platform: template
   solar_production_remaining_excl_home_battery_charge:
      value_template: "{{ (states('sensor.energy_production_today_remaining')|int - ((100-states('sensor.battery_state_of_charge') | int)/100*9) - (0.5*(18*60 - as_timestamp(now()) |timestamp_custom('%H',false) |int * 60 - as_timestamp(now()) |timestamp_custom('%M',false) |int)/60)) | round(1) }}"
      unit_of_measurement: "kWh"
      friendly_name: "Excess solar"

My automation is below. A few important notes:

  1. I use statistics to apply a smoothing filter to solar and house consumption (EDIT: it is better not to apply smoothing to house consumption IF this sensor also includes the charger consumption since that tends to lead to oscillations). It doesn’t need to be exact anyway as my home battery can compensate if there is a cloud passing by, or I brew a cup of coffee.
  2. I just trigger every minute. This is likely not good coding practice. Again my battery takes care of small fluctuations anyway.
  3. I reserve a fixed 1500W to charge the home battery when it is below 95%. I switch to just 50W when it has reached 95%. This is anyway an approximation since I trigger only once a minute and use smoothed data. So the actual power going to the home battery can deviate a lot. You could make this an input number or slider if you want more flexibility.
  4. My house consumption INCLUDES the EV peblar charger. So when calculating how much extra solar power I have at any given point of time, I need to ADD whatever the peblar charger is already consuming at that time.
  5. You have to set the CURRENT limit in the peblar charger, so I need to divide the power calculation by the line voltage to get to current.
  6. My inverter cannot deliver more than 5200W, so no matter what, the current should never be larger than 20A.
alias: EV solar charging
triggers:
  - trigger: time_pattern
    minutes: /1
conditions:
  - condition: or
    conditions:
      - condition: state
        entity_id: sensor.peblar_ev_charger_state
        state: suspended
      - condition: state
        entity_id: sensor.peblar_ev_charger_state
        state: charging
  - condition: not
    conditions:
      - condition: state
        entity_id: input_boolean.car_force_charging
        state: "on"
actions:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: and
                conditions:
                  - condition: state
                    entity_id: input_boolean.solar_charge_car_first
                    state: "off"
                  - condition: numeric_state
                    entity_id: sensor.battery_state_of_charge
                    above: 94.9
                  - condition: template
                    value_template: >
                      {{ ((states.sensor.pv_power_statistics.state|int  -
                      states.sensor.house_consumption.state|int +
                      states.sensor.peblar_ev_charger_power.state|int - 50) /
                      states.sensor.on_grid_l1_voltage.state|float) > 6 }}
                  - condition: numeric_state
                    entity_id: sensor.solar_production_remaining_excl_home_battery_charge
                    above: 1
              - condition: and
                conditions:
                  - condition: state
                    entity_id: input_boolean.solar_charge_car_first
                    state: "on"
                  - condition: numeric_state
                    entity_id: sensor.solar_production_remaining_excl_home_battery_charge
                    above: 3
                  - condition: template
                    value_template: >
                      {{ ((states.sensor.pv_power_statistics.state|int  -
                      states.sensor.house_consumption.state|int +
                      states.sensor.peblar_ev_charger_power.state|int - 50) /
                      states.sensor.on_grid_l1_voltage.state|float) > 6 }}
        sequence:
          - action: number.set_value
            metadata: {}
            data_template:
              value: >-
                {{ [20,((states.sensor.pv_power_statistics.state|int  -
                states.sensor.house_consumption.state|int +
                states.sensor.peblar_ev_charger_power.state|int - 50) /
                states.sensor.on_grid_l1_voltage.state|float)]|min | round(1)}}
            target:
              entity_id: number.peblar_ev_charger_charge_limit
      - conditions:
          - condition: numeric_state
            entity_id: sensor.solar_production_remaining_excl_home_battery_charge
            above: 3
          - condition: numeric_state
            entity_id: sensor.battery_state_of_charge
            below: 95
            above: 20
          - condition: template
            value_template: >
              {{ ((states.sensor.pv_power_statistics.state|int  -
              states.sensor.house_consumption.state|int +
              states.sensor.peblar_ev_charger_power.state|int - 1500) /
              states.sensor.on_grid_l1_voltage.state|float) > 6 }}
          - condition: state
            entity_id: input_boolean.solar_charge_car_first
            state: "off"
        sequence:
          - action: number.set_value
            metadata: {}
            data_template:
              value: >-
                {{ [20,((states.sensor.pv_power_statistics.state|int  -
                states.sensor.house_consumption.state|int +
                states.sensor.peblar_ev_charger_power.state|int - 1500) /
                states.sensor.on_grid_l1_voltage.state|float)]|min| round(1) }}
            target:
              entity_id: number.peblar_ev_charger_charge_limit
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.peblar_ev_charger_charge
    default:
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.peblar_ev_charger_charge

This works reasonably well for me, though I still inject a few kWh per day. This is fine for me. And I probably should look into evcc-io :smiley:

1 Like

Hello I’ve opened a feature request to be able to set the charge limit in miliAmpere, as API describes.