Change automation entity icon based on state on or off

Ah sorry I thought you wanted to change the card background.

Try this instead: