Peugeot Citroen DS cars - Connected Car

I’m trying to setup this add-on. Installing seems to work fine, authentication through SMS works well, but I can’t reach the add-on through the IP. I think it’s because the add-on didn’t ask for the network setup part. When I look in the configuration of the add-on within the HA UI, there are no ports open under Network.

Can someone help me out?

EDIT
I’ve installed the docker version on my HA machine. This way the 5000 port is open, it works perfect now

News: for enable remote control on all car gasoline diesel in app

Logout from app
Close app
Reopen app
Localise in BE/francaise language
Login
Wait for enable remote with sms and code (otp).
Wait 1 hour for email completation

1 Like

Hi, I followed your instructions but I can’t find the OTP function inside the app.
Do I have to wait for it to appear?
I’m afraid I didn’t understand correctly.

P.S.
My car is not the diesel model but the 1.2 petrol model.
However, I hope that if the remote control was activated for diesel models the same could have happened for petrol ones.

Also, I’m in Italy and I use iOS on an iphone 13 Pro.
As for the country/language options, I can choose Nederlands/Nederland or France Metropolitain/French.
I can’t find Nederland/francaise.

sorry my mistake, you have to put belgium / french
and wait, once activated, wait for the email of the contract to arrive

my car is 1.2 130 hp petrol

I have just tried your method and is does not work for me in the UK. I never get past the OTP it says SMS sent but nothing ever arrives.

It doesn’t work for me either. I am in Italy

1 Like

same problem here :upside_down_face:

@flobz could you please guide us or update your app, many people are concerned about this OTP problem and with gasoline vehicles.

Thanks in advance

Hi All,

the latest version 2023.6.0 has shown warnings in regards to the way that the sensors and switch platform is current being written.
I’ve tried following the guide but can’t seems to get it parse properly. Anyone had any luck in getting this through?

if yes, can I please see how you’ve done it? Cheers

I updated mine like this:

# PSA
# Peugeot e208
sensor e208:
  - platform: rest
    name: peugeot_e208
    resource: http://IPADDRESS:5001/get_vehicleinfo/VINNUMBER?from_cache=1
    scan_interval: 60
    timeout: 30
    value_template: 'OK'
    json_attributes:
     - energy
     - timed_odometer
     - battery
  - platform: template
    sensors:
      e208_battery_voltage:
        friendly_name: "e208 Battery Voltage"
        unit_of_measurement: "V"
        value_template: '{{ states.sensor.peugeot_e208.attributes["battery"]["voltage"] * 4 }}'
      e208_battery_level:
        friendly_name: "e208 Battery"
        unit_of_measurement: "%"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["level"] }}'
      e208_battery_autonomy:
        friendly_name: "e208 Autonomy"
        unit_of_measurement: "km"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["autonomy"] }}'
       # Uncomment for miles instead of km
       #e008_battery_autonomy:
        #friendly_name: "Autonomy"
        #unit_of_measurement: "m"    
        #value_template: "{{ ((state_attr('sensor.peugeot_e208', 'energy')[0]['autonomy']) / 1.609) | round(0)}}"
      e208_charging_status:
        friendly_name: "e208 Charging Status"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["status"] }}'
      e208_mileage:
        friendly_name: "Mileage"
        unit_of_measurement: "km"
        value_template: '{{ states.sensor.peugeot_e208.attributes["timed_odometer"]["mileage"] }}'
       # Uncomment for miles instead of km
       #e208_mileage:
        #friendly_name: "Mileage"
        #unit_of_measurement: "m"
        #value_template: "{{ ((state_attr('sensor.peugeot_e208', 'timed_odometer')['mileage']) / 1.609) | round(2)}}"
# Peugeot e208 charge_control
sensor e208_charge_control:
  - platform: rest
    name: peugeot_e208_charge_control
    resource: http://IPADDRESS:5001/charge_control?vin=VINNUMBER&?always_check=true
    scan_interval: 60
    timeout: 30
    value_template: 'OK'
    json_attributes:
     - _next_stop_hour
     - percentage_threshold
  - platform: template
    sensors:
      e208_stop_hour:
        friendly_name: "e208 Next Stop Time"
        value_template: '{{ states.sensor.peugeot_e208_charge_control.attributes["_next_stop_hour"]}}'
      e208_threshold:
        friendly_name: "e208 Threshold"
        unit_of_measurement: "%"
        value_template: '{{ states.sensor.peugeot_e208_charge_control.attributes["percentage_threshold"] }}'

# e208 communication
#switch:
#  - platform: command_line
command_line:
  - switch:
#    switches:
      name: e208_change_threshold
      command_on: curl -s "http://IPADDRESS:5001/charge_control?vin=VINNUMBER&percentage=90"
      command_off: curl -s "http://IPADDRESS:5001/charge_control?vin=VINNUMBER&percentage=100"
  - switch:
      name: e208_change_charge_hour
      command_on: curl -s "http://IPADDRESS:5001/charge_control?vin=VINNUMBER&hour=5&minute=0"
      command_off: curl -s "http://IPADDRESS:5001/charge_control?vin=VINNUMBER&hour=0&minute=0"
  - switch:
      name: e208_clim
      command_on: curl -s "http://IPADDRESS:5001/preconditioning/VINNUMBER/1"
      command_off: curl -s "http://IPADDRESS:5001/preconditioning/VINNUMBER/0"
       
# e208 WakeUp
rest_command:
  e208_wakeup:
    url: "http://IPADDRESS:5001/wakeup/VINNUMBER"

# e208 custom charging threshold
  e208_change_charge_threshold:
    url: "http://IPADDRESS:5001/charge_control?vin=VINNUMBER&percentage={{ states('input_number.e208_charge_threshold_slider') | int }}"
    method: GET

input_number:
  e208_charge_threshold_slider:
    name: e208 Charging threshold
    initial: 80
    min: 50
    max: 100
    step: 1
    unit_of_measurement: "%"

input_button:
  e208_apply_charge_threshold_button:
    name: e208 Set charging threshold
    icon: mdi:battery-charging

What does that always_check=true do?
Also where do I need to sign up if I want last-position to work?

1 Like

Hi,

After restore I get this what to do?

Hello
First I have a Opel Mocca-e and try since few days to implement this peugot-integration. The Addon work fine local without the Map.

But this integation no sensor work. When fill in my browser he get_vehicleinformation, i get some Information. But the sensor are empty
grafik

The protocol of the addon say running on 0.0.0.0


But with 0.0.0.0 i didn’t get nor date with vehicleinfo.

The problem shoud be the template error (but why, other user have no problem):

Logger: homeassistant.helpers.template_entity
Source: helpers/template_entity.py:422
First occurred: 22:36:38 (35 occurrences)
Last logged: 23:13:21

TemplateError(‘UndefinedError: ‘None’ has no attribute ‘attributes’’) while processing template ‘Template<template=({{ states.sensor.peugeot_e2008.attributes[“energy”][0][“autonomy”] }}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.e2008_battery_autonomy’
TemplateError(‘UndefinedError: ‘None’ has no attribute ‘attributes’’) while processing template ‘Template<template=({{ states.sensor.peugeot_e2008.attributes[“energy”][0][“charging”][“status”] }}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.e2008_charging_status’
TemplateError(‘UndefinedError: ‘None’ has no attribute ‘attributes’’) while processing template ‘Template<template=({{ states.sensor.peugeot_e2008.attributes[“timed_odometer”][“mileage”] }}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.e2008_mileage’
TemplateError(‘UndefinedError: ‘None’ has no attribute ‘attributes’’) while processing template ‘Template<template=({{ states.sensor.peugeot_e2008_charge_control.attributes["_next_stop_hour"]}}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.e2008_stop_hour’
TemplateError(‘UndefinedError: ‘None’ has no attribute ‘attributes’’) while processing template ‘Template<template=({{ states.sensor.peugeot_e2008_charge_control.attributes[“percentage_threshold”] }}) renders=4>’ for attribute ‘_attr_native_value’ in entity ‘sensor.e2008_threshold’

So I didn’t know, what to do

Try to replace 0.0.0.0 with the actual IP address of the machine it’s running on.

Do you get a sensor from the rest platform you set up? This is my config (note that I’m running the add-on on port 5001 and I’m pulling some additional attributes):

# PSA
# Peugeot e208
sensor e208:
  - platform: rest
    name: peugeot_e208
    resource: http://LOCAL.IP.OF.SERVER:5001/get_vehicleinfo/VINNUMBER?from_cache=1
    scan_interval: 60
    timeout: 30
    value_template: 'OK'
    json_attributes:
     - energy
     - timed_odometer
     - battery
     # nkh addition
     - environment
     - kinetic
     - preconditionning

and it gives me this sensor which is then fed into the template sensors that breaks out the individual values:

Did you find any solution?

I’m especially interested in getting the mileage working. Battery and charging status are working nicely.

I’ve the base model Active of the e-2008. I’m wondering if there is a difference in infotainment system in terms of what data is available.

Yes, I work with the Ip of HA 192.168.178.xx

But I didn’t have the sensor “peugot_2008”!!! Why?

In the Browser I get Data with get_vehicleinformation!

The differenz between your Coding and my (and the coding of Flodu31) is, i have no line “sensor 2008:”
Do you have your coding in sensor.yaml or configuration.yaml?

In the sensor.yaml it is not possible for to insert this line. So I insert only this sensor in the configuration.yaml. That works!
Than I inserted all sensor in the configuration.yaml, it works!

But I did not want to insert all sensor in the configuration.yaml. What was your way?

Later I see, with the inserting all sensors in configuration.yaml I did not get any errors, but no sensor was generated!?

What is the way you assign the attributes of your 208-Sensor to the single sensor eg batery_level?

I have everything in configuration.yaml with no sensor.yaml, so I don’t know why it works in one place but not the other. But it’s good that it’s working now.

I posted an example of a configuration here: Peugeot Citroen DS cars - Connected Car - #302 by NKH where it breaks out individual sensors including battery level.

There are some more sensors you can include if you list environment and preconditionning under json_attributes in your main sensor (like I did here: Peugeot Citroen DS cars - Connected Car - #306 by NKH )

      e208_charging_charging_mode:
        friendly_name: "e208 Charging Mode"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["charging_mode"] }}'
      e208_charging_charging_rate:
        friendly_name: "e208 Charging Rate"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["charging_rate"] }}'
      e208_charging_plugged:
        friendly_name: "e208 Charging Plugged"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["plugged"] }}'
      e208_charging_remaining_time:
        friendly_name: "e208 Charging Remaining Time"
        value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["charging"]["remaining_time"] }}'
      e208_air_temp:
        friendly_name: "e208 Air Temp"
        unit_of_measurement: "C"
        value_template: '{{ states.sensor.peugeot_e208.attributes["environment"]["air"]["temp"] }}'
      e208_luminosity_day_true:
        friendly_name: "e208 Luminosity Day True"
        value_template: '{{ states.sensor.peugeot_e208.attributes["environment"]["luminosity"]["day"] }}'
      e208_preconditionning_status:
        friendly_name: "e208 Preconditionning Status"
        value_template: '{{ states.sensor.peugeot_e208.attributes["preconditionning"]["air_conditioning"]["status"] }}'

and if you want an ongoing estimation of what the maximum range of the car with a 100% charge is you can do something like this:

      e208_theoretical_max_autonomy:
        friendly_name: "e208 Theoretical max autonomy when fully charged"
        unit_of_measurement: "km"
        value_template: "{{ ((float(states('sensor.e208_battery_autonomy')) / float(states('sensor.e208_battery_level'))) * 100)|round(2) }}"

I noticed that PSA Car Controller now (sometimes) include the location of the car, this can be added to HA if you add last_position in the list under json_attributes in the main sensor, then add a sensor like this (it can also be condensed into the automation, but I like to have the “raw” output):

e208_last_position:
        friendly_name: "e208 Last Position Coordinates"
        value_template: '{{ states.sensor.peugeot_e208.attributes["last_position"]["geometry"]["coordinates"] }}'

And then create an automation that updates a device tracker with the location every minute:

alias: e208 - Update location from PSA Car Controller
description: ""
trigger:
  - platform: time_pattern
    minutes: /1
condition: []
action:
  - service: device_tracker.see
    data:
      host_name: e208 PSA GPS
      dev_id: e208_psa_gps
      gps:
        - >-
          {{ states.sensor.e208_last_position.state.split(", ")[1] |
          replace("[","") | replace("]","") | float() }}
        - >-
          {{ states.sensor.e208_last_position.state.split(", ")[0] |
          replace("[","") | replace("]","") | float() }}
mode: single

This gives me a device tracker called device_tracker.e208_psa_gps that shows the location of the car.

1 Like

Hey
yesterday night was i able to solve the problem. The problem, i moved the code of sensor.yaml to configuration.yaml. So I had 2x rest and 2x template, but without errors.

It works, thank you verry much!

Your sensor I will look again.

And your solution with the device tracker is interesting. which one do you use?

I only just implementet the device tracker, so currently I’m only seeing the inaccuracy of the GPS (I hope…), but it’s showing up nicely on a map and it looks like it’s updating very frequently:

2 Likes

It’s interesting how the car estimates it’s own position when it can’t see any satelites (parked in a parking garage) :grinning: