Smart home technology is gaining popularity among end-users, as it allows them to remotely control a variety of devices in their homes. Such systems have obvious benefits in terms of automation, but at the same time pose significant threats to home owners if the underlying communications are not secure. To this end, we introduce a novel security protocol that simplifies the pairwise authentication and key exchange among smart home devices. The protocol leverages identity-based cryptography (IBC), thus relaxing the requirement for storing and managing public key certificates. Furthermore, to mitigate the risks associated with centralized key generation in IBC, we opt to generate the private keys in a distributed manner, involving all smart devices. We implemented our protocol on Raspberry Pi 3 devices and demonstrate its efficiency in terms of both computational and communication cost.