## 5 Experiments
### Key Findings  
The design, implementation and practical evaluation of ZiWi allowed for obtaining diverse relevant findings that are worth being summarized for future HAS developers:  
* The use of open-source software and COTS parts is essential to guarantee that the HAS can be replicated by third-parties. This is a key advantage over other academic and commercial systems, which are based on proprietary hardware or software, thus making it difficult to corroborate the obtained experimental results.
* Since ZiWi was conceived from scratch to be implemented on a fog computing architecture, it is really easy to scale it by only adding gateways. This usually occurs in two situations: when the number of home devices is too large to be handled by a single gateway, or when the wireless range provided by the fog gateways is not enough to cover the whole home or building. In such situations, fog gateways provide service redundancy and are able to communicate among them to route the data to the cloud.
* The use of OpenHAB resulted in an HAS that is really easy to manage through an attractive GUI and that is able to use a great deal of plugins to automatize many home automation tasks.
* The use of IFTTT makes it easy to connect the multiple devices deployed throughout a home, thus being able to automate the detection the relevant events and making it ideal for context-aware applications.
* The proposed system is able to decouple the hardware and software from the cloud, which reduces latencies remarkably, especially for real or quasi-real time applications (e.g., when opening doors or turning on certain appliances).
* The use of fog gateways offloads a relevant number of tasks from the cloud and also increases security. Such a security is essential for preserving the privacy of the user data, which do not have to be sent to the cloud and that do not have to be stored in servers maintained (and secured) by third-parties. In addition, device access and data availability depend mostly on fog gateways, so the communication blackouts that occur in the cloud have a limited impact on the HAS.
* The use of MQTT enables addressing most of the compatibility issues associated with the diversity of protocols, technologies and standards that exist in the field of home automation. In addition, MQTT consumes very few computational resources, so it can be implemented on resource-constrained devices.
* ZigBee-WiFi cross-interference can be problematic in environments where a lot of data are exchanged, but, in most home networks, under regular use of the communication resources, although packets can become corrupted, most of them should arrive correctly. Nonetheless, a careful frequency planning is recommended to minimize interference.
* The cost of the whole demonstrator (indicated in Table 2) is less than 20% of the cost of a basic commercial system (around $1000). Therefore, ZiWi not only is able to add numerous features, but also opens the field of home automation to many people that cannot afford costly commercial solutions.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{Mode} & \multicolumn{2}{c}{**Sensor Node Consumption (mA)**} & \multicolumn{3}{c}{**Actuator Node Consumption (mA)**} \\ \cline{2-7}  & **Without Encryption** & **With APS Encryption** & **Difference** & **Without Encryption** & **With SSL Encryption** & **Difference** \\ \hline Average & 23.494 & 24.006 & +2.13\% & 39.369 & 87.800 & +55.16\% \\ In Transmission & 55.200 & 56.400 & +2.13\% & 96.950 & 117.74 & +17.66\% \\ Idle & 12.925 & 13.208 & +2.14\% & 20.175 & 21.940 & +8.06\% \\ \hline \hline \end{tabular}
\end{table}
Table 10: Node consumption with and without encryption.