I am tinkering with the problem of making a circuit which uses INA219 for measuring power consumption on high side. The circuit has only one power input and only one power output as pictured below (very simplified only to convey the idea). The power for INA219 and its controller in that schematic is drawn before current sense resistor so to avoid INA219 detecting power drawn by those parts and to only measure power drawn on output end of the circuit.
The problem starts when I am thinking of how to make input/output reversible. With the diagram below it still will work in reverse (that is when VOUT/GNDOUT become input and VIN/GNDOUT are connected to the load). Using circuit below with IN/OUT reversed the INA219 will still function, but now the data it outputs will include power drawn by its controller (and any other peripherals connected to it).
So the question is -- how do I modify this circuit to allow this being reversible, but at the same time avoid INA219 detecting power drawn by controller?
simulate this circuit – Schematic created using CircuitLab
I could in theory insert diode right after VIN, then branch near VOUT and have 2nd current sensing resistor and 2nd INA219 on that branch just like below (diode placement are not exact there, again this is just to convey the idea). But this would mean rather complex circuit and also significantly increases cost of this circuit. Are there any better alternatives to that?