ATS switch issues

Hi. I have a question about installing an auto transfer switch and my battery charger.

I’m setting up a small victron system that will primarily be charging by the grid and not so much solar. This is for Cuba where the power goes out several times a day for hours at a time. I’m putting in a bunch of batteries for a 24v system and want to connect the inverter directly to the main panel in the house with an ats switch.

Something that occurred to me while I was thinking about it is the victron battery charger. If the whole house is running on the inverter and the battery charger is plugged into the house I’m guessing the battery charger and inverter will going into this loop of trying to charge the batteries from the back up battery power. The charger won’t know its on backup power I’d assume right.

Does anyone have any ideas of how to prevent the chargers from trying to charge itself while the grid is down?

My first thought is to run 1 dedicated circuit that is only powered by the grid but maybe someone has a better solution? Running a circuit will be very difficult and probably would have to be run on the outside of the house

Another thought is if I can find smaller gauge wire I could run that from the ATS to a relay. I believe the ats has contacts for that.

The main fuse panel will not be super close to the batteries and inverter and finding wire or supplies is not easy there. It’s probably 50 feet away or so and the house is cement.

I’ll attach a photo for context so you can see what I’m dealing with. It’s not like I can isolate a outlet to use. The house is not wired to any standards to say the least.

Anyone have any ideas?

Attach the charger to the ac input of the inverter, then it will work only on grid.

I’m not a licensed electrician but assuming the grid supply is single phase then it looks to me that some of the wires coming out of the meter are going direct to the house without passing through the main isolator switch. These will be grid only if you don’t change them. Not too safe either…I’d start there and move everything to the downstream side of the isolator if it can manage the load.

Then it seems you’ll need to move all the wires on the output side of your main isolator to the output of the ATS.
The output of the isolator will then be wired directly to input of the ATS. Connect the charger here too via a dedicated new outlet/socket (preferably protected by a breaker or fuse). Alternatively select one of the current house circuits to be grid only and connect it to same location.

Charger will only power on when the grid is live. ATS will supply all other circuits and the whole lot can be safely isolated at the main switch.

This depends on which inverter you choose.
If you use a Multiplus inverter, then there is an AC out 2 connection, that by default only comes on when the Mains is present. You can connect your battery charger to this output, and your critical loads to AC out 1. Then, when the mains goes down, AC out 2 turns off, and only the loads on AC out 1 are powered.