Use sensor with state and timestamp as an trigger for an automation

Hello,

I want to use a sensor as trigger for a automation.
The sensor is a charge status sensor, when i fetch the charge status, it sets the sensor to
“Idle 16:39” for example.

I want to make an automation to look when the status changes from “Charging 16:39” to “Idle 16:39”.
Or another time. The time is for the automation not important. But i only want to make a trigger which looks
When Charging and “timestamp” changes to Idle and “timestamp”.
Do someone know how to do that?

trigger:
  - platform: template
    value_template: "{{ states('sensor.example') is search('Idle') }}"
    id: idle

it works thanks!