An efficient real-time infrastructure for home automation based on powerline communications