Architecting Smart IoT Devices