Peugeot Citroen DS cars - Connected Car

If you need card / config for something in particular, please let me know. its hard to do the entire configuration here

1 Like

I am interested in the charge/trip data. Do you use the new api endpoints for this? I already found your closed issue about charging data

hi, I integrated my e208 with home assistant through this integration, everything works but the GPS only give me the position when I leave and the position when I arrive. I don’t see the GPS position in real time. Why?

I use automations to track my trips and append it to google sheets.
I modified my automations a bit to track my trips and it works awesome. Remember to integrate google sheets to home assistant to upload the data.

alias: Trip_start_parameters_set
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.e2008_iginition_status
    id: "1"
    from: Stop
    to: StartUp
condition:
  - condition: state
    entity_id: counter.trip_start_counter
    state: "0"
  - condition: template
    value_template: >-
      {{ trigger.from_state.state != "unavailable" and trigger.to_state.state !=
      "unavailable" }}
action:
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{ states.sensor.e2008_odometer.state }}"
    target:
      entity_id: input_number.temp_trip_start_odometer
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{ states.sensor.e2008_battery_level.state }}"
    target:
      entity_id: input_number.temp_trip_start_battery_level
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{ states.sensor.e2008_actual_range.state }}"
    target:
      entity_id: input_number.temp_trip_start_range
  - service: input_datetime.set_datetime
    data:
      timestamp: "{{ as_timestamp(now()) }}"
    target:
      entity_id: input_datetime.temp_trip_start_time
  - wait_template: >-
      {{ states.sensor.e2008_odometer.state |float  -
      states.input_number.temp_trip_start_odometer.state | float >= 1 }}
    continue_on_timeout: false
    timeout: "600"
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{ states.input_number.temp_trip_start_odometer.state }}"
    target:
      entity_id: input_number.trip_start_odometer
  - service: input_datetime.set_datetime
    data:
      timestamp: "{{ as_timestamp(states.input_datetime.temp_trip_start_time.state) }}"
    target:
      entity_id: input_datetime.trip_start_time
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{ states.input_number.temp_trip_start_battery_level.state }}"
    target:
      entity_id: input_number.trip_start_battery_level
  - service: input_text.set_value
    data:
      value: >-
        {{ states.sensor.e2008_position.state.split(", ")[1] | replace("[","") |
        replace("]","") | float() }} , {{
        states.sensor.e2008_position.state.split(", ")[0] | replace("[","") |
        replace("]","") | float() }}
    target:
      entity_id: input_text.trip_start_position
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{ states.input_number.temp_trip_start_range.state }}"
    target:
      entity_id: input_number.trip_start_range
  - service: counter.set_value
    data:
      value: 1
    target:
      entity_id: counter.trip_start_counter
  - service: notify.mobile_app_pixel_7_pro
    data:
      message: Trip started at {{ states.input_datetime.trip_start_time.state }}
  - condition: state
    entity_id: input_boolean.climate_control_e2008
    state: "on"
  - service: input_boolean.toggle
    data: {}
    target:
      entity_id: input_boolean.climate_control_e2008
mode: single

Trip end like this

alias: trip_end_parameters_set
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.e2008_iginition_status
    from: StartUp
    to: Stop
    id: "3"
condition:
  - condition: template
    value_template: >-
      {{ trigger.from_state.state != "unavailable" and trigger.to_state.state !=
      "unavailable" }}
  - condition: state
    entity_id: counter.trip_start_counter
    state: "1"
action:
  - service: counter.reset
    data: {}
    target:
      entity_id: counter.trip_start_counter
  - service: input_datetime.set_datetime
    data:
      timestamp: >-
        {{ (as_timestamp(states.sensor.e2008_odometer.last_updated | as_local))
        }}
    target:
      entity_id: input_datetime.trip_end_time
  - service: input_number.set_value
    data:
      value: "{{ states.sensor.e2008.attributes[\"energy\"][0][\"level\"] }}"
    target:
      entity_id: input_number.trip_end_battery_level
  - service: input_number.set_value
    data:
      value: "{{ states.sensor.e2008.attributes[\"timed_odometer\"][\"mileage\"] }}"
    target:
      entity_id: input_number.trip_end_odometer
  - service: input_number.set_value
    metadata: {}
    data:
      value: "{{states.sensor.e2008_actual_range.state}}"
    target:
      entity_id: input_number.trip_end_range
  - service: input_text.set_value
    data:
      value: >-
        {{ states.sensor.e2008_position.state.split(", ")[1] | replace("[","") |
        replace("]","") | float() }} , {{
        states.sensor.e2008_position.state.split(", ")[0] | replace("[","") |
        replace("]","") | float() }}
    target:
      entity_id: input_text.trip_end_position
  - service: google_sheets.append_sheet
    data:
      config_entry: xxxxxxxxxxxxxxxxxxxxxxxx
      data:
        Start time: "{{ states.input_datetime.trip_start_time.state }}"
        End time: "{{ states.input_datetime.trip_end_time.state }}"
        Duration: "{{ states.sensor.e2008_trip_duration.state }}"
        start latitude: >-
          {{ states.input_text.trip_start_position.state.split(",")[1] |
          replace("[","") | replace("]","") | float() }}
        start longitude: >-
          {{ states.input_text.trip_start_position.state.split(",")[0] |
          replace("[","") | replace("]","") | float() }}
        end latitude: >-
          {{ states.input_text.trip_end_position.state.split(",")[1] |
          replace("[","") | replace("]","") | float() }}
        end longtitude: >-
          {{ states.input_text.trip_end_position.state.split(",")[1] |
          replace("[","") | replace("]","") | float() }}
        Average Speed: "{{ states.sensor.e2008_trip_average_speed.state}}"
        Start Odometer: "{{ states.input_number.trip_start_odometer.state }}"
        End odometer: "{{ states.input_number.trip_end_odometer.state }}"
        Total km: "{{ states.sensor.e2008_trip_total_km.state }}"
        Start Battery level: "{{ states.input_number.trip_start_battery_level.state }}"
        End Battery level: "{{ states.input_number.trip_end_battery_level.state }}"
        Total battery used: "{{ states.sensor.e2008_trip_total_battery_used.state }}"
        Trip consumption: "{{ states.sensor.e2008_trip_consumption.state }}"
  - service: notify.mobile_app_pixel_7_pro
    data:
      message: >-
        Trip completed at {{ states.input_datetime.trip_end_time.state }} {{-
        '\n' -}} Trip KM {{ states.sensor.e2008_trip_total_km.state | round (2)
        }} km {{- '\n' -}} Trip duration {{
        states.sensor.e2008_trip_duration.state }} {{- '\n' -}} Trip Consumption
        {{ states.sensor.e2008_trip_consumption.state | round (2) }} kwh/100km
mode: single

You can use the new api end points alternatively.
You can get the last trip / charge data by creating a template sensor like this in config.yaml

- resource: "http://localhost:5000/vehicles/trips"
    scan_interval: 1000
    sensor:
      - name: e2008_trips
        unique_id: e2008_trips
        value_template: 'OK'
        json_attributes_path: $.[-1:]
        json_attributes:
          - start_at
          - stop_at
          - consumption_km
          - consumption_by_temp
          - positions
          - duration
          - speed_average
          - distance
          - mileage
          - altitude_diff
          - id
          - consumption
          

  - resource: "http://localhost:5000/vehicles/chargings"
    scan_interval: 10
    sensor:
    - name: e2008_chargings
      unique_id: e2008_chargings
      value_template: 'OK'
      json_attributes_path: $.[-1:]
      json_attributes:
         - start_at
         - stop_at
         - duration_min
         - duration_str
         - start_level
         - end_level
         - kw
         - price
         - charging_mode
         - mileage

You could modify json_attributes_path: $.[-1:] to 1,2,3 etc to get the first,second, third etc. trip/charge data.

There are not much good tables available in HA lovelace that I am aware of. So I can’t plot this data in a table unfortunately.

Hope this helps

2 Likes

@vktpla Thanks a lot. But i need to see only the gps position in real times in the map.
is there a way to do this?

@viperxeno you could try modifying hours to show on the map to 1hr or a smaller number of your choice.
I hope you created a device tracker automation to track the car.

alias: "Car: Track PSA"
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.e2008_position_update
    attribute: latitude
  - platform: state
    entity_id:
      - binary_sensor.e2008_position_update
    attribute: longitude
condition: []
action:
  - service: device_tracker.see
    data:
      dev_id: e2008_new
      battery: "{{ states('sensor.e2008_battery_level')|int }}"
      host_name: PSA
      gps:
        - "{{ state_attr('binary_sensor.e2008_position_update','latitude') }}"
        - "{{ state_attr('binary_sensor.e2008_position_update','longitude') }}"
mode: queued
max: 10

in config yaml file,

    - name: e2008 Position update
      unique_id: e2008_position_update
      state: >-
        {{ state_attr('sensor.e2008', 'kinetic').moving }}
      device_class: moving
      attributes:
        latitude: "{{ state_attr('sensor.e2008', 'last_position').geometry.coordinates[1] }}"
        longitude: "{{ state_attr('sensor.e2008', 'last_position').geometry.coordinates[0] }}"
2 Likes

I have peugeot 308 sw 2015. As i saw my car is not supported by this addon as being too old.
It does have peugeot app that can track journeys, fuel consumption etc. and have touch screen for all commands.
Any chance of supporting VIN VF3LJAH***

i have a c4picasso (2013) but have upgraded the head unit and software to a 2017 so i now have the my citroen app working fine, and i never get a text with the code.

@vktpla Yes i have set device tracker then i set 12hr in lovelace map but i see only gps start point and gps end point

Even on the PSA controller I see the starting point and the arrival point on the map. I don’t see any intermediate GPS points

My app is working fine except when it doesnt. It some kind weird bluetooth problem when app doesn’t receive data from the car… There are lot of threads online. For me turning off bluetooth and back on when app is connected to the car solve the problem.
But in this addon or docker container my car is market as too old. Probably because my VIN number is not supported.

how do i make a entity with this that shows battery level and a entity that shows if its charging or not?

Optionally a entity from which i can start the pre-conditioning would be cool.

(all above for making automations)

Anyone else have trouble with updates when charging?
With our Opel Zafira-e Life, I have to open My Opel app and force refresh for charge % and autonomy to update.
That at least shows then shows in HA, but makes charge threshold pointless and also not getting anything for Remaining charge time/duration.

It’s fine when on the move, but no updates when charging is tedious, even in Tronity.
Our VW ID.3 even with the old software gives very frequent charge status updates!

Hi

Jeg har en climate switch where I can start/stop the climate.
But if I want to have en entity to start/stop charging instant, how to set this up

I can see some of you have a wakeup switch, what is this for, do i need to press this before sending climate and charge start/stop?

1 Like

SOLVED
Hi everyone, I’ve been trying to configure PSACC for days, but, despite having created the various entities, they are still in an unknown state.

I tried to indicate the address 0.0.0.0 that appears in the logs, the other address 172.30.32.1 i can read in the logs, the address of the mini PC on which I installed HA, specifying both port 5000 and 8123, but I can’t get it to read those blessed entities.

Do you know how I can find the right ip address? or am I doing something else wrong?
Thanks
+++++++++++++++++++++++++
SOLUTION
opening the port 5000 in the config tab in HA all work perfectly

Works with Ds 7?

Good day, been a while but guess this topic is still usable.
Question In the above quote (from sensor e208 parcouru) there is a sensor named:
sensor.beta_test_timestamp where does it related to? can/must it be replaced, did I missed something?

Thanks in advance.
regards Frank

Hello.

« e208_parcouru » was a test to reproduce a graph of autonomy’s consumption in km. So that entity try to calculate, since full autonomy, the theoretical distance and its consumption on time.

And don’t know how to explain that in English :sweat_smile:

Not relevant because, just a test … you can suppress all e208_parcouru

Hello, Ok thanks for the quick response, I understand, I will ignore it…
Thanks…