Smart relay with modular design