Modern charging protocols within devices timeout but a fail safe easy solution to prevent fires is to have a timer before the charger and set it to amount of time that the charger takes to charge the device .. typically 30 min for a phone with a good chargers. With ebikes, read the manual; 2-4 hours typically. The shutoff timers are typically less than $10.