Hi there, I would like to display the last charge to 100% of my EV in my dashboard.
I’ve got a sensor that gives me the actual charge level of the car, and would like to use this information to trigger a timestamp update of a new sensor.
This newly created sensor should be displayed on my dashboard like “2 days ago”.
So I’ve done a bit of researches, and I could manage to put this code into my template.yaml and after a restart of HA I can see my new sensor “sensor.car_last_100”
- trigger:
- platform: state
entity_id:
- sensor.car_battery_level
to:
- 100
sensor:
- name: "Car last 100%"
unique_id: sensor.car_last_100
device_class: timestamp
state: "{{ now() }}"
I’m stuck at the point that my new sensor is created but the value is “unavailable”.
So I tried to put a value with the Dev tools to see if my trigger is doing something.
The trigger works fine when the battery goes to the specified value, but the value written in my new sensor changes from the manual specified state to “unavailable”.
So I think there is something wrong with this part of the code:
sensor:
- name: "Car last 100%"
unique_id: sensor.car_last_100
device_class: timestamp
state: "{{ now() }}"
Would appreciate every tips I can get