Change image according to the state of a sensor

Good morning, I have a card for the dishwasher that I want, depending on the status of the kwh sensor, to change from a jpg image to a gif, I get it to be static at 0 kwh but not to put the gif when there is consumption, I’ll give you the code to see if Can you help me. Thank you

type: picture-entity
entity: sensor.lavavajillas_power
name: Lavavajillas
show_state: false
state_image:
‘0’: /local/images/lavavajillas.jpg
‘10’: /local/images/lavavajillas.gif