07 A6 4.2 engine swap, now fans come on randomly with engine off

Car didnt have this problem before. Swapped a new engine in, reused the old coolant temp sensor, original ECM, trans etc.
Now when i plug the battery back in, within 5 seconds the fans come on. Sometimes they will turn off if i open the driver door. sometimes when I key on. Sometimes they will turn on 10 mins after the initial boot on, and stay on for a while…and once they came on an hour later…

i swapped the grey relay under the ECM just in case but still doing it. Only codes Im getting is IAT sensor open, but that code was there from before as well… Both ECT sensors from old and new engine were reading 7.5 k Ohms at -10C ambient last night…

With the 4.2 if you haven’t alredy and I assume from you post you did already put the motor in the car its always good to check out the timing system on the back of the motor. Those guides can break really easy.

As for your issue. Its a common issue to have the fan control mod go bad… Its super common. There are two of them on the S4 not sure if there are two on the A6. But that’s whats going to be the first thing your going to want to swap out.

So I dont know if something hokey is going on, but…something hokey is going on.
FIrst off, when I got the car, someone tinkered with the wiring under the right (passenger) e box.
This a BVJ engine mind you.
oam wiring diagram calls for a J271 relay which is the ECM power supply…I only have a 373 under there, and I see a red/green wire has been cut with a purple wire splitting off into 2 643 relays, and then 2 mroe small purpel wires branching into 1 OEM looking gold connector to the power distribution block… These 643 relays dont exist on any wiring diagram…

so when the fans come on…both turn off when I pull one of these 643 relays off…

However what is most concerning, is as I was pulling these two relays in and out, i later went to go start the car…and now the PRNDL is all lit up, and the ECM is not communicating at all…continuity tested all fuses, all good…
did one of the 643 relays just stick open on me? Going to test both relays tomorrow on the bench and see… need to pull some more relays from the junkyard.

I have a c6 s6 here, and i checked under the right box…those relays dont exist, no hokey cut and spliced wiring…jhust the one relay at the bottom (dont remebr if it was 271 or 373)…

So frig, now I gotta see if the ECM is even getting power. If its not…then trace it back to where it should be…
if it IS getting power…then im facked.

Looks liek connector 94, pin 92 and 69?

https://i.imgur.com/UXYvDty.jpg

https://i.imgur.com/UhAJuVl.jpg

I am getting 12v at pin 69, white/black wire so ECM should be waking. I believe it is as I am getting 2.5V on the CAN lines. No picoscope with me at the moment so I cannot confirm the message, but it is sending something out.
Rechecked the fuses in driver under hood ebox, dash left and right and trunk-all good.

According to erwin and mitchell, the only relay in the right compartmenet under the ECM, is the one for 2ndary air inejection, and also poweres the evap leak detection pump. The wire colors goign to the relay confirm this in vehicle.
The ECM relay in the diagrams resides in the left box with 2 other modules. The wire colors physicaly correspond to the vehicle. the black/white power wire for ECM is on the left side relay, J271.

Just for fun, I decided to swap the relay under the ECM, labeled in diagrams and physcially…as the SAI pump…welll…communication restored, she fired up.
Im happy…but perplexed.

Now to tackle the fan issue. e
To me, it looks like the relays were simply added on. Again these relays dont exist in any wiring diagram. The power wires are interrupted and ran to the relays, and one side is getting power from main fuses, the other looks like its triggered by the actual fan trigger wire to which it is butt crimped on to…

source of error has been identified. OP is dumb.
The ground side of those auxillary relays was hooked to power rather than ground -.-
all good now, fans work as they should!

good find and update.

Saturday must have been a fluke.
Drove around 2 hours multiple engine restarts-all fine.

Leave it parked on sunday
Monday morning, crank-just a click from the front, and the red “brake” is flashing. dosconnect and reconnect battery-cranks and starts fine, red flashing brake still on. Move to garage for later diagnosis.

This evening, key on-PRNDL lit up again, ecu no communication…tried messing with all the relays again, grounds good…

Dont know what it can be at this point, need to sleep on it.

I am thinking there is an issue with the high speed can network. possibly a wire rubbing somewhere. 99% sure ECM is communicating to the BCM but either BCM or something else is not p[assing the info along further. This is because the abs and headlamp leveling all go offline at same time.