Automation switch on randomly

Hi, I have my doorbell connected to the GPIO of the raspberry, and when the button is pushed an automation send me a notification via telegram.
The problem is that the automation trigger randomly, even if the binary sensor is off, looking at the history the GPIO is always off but the automation sends me the notification.
Any ideas? Thanks.

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?

If you think I’ve not respected the guidelines simply don’t respond to my question.
No need to be rude, because I thought that the info You’ve asked were irrelevant as like I wrote the sensor never switch on so the GPIO is working correctly. And the automation code is correct, I have another one that notify me when a gate is open that work well (same code, same cable length ).

Tom wasn’t rude, he was very polite… asking you to post your automation code so the community could help you with your issues.

If you don’t (want to) post it, don’t expect people to (be able to) help you.

You are right, but he could simply ask me the configuration because I know how to ask a good question, but at the moment as I wrote I was working and can’t access to my config file.
Anyway solved switching from gpio 26 to gpio 24 don’t know why but it works.