Simulating Iot Frameworks and Devices in the Smart Home
Total Page:16
File Type:pdf, Size:1020Kb
Simulating IoT Frameworks and Devices in the Smart Home John Kalin Thesis submitted to the faculty of the Virginia Polytechnic Institute and State University in partial fulfillment of the requirements for the degree of Master of Science In Computer Engineering Joseph G. Tront William O. Plymale Thomas L. Martin August 10, 2017 Blacksburg, VA Keywords: IoT, Simulation, Smart Home, Network, OpenHAB Simulating IoT Frameworks and Devices in the smart home John Kalin ABSTRACT The rapid growth of the Internet of Things (IoT) has led to a situation where individual manufacturers develop their own communication protocols and frameworks that are often incompatible with other systems. Part of this is due to the use of incompatible communication hardware, and part is due to the entrenched proprietary systems. This has created a heterogeneous communication landscape, where it is difficult for devices to coordinate their efforts. To remedy this, a number of IoT Frameworks have been proposed to provide a common interface between IoT devices. There are many approaches to common frameworks, each with their strengths and weaknesses, but there is no clear winner among them. This thesis presents a virtual network testbed for implementing smart home IoT Frameworks. It consists of a simulated home network made up of multiple Virtual Machines (VM), simulated smart home devices and an implementation of the OpenHAB framework to integrate the devices. Simulated devices are designed to be network- accurate representations of actual devices, a LIFX smart lightbulb was developed and an existing Nest thermostat simulation was integrated. The demonstrated setup serves as a proof of concept for the idea of a home network testbed. Such a testbed could allow for the development of new IoT frameworks or the comparison of existing ones, and it could also serve as an education aid to illustrate how smart home IoT devices communicate with one another. Simulating IoT Frameworks and Devices in the smart home John Kalin GENERAL AUDIENCE ABSTRACT The rapid growth of the Internet of Things (IoT) has led to a situation where individual manufacturers develop their own systems for communicating with devices, which don’t work with other devices. A lot of this is due to devices using different technologies; for example, a Bluetooth device trying to talk to a Wi-Fi device. This has created a situation where it is difficult for different devices to communicate. To remedy this, a number of IoT Frameworks have been proposed to provide a common language between IoT devices. There are many approaches to common frameworks, each with their strengths and weaknesses, but there is no clear winner among them. This thesis presents a simulation environment for smart home IoT Frameworks. It consists of a simulated home network made up of multiple Virtual Machines (VM), simulated smart home devices and an implementation of the OpenHAB framework to integrate the devices. Simulated devices are designed to be accurate representations of actual devices, a LIFX smart lightbulb was developed and an existing Nest thermostat simulation was integrated. The demonstrated setup serves as a proof of concept for the idea of a home network testbed. Such a testbed could allow for the development of new IoT frameworks or the comparison of existing ones, and it could also serve as an education aid to illustrate how smart home IoT devices communicate with one another. Table of Contents Table of Contents …………………………………………………………………………. iv List of Figures …………………………………………………………………………...... vi Chapter 1 Introduction …………………………………………………………………...... 1 1.1 Motivation and Goal ………………………..………………………………………... 2 Chapter 2 Background …………………………………………………………………….. 4 2.1 Communication Technology ………………………………………………………… 4 2.1.1 Bluetooth Wireless Technology ………………………………………………….. 4 2.1.2 IEEE 802.15.4 Standard-based Protocols ………………………………………… 7 2.1.2.1 ZigBee Personal Area Network Technology ………………………………….. 8 2.1.2.2 6LoWPAN Low Power IPv6 Technology …………………………………….. 10 2.1.3 Z-Wave Low Energy Technology ………………………………………………... 11 2.1.4 Wi-Fi and Ethernet Technology ………………………………………………….. 13 2.2 IoT Frameworks ……………………………………………………………………... 15 2.2.1 Proprietary Frameworks ………………………………………………………….. 16 2.2.1.1 Apple HomeKit ……………………………………………………………….. 17 2.2.1.2 Google Weave ………………………………………………………………… 18 2.2.2 Open-Source Frameworks ………………………………………………………... 19 2.2.2.1 Samsung SmartThings ………………………………………………………… 19 2.2.2.2 AllSeen Alliance AllJoyn ……………………………………………………... 21 2.2.2.3 Linux Foundation IoTivity ……………………………………………………. 22 2.2.2.4 OpenHAB ……………………………………………………………………... 23 2.2.2.5 Other Open-Source Frameworks ……………………………………………… 25 2.2.3 General Security and Privacy of Frameworks ……………………………………. 26 2.2.3.1 Varied Landscape of Devices …………………………………………………. 27 2.2.3.2 Tendency Towards Over-Privilege ……………………………………………. 27 2.2.3.3 Encryption of Communication ………………………………………………... 29 2.2.3.4 Privacy Concerns ……………………………………………………………… 29 2.2.4 General Support and Ease of Use of Frameworks ……………………………….. 30 2.3 IoT Simulation ……………………………………………………………………….. 31 2.3.1 Application Development ………………………………………………………… 31 2.3.2 Academic Simulations ……………………………………………………………. 33 Chapter 3 Experimental Methodology ……………………………………………………. 41 3.1 Proposed Approach ………………………………………………………………….. 41 3.2 Network Setup ……………………………………………………………………….. 42 3.3 LIFX Bulb …………………………………………………………………………… 46 3.3.1 LIFX LAN Protocol ……………………………………………………………… 47 3.3.2 Simulated LIFX Bulb …………………………………………………………….. 50 3.3.3 Packet Sniffing LIFX …………………………………………………………….. 53 3.4 Nest Thermostat ……………………………………………………………………… 55 3.4.1 Thread and Nest Weave Fabric …………………………………………………… 55 3.4.2 Nest Home Simulation ……………………………………………………………. 59 3.5 OpenHAB Framework ………………………………………………………………. 60 3.5.1 LIFX Setup in OpenHAB ………………………………………………………… 61 3.5.2 Nest Setup in OpenHAB …………………………………………………………. 64 iv 3.5.3 Remote Access Setup …………………………………………………………….. 67 Chapter 4 Testing and Validation …………………………………………………………. 69 Chapter 5 Using Developed Tools ………………………………………………………… 72 5.1 Simulated Network Setup ……………………………………………………………. 72 5.2 LIFX Simulation Setup ………………………………………………………………. 75 5.3 Nest Home Simulator Setup …………………………………………………………. 76 5.4 OpenHAB Setup ……………………………………………………………………... 79 5.5 Simulating Additional Devices ………………………………………………………. 80 Chapter 6 Conclusion ……………………………………………………………………… 84 Chapter 7 Future Work ……………………………………………………………………. 86 References ………………………………………………………………………………… 87 Appendix A. Specified vs Actual LIFX Validity Table ………………………………….. 91 Appendix B. LIFX Protocols and Payloads ………………………………………………. 93 Appendix C. Capture of Undocumented LIFX Packets ………………………………….. 95 Appendix D. Capture of LIFX AllJoyn Packets ………………………………………….. 98 Appendix E. Sample Python Custom Packet Class ……………………………………….. 99 v List of Figures Figure 1. Block diagram for a typical IoT configuration ……………………..…………… 1 Figure 2. Bluetooth Piconet topology ……………………………………………………... 5 Figure 3. Bluetooth Scatternet topology …………………………………………………... 6 Figure 4. ZigBee Network Topologies ……………………………………………………. 9 Figure 5. Z-Wave Protocol Stack …………………………………………………………. 13 Figure 6. Non-Integrated smart home Setup with Cloud Services ………………………. 15 Figure 7. SmartThings Container Hierarchy ………………………………………………. 21 Figure 8. Integrated smart home Setup with Cloud Services …………………………….. 26 Figure 9. Screenshot of Nest Home Simulator Interface ………………………………….. 32 Figure 10. Diagram of simulated HVAC System …………………………………………. 35 Figure 11. Diagram showing use of emulated IoT Gateway ……………………………… 37 Figure 12. Diagram showing QLM being used to merge data from various sources …….. 38 Figure 13. Classic home network configuration ………………………………………….. 42 Figure 14. VirtualBox VM Manager ……………………………………………………… 43 Figure 15. VirtualBox Network Settings ………………………………………………….. 44 Figure 16. Network interfaces configuration for simulated IoT devices ………………….. 45 Figure 17. Simulated network topology …………………………………………………… 46 Figure 18. LIFX LAN Header format ……………………………………………………... 48 Figure 19. LIFX LAN communication flow diagram …………………………………….. 50 Figure 20. The user interface for bulb_sim.py …………………………………………….. 52 Figure 21. User interface for control.py …………………………………………………… 53 Figure 22. Thread Network Topology …………………………………………………….. 56 Figure 23. Protocol stack showing how Thread protocol fits in ………………………….. 58 Figure 24. Nest Weave Fabric Diagram ………………………………………………….. 59 Figure 25. Nest Home Simulator Application interface ………………………………….. 60 Figure 26. OpenHAB PaperUI Add-on installation screen ……………………………….. 62 Figure 27. OpenHAB PaperUI automatic device setup screen ……………………………. 63 Figure 28. OpenHAB PaperUI LIFX control interface …………………………………… 64 Figure 29. OpenHAB Nest Binding configuration screen ………………………………… 66 Figure 30. OpenHAB BasicUI Nest control interface …………………………………….. 67 Figure 31. OpenHAB Android App showing Nest controls ………………………………. 68 Figure 32. Comparison of output from test_validity.py for actual and simulated bulbs ….. 70 Figure 33. VirtualBox Settings showing mounting of Ubuntu image …………………….. 73 Figure 34. VirtualBox Clone VM screen setup …………………………………………… 74 Figure 35. Nest Developers new product setup form, showing basic configuration ……… 77 Figure 36. Nest Developer Product Security Association information ……………………. 78 Figure 37. Nest Permissions window during setup ………………………………………... 78 Figure 38. Terminal display after starting the OpenHAB service ………………………… 80 Figure 39. Non-IP Device