Basically the idea is making the Trade-o-Mats capable of trading with the villagers. The villagers see the Trade-o-Mat, when they are inside a certain radius (5 blocks maybe) they compare their offers with the Trade-o-Mat, and if the offers match, they make one transaction. After that, the Trade-o-Mat will not make new transactions for a short amount of time (to prevent emerald farming and discourage players of using this system as the exclusive trading mechanic, I think).
But I know the idea is not as easy as it sounds. First of all, it is needed to know how do the trading mechanics work in the code, and then, how the Trade-o-Mats could interact with the villagers, know the offers they have and make transactions when the offers match.
The offers match only if the following conditions are met:
1. The item selled/bought is the same between the villager and the Trade-o-Mat (a bit obvious)
2. The Trade-o-Mat must agree with the Villager in the price. If a Villager buys, by example, 20 wheat for one emerald, the trading only can be made if the Trade-o-Mat sells 20+ wheat for 1 emerald.
That's it. Hope you like.