Internet of Things (IoT) has started to touch every aspect of our lives, from home automation, smart factories, energy management systems, precision agriculture to smart city systems, etc. Wireless Sensor Networks (WSN) play an important role in various IoT applications. One of the challenging problems for any WSN design is the lack of flexibility in network management. Software-Defined Networking (SDN) is a new approach that promises a more flexible and dynamically reconfigurable network structures. When designing WSN, the energy problem must also be considered since each device in the network has limited battery capacity. This study proposes a new routing discovery algorithm that allows the SDN-enabled WSN to make smarter routing decisions considering the received signal strength and the remaining energy of the devices. The new architecture employs a fuzzy-based Dijkstra's algorithm when deciding the best path between the source and the destination. The study also introduces a new real-time data analytics architecture for IoT applications, consisting of a WSN and radio frequency identification (RFID)technology in the vertical domain.