psa_car_controller icon indicating copy to clipboard operation
psa_car_controller copied to clipboard

API changes for Homeassistant

Open tobilektri opened this issue 1 year ago • 1 comments

If you want to get the trips or chargings with Homeassistant RESTful Sensor into an attribute (e.g. to create a table) you need a json attribute. So we have to implement a attribute with the array to parse the trip and charge data to homeassistant.

After that you can use:

- platform: rest
  name: corsa_e_trips
  resource: http://xxxxx:5000/vehicles/trips?homeassistant=1
  scan_interval: 60
  value_template: "{{ value_json | length }}"
  json_attributes:
  - trips

While now you cant parse the json into an attribute and the value only allows 255 chars.

After that you can e.g. use flex-table-card to create a nice table with a list of your trips or charges.

tobilektri avatar Aug 07 '24 08:08 tobilektri

have you tried this :

rest:
  - resource: "http://xxxxx:5000/vehicles/trips?homeassistant=1"
    sensor:
      - name: "trips"
        value_template: "{{ value_json|| length }}"

flobz avatar Sep 03 '24 18:09 flobz