So, after a while I added a few funny things to my integration:
Prequesites in HACS:
Install “Time Picker Card” and “Number Box” under Frontend for my tinkering to work.
Yes, all my names are german and NO I will not change that for you to english. Feel free to change it yourself though.
If you have any questions, tell me.
Lovelace:
- type: entities
entities:
- entity: device_tracker.car
- entity: sensor.e208_mileage
secondary_info: last-updated
- entity: sensor.e208_battery_level
secondary_info: last-updated
- entity: sensor.e208_battery_voltage
secondary_info: last-updated
- entity: sensor.e208_battery_autonomy
secondary_info: last-updated
- entity: sensor.e208_charging_status
secondary_info: last-updated
- entity: sensor.e208_charging_mode
secondary_info: last-updated
- entity: sensor.e208_charging_rate
secondary_info: last-updated
- entity: sensor.e208_charging_rate_kwh
secondary_info: last-updated
- entity: sensor.e208_charging_plugged
secondary_info: last-updated
- entity: sensor.e208_delay_start
secondary_info: last-updated
- entity: sensor.e208_remain_time
secondary_info: last-updated
- entity: sensor.e208_signal_quality
secondary_info: last-updated
- entity: input_number.charge_threshold
type: custom:numberbox-card
unit: '%'
delay: 3000
icon: mdi:battery
- entity: sensor.e208_threshold
secondary_info: last-updated
- entity: input_datetime.charge_time
type: custom:time-picker-card
layout:
name: inside
align_controls: right
embedded: true
- entity: sensor.e208_stop_time
secondary_info: last-updated
- entity: switch.e208_clim
name: Klima aktivieren
secondary_info: last-triggered
- entity: automation.wakeup_e208
secondary_info: last-triggered
title: Peugeot e208
header:
type: picture
image: /local/208.png
tap_action:
action: none
hold_action:
action: none
show_header_toggle: false
state_color: false
- type: gauge
entity: sensor.e208_battery_level
min: 0
max: 100
name: Peugeot e208 Batterie
severity:
green: 60
yellow: 40
red: 0
needle: true
configuration.yaml
input_number:
charge_threshold:
name: 'Ladelimit'
min: 50
max: 100
step: 1
input_datetime:
charge_time:
name: 'Ladestop'
has_date: false
has_time: true
sensor:
- platform: rest
name: 'peugeot_e208'
resource: http://192.168.181.42:5000/get_vehicleinfo/YOURVINGOESHERE?from_cache=1
scan_interval: 60
timeout: 30
value_template: 'OK'
json_attributes:
- energy
- timed_odometer
- battery
- last_position
- platform: rest
name: 'peugeot_e208_charge_control'
resource: http://192.168.181.42:5000/charge_control?vin=YOURVINGOESHERE&?always_check=true
scan_interval: 60
timeout: 30
value_template: 'OK'
json_attributes:
- _next_stop_hour
- percentage_threshold
- platform: template
sensors:
e208_battery_voltage:
friendly_name: "Batterie Spannung"
device_class: "voltage"
unit_of_measurement: "V"
value_template: "{{ state_attr('sensor.peugeot_e208', 'battery')['voltage'] * 4 }}"
e208_battery_level:
friendly_name: "Batterie"
device_class: "battery"
unit_of_measurement: "%"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['level'] }}"
e208_battery_autonomy:
friendly_name: "Autonomie"
icon_template: "mdi:road-variant"
unit_of_measurement: "km"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['autonomy'] }}"
e208_charging_mode:
friendly_name: "Lademodus"
icon_template: "mdi:ev-station"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['charging']['charging_mode'] }}"
e208_charging_rate:
friendly_name: "Laderate"
icon_template: "mdi:lightning-bolt"
unit_of_measurement: "km/h"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['charging']['charging_rate'] }}"
e208_charging_rate_kwh:
friendly_name: "Laderate"
unit_of_measurement: "kWh"
device_class: "energy"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['charging']['charging_rate'] * 0.163 }}"
e208_charging_plugged:
friendly_name: "Ladegerät Eingesteckt"
icon_template: "mdi:ev-plug-type2"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['charging']['plugged'] }}"
e208_charging_status:
friendly_name: "Ladestatus"
icon_template: "mdi:battery-charging"
value_template: "{{ state_attr('sensor.peugeot_e208', 'energy')[0]['charging']['status'] }}"
e208_mileage:
friendly_name: "Kilometerstand"
icon_template: "mdi:speedometer"
unit_of_measurement: "km"
value_template: "{{ state_attr('sensor.peugeot_e208', 'timed_odometer')['mileage'] }}"
e208_mapdata:
friendly_name: "Koordinaten"
icon_template: "mdi:map-marker"
value_template: "{{ state_attr('sensor.peugeot_e208', 'last_position')['geometry']['coordinates'] }}"
e208_signal_quality:
friendly_name: "Signalstärke"
icon_template: "mdi:signal-variant"
value_template: "{{ state_attr('sensor.peugeot_e208', 'last_position')['properties']['signal_quality'] }}"
e208_stop_time:
friendly_name: "Ladestop"
value_template: "{{ state_attr('sensor.peugeot_e208_charge_control', '_next_stop_hour') }}"
e208_threshold:
friendly_name: "Ladelimit"
unit_of_measurement: "%"
value_template: "{{ state_attr('sensor.peugeot_e208_charge_control', 'percentage_threshold') }}"
e208_delay_start:
friendly_name: "Nächster Ladestart"
icon_template: "mdi:timer"
value_template: >
{% set dt = states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["next_delayed_time"] %}
{% if dt.find("H") > 0 %}
{% set hr = dt[dt.find("T")+1:dt.find("T")+ 3] %}
{% if hr[1:2] == "H" %}
{% set hr = "0" + hr[0] %}
{% endif %}
{% else %}
{% set hr = "00" %}
{% endif %}
{% if dt.find("M") > 0 %}
{% set mn = dt[dt.find("M")-2:dt.find("M")] %}
{% if mn[0:1] == "H" or mn[0:1] == "T" %}
{% set mn = "0" + mn[1] %}
{% endif %}
{% else %}
{% set mn = "00" %}
{% endif %}
{% set tm = hr + ":" + mn %}
{{tm}}
e208_remain_time:
friendly_name: "Restladezeit"
icon_template: "mdi:timer-outline"
value_template: >
{% set dt = states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["remaining_time"] %}
{% if dt.find("H") > 0 %}
{% set hr = dt[dt.find("T")+1:dt.find("T")+ 3] %}
{% if hr[1:2] == "H" %}
{% set hr = "0" + hr[0] %}
{% endif %}
{% else %}
{% set hr = "00" %}
{% endif %}
{% if dt.find("M") > 0 %}
{% set mn = dt[dt.find("M")-2:dt.find("M")] %}
{% if mn[0:1] == "H" or mn[0:1] == "T" %}
{% set mn = "0" + mn[1] %}
{% endif %}
{% else %}
{% set mn = "00" %}
{% endif %}
{% set tm = hr + ":" + mn %}
{{tm}}
switch:
- platform: command_line
switches:
e208_clim:
command_on: curl -s "http://192.168.181.42:5000/preconditioning/YOURVINGOESHERE/1"
command_off: curl -s "http://192.168.181.42:5000/preconditioning/YOURVINGOESHERE/0"
rest_command:
e208_wakeup:
url: "http://192.168.181.42:5000/wakeup/YOURVINGOESHERE"
e208_change_threshold:
url: "http://192.168.181.42:5000/charge_control?vin=YOURVINGOESHERE&percentage={{ states('input_number.charge_threshold') | int }}"
e208_change_charge_time:
url: "http://192.168.181.42:5000/charge_control?vin=YOURVINGOESHERE&hour={{ state_attr('input_datetime.charge_time','timestamp') | timestamp_custom('%H', False) }}&minute={{ state_attr('input_datetime.charge_time','timestamp') | timestamp_custom('%M', False) }}"
automations.yaml
- id: car_track
alias: Tracker Car
trigger:
- entity_id: sensor.e208_mapdata
platform: state
- event: start
platform: homeassistant
action:
- data:
dev_id: car
battery: '{{states.sensor.e208_battery_level.state}}'
gps_accuracy: '25'
gps:
- '{{ (state_attr("sensor.peugeot_e208", "last_position")["geometry"]["coordinates"][1]) }}'
- '{{ (state_attr("sensor.peugeot_e208", "last_position")["geometry"]["coordinates"][0]) }}'
service: device_tracker.see
mode: single
- id: e208_wakeup
alias: Auto WakeUp e-208
description: ''
trigger:
- platform: time_pattern
hours: '/1'
condition: []
action:
- service: rest_command.e208_wakeup
mode: single
- id: car_threshold_change
alias: Car threshold change
trigger:
- platform: state
entity_id: input_number.charge_threshold
condition: []
action:
- service: rest_command.e208_change_threshold
mode: single
- id: car_chargetime_change
alias: Car chargetime change
trigger:
- platform: state
entity_id: input_datetime.charge_time
condition: []
action:
- delay:
seconds: 3
- service: rest_command.e208_change_charge_time
mode: single
known_devices.yaml
car:
name: Mein 208e
icon: mdi:car-hatchback
picture: /local/peugeot.png
track: true
P.S. YES, my car tracking works again. Why? I registered on PSA/Stellantis’ own non-free Free2Charge service and three days later the feature worked again. No this was not found out by me, but I verified it works that way. The real gods can be found here: "kinetic" and "last_position" fields are empty · Issue #50 · flobz/psa_car_controller · GitHub
P.P.S. Yes, I have a charge rate sensor with kwh and not kmh. How? I used some approximation as I know the real kwh from my wallbox. This 0.163 factor is right for me and my car. Maybe not for yours though.