I can't confirm that this works, but it is what I've tried recently. I mount a 1.5" diameter felt pad (PSA) to the top battery surface and apply 10-15 drops of peppermint oil to the pad. It is supposed to repel rodents and spiders, and smells good.
Here is what I use. To the spray I add several tablespoons of peppermint oil and spray some in the engine compartment, just on none functioning parts/ trim, not on engine itself. The bags I put inside, also with a few drops of peppermint oil. One under a front seat, one in the cargo area