Sensor template value based on external condition

Wondering if this one is possible: I would like to have a sensor counting the charging of my EV only when the car is at home.
To complexify things, I would like to convert the charging rate, which is in
Basically measure the value of
{{ states('sensor.mycar_charging_rate_sensor')|float * 182 }}
or
{{ state_attr('sensor.mycar_charging_rate_sensor','charger_actual_current') }}

The key is only to measure it while
{{ is_state('device_tracker.mycar_location_tracker', 'home') }}

Is there another way than (a pretty complex) automation?