How to design a circuit to disconnect battery charger automatically?
there is no problem measuring vokltage at battery if intrenal resistance of battery is low enough (to pull down the voltage of the adaptor).

An additional resistor may help a litle, but if you use a n-channel mosfet-switch at ground level to disconenct charging you can measure both connected and disconnected- so in my point of view no problem there (no additional R needed) .
 If Mosfet ist disconnecting (due to high voltage level or due to low level (discharged in offgrid state) everything is ok (Mosfet and voltage comparator must be low power to not discharge battery too quick until grisd is on again).
IRF510 is 100V, aprox. 5A, so seems ok if current is average current (hwat is the usage of L1 and VLAVE ???)