Self-powered trainable switching network