Automation switch on randomly

I don’t mean to be rude but this is the perfect example of how not to ask a good question and you are unlikely to get any assistance. You should read this: How to help us help you - or How to ask a good question

Then provide some more detail.

  1. What type of home assistant are you running?
  2. Paste your correctly formatted doorbell automation.
  3. How long are the wires from your doorbell to your GPIO?