There's a make of battery tender made by a company called Battery Tender. That's what I've been using for quite some time on generators. Tried almost everything on my portable generator to keep its battery up. Nothing worked until I bought a Battery Tender. Now I have one of the all weather ones connected to my 12.5 kw diesel generator. Tried a solar one there, but it wouldn't do. Have a solar battery tender on the battery for my electric fence and have 2 solar ones on the battery to our gate.
Battery tenders sense the battery voltage and don't put juice in unless it's needed.
Don't use an indoor (cheaper) one outdoors. Had an indoor one initially on my diesel generator. Even though it was protected by a cover where it was plugged in, it failed. The outdoor one (more expensive) now on the generator is quite old. Old electronics keep going though unless they get fried by something.
Ralph