This paper proposes a Smartphone-Assisted Localization Algorithm (SALA) for the localization of Internet of Things (IoT) devices that are placed in indoor environments (e.g., smart home, smart office, smart mall, and smart factory). This SALA allows a smartphone to visually display the positions of IoT devices in indoor environments for the easy management of IoT devices, such as remote-control and monitoring. A smartphone plays a role of a mobile beacon that tracks its own position indoors by a sensor-fusion method with its motion sensors, such as accelerometer, gyroscope, and magnetometer. While moving around indoor, the smartphone periodically broadcasts short-distance beacon messages and collects the response messages from neighboring IoT devices. The response messages contains IoT device information. The smartphone stores the IoT device information in the response messages along with the message's signal strength and its position into a dedicated server (e.g., home gateway) for the localization. These stored trace data are processed offline through our localization algorithm along with a given indoor layout, such as apartment layout. Through simulations, it is shown that our SALA can effectively localize IoT devices in an apartment with position errors less than 20 cm in a realistic apartment setting.