PNC
(Pieter)
September 26, 2024, 7:53pm
1
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( ) 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/
neu
(neu)
September 29, 2024, 5:26am
2
very cool! any chance you will publish the code as an addon? I’m thinking of buying a charger from Peblar.
PNC
(Pieter)
September 29, 2024, 4:03pm
3
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
neu
(neu)
September 30, 2024, 6:59am
4
Awesome! Thanks for sharing
CC @frenck because I saw on Insta that he bought the same charger.