In order to maintain a seldom used battery in good condition, there are two options.

The first one is to install a PV module and charge controller, a relativly small module will suffice since the intention is not to recharge a flat battery, but merely to counteract self discharge.

The second choice is to purchase a line powered battery charger that is fully regulated and suitable for continous operation.
A constant voltage float charger is preferable to a three stage unit for this purpose.
The drawback of a line powered charger is the continuall small power useage which will increase your electricity bill.

Whichever option is chosen, you will also need a high capacity line powered charger to fully recharge the battery after a grid failure.

Traditional flooded lead acid batteries produce hydrogen when on charge, and therefore some experts state that they should never be used in living accomadation.
The amount of hydrogen produced is very small, provided the batteries are not overcharged, and IMHO one or two small batteries can be used indoors, provided that smoking, sparks and flames are kept away from the immediate area.
Remember that until very recently, disabled people used electric wheelchairs with flooded lead acid batteries. These were normally charged and used indoors without accident.
Also many domestic garages are used as workshops, without the vehicle battery being considered a risk.

Sealed batteries dont produce hydrogen in normal use, but may do so in case of failure or misuse.