How to create derivative sensor from attribute?

I am getting battery level as part of mqtt location sensor. Can someone advise me how can I use that batt attribute in configuration.yaml to create derivative sensor, so I see speed of discharging?

The mqtt message with attribute is
{"_type":"location","acc":4,"alt":288,"batt":100,"bs":0,"conn":"m","created_at":1668013509,"lat":xx.062565,"lon":xx.3913067,"t":"p","tid":"ep","tst":1668006957,"vac":0,"vel":0}

Thanks very much, Jan