Sadly I cannot. This PSA problem still persists and I have no coordinates for months now: "kinetic" and "last_position" fields are empty · Issue #50 · flobz/psa_car_controller · GitHub
Hello all,
i hope you are doing well.
I have an issue here, i am not getting any data out of the addon, as it looks like.
The Addon itself seems to work fine.
I can see all informations and there are no obvoius errors in the logs.
But when i try to follow the steps here:
I will always geht the message that the sensors etc are unavailable:
Open this in a browser does not work at all:
http://192.168.1.6:5000/get_vehicleinfo/VR3UXXXXXXXXX9
Here is some log from the addon, so at least the charging status should be visible:
2021-07-19 16:57:43,552 :: INFO :: charging status of VR3UXXXXXXXXX9 is InProgress, battery level: 46
In the logs from HA i can see this:
2021-07-19 16:52:06 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError(‘UndefinedError: ‘None’ has no attribute ‘attributes’’) while processing template ‘Template(“{{ states.sensor.peugeot_e208.attributes[“energy”][0][“level”] }}”)’ for attribute ‘_attr_state’ in entity ‘sensor.e208_battery_level’
2021-07-19 16:52:06 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template(“{{ states.sensor.peugeot_e208.attributes[“energy”][0][“autonomy”] }}”)
I really do not have any idea why this is not working.
Can someone help me out here ?
This is my config file, peugeot.yaml located in ha/config/sensors/
In the configurationfile is linked correctly, as other sensors are working fine:
sensor: !include_dir_merge_list config/sensors/
Its the default one, just changed the names etc but not more.
# Peugeot e208
- platform: rest
name: peugeot_e208
resource: http://192.168.1.6:5000/get_vehicleinfo/VR3UXXXXXXXXX9
scan_interval: 60
timeout: 30
value_template: 'OK'
json_attributes:
- energy
- timed_odometer
- battery
- platform: template
sensors:
e208_battery_voltage:
friendly_name: "Battery Voltage"
unit_of_measurement: "V"
value_template: '{{ states.sensor.peugeot_e208.attributes["battery"]["voltage"] * 4 }}'
e208_battery_level:
friendly_name: "Battery"
unit_of_measurement: "%"
value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["level"] }}'
e208_battery_autonomy:
friendly_name: "Autonomy"
unit_of_measurement: "km"
value_template: '{{ states.sensor.peugeot_e208.attributes["energy"][0]["autonomy"] }}'
e208_charging_status:
friendly_name: "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"] }}'
# Peugeot e208 charge_control
- platform: rest
name: peugeot_e208_charge_control
resource: http://192.168.1.6:5000/charge_control?vin=VR3UXXXXXXXXX9&?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: "Next Stop Time"
value_template: '{{ states.sensor.peugeot_e208_charge_control.attributes["_next_stop_hour"]}}'
e208_threshold:
friendly_name: "Threshold"
unit_of_measurement: "%"
value_template: '{{ states.sensor.peugeot_e208_charge_control.attributes["percentage_threshold"] }}'
Your missing ?from_cache=1 from the resource line
resource: http://192.168.1.6:5000/get_vehicleinfo/VR3UXXXXXXXXX9?from_cache=1
Hi,
thanks, I changed it but did not do anything.
Are you sure you have the correct IP address. Restart the PSA Car Controller and check the logs.
Mine starts with the following:-
2021-07-20 19:00:26,548 :: INFO :: update_data
- Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment. - Running on http://172.30.33.5:5000/ (Press CTRL+C to quit)
I can not believe this, how did I missed that?
Thanks a lot !
That did the Trick !
Thank you so much
Hi,
I have another problem, have mentioned it in a discussion here but haven’t received a reply yet (maybe I should raise an issue?).
Anyway, I have a problem with sensor values not being updated, and that is probably because of that a certain attribute (“timed_odometer”) is empty in the API for my car (an Opel Grandland X). I get this in the logs:
172.30.32.1 - - [23/Jul/2021 14:44:06] "GET /charge_control?vin=[VIN]&?always_check=true HTTP/1.1" 200 - Exception in thread Thread-1: Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/psa_car_controller/my_psacc.py", line 169, in __refresh_vehicle_info self.get_vehicle_info(car.vin)
File "/psa_car_controller/my_psacc.py", line 156, in get_vehicle_info self.record_info(car) File "/psa_car_controller/my_psacc.py", line 460, in record_info mileage = car.status.timed_odometer.mileage
AttributeError: 'NoneType' object has no attribute 'mileage'
Looking at the JSON object returned from the service, the timed_odometer isn’t set.
"timed_odometer":null
Could this be the problem, and should I raise an issue on it? I guess the fix is to evaluate if the attribute exists and only set mileage in that case. I’d like to test that in my installation locally, just to verify that it solves the problem. Unfortunately I don’t have so much knowledge about HA and how the add-on architecture is setup (if I understand it correctly the addons are run as dockers?). So I wonder, where can I find the my_psacc.py script?
(Many questions here, sorry for that - Every newbie has to start somewhere ).
if you have access to the terminal in home assistant run the following
curl http://ipaddress:5000/get_vehicleinfo/yourvin | jq
where ipaddress is the PSA Car Controller IP adress and yourvin is the car VIN
this will display all the attributes from your car . My Corsa-e shows the following for mileage
},
“timed_odometer”: {
“updated_at”: null,
“mileage”: 103
}
}
Only had it a week and half
If it do that I get internal server error, and in the logs I see that it is because of the error i mentioned earlier, i.e.
500 - mileage = car.status.timed_odometer.mileage
AttributeError: 'NoneType' object has no attribute 'mileage'
So, maybe the problem is that for my car (an Opel Grandland X Hybrid, which essentially is the same car as the Peugeot 3008) the API doesn’t return the “milage” attribute?
@lonebaggie , maybe the issue is handled here (I can’t really find out if i’m running this version or not) handle none timed_odometer · flobz/psa_car_controller@c4486f7 · GitHub
I wanted to do the integration of my Ds 7, I installed the docker, I use home assistat core in container, but I don’t know what to do more, is there any guide for clumsy?
You will have to run the integration server either in docker or on an Unix machine. All instructions are on the GIT for the project.
It would be easier for you if you used a supervised version so you could use the custom plugin…but for now it doesn’t work for DS anyway…
thanks, wait
I have added a new sensor to convert the ISO 8601 duration format of next_delayed_time into text displaying HH:MM
You will need to change the sensor names to match your setup in my case sensor.corsa
corsa_delay_start:
friendly_name: "Delay start"
value_template: >
{% set dt = states.sensor.corsa.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}}
Not a great deal of use but it display’s on lovelace a bit nicer
You can also add Remaining Time with the same code
corsa_remain_time:
friendly_name: "Remaining Time"
value_template: >
{% set dt = states.sensor.corsa.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}}
@lonebaggie (or someone else that knows how this works), I see not that version 2.4.4 is available now which I believe may fix my problem with mileage. But, when I try to update it via the add-on store in HA I only see the version 2.4.3, which is the one I already have.
Is it possible to “force” installation of v2.4.4? I would really like to fix this problem. @Flodu31 or @flobz maybe knows about this? Sorry for my nagging…
I updated and now it works. Thank you very much!
Any news on the last position being reported?