  The engineering of IoT systems brings about various challenges due to the
inherent complexities associated with such heterogeneous systems. In this
paper, we propose a library of statechart templates, STL4IoT, for designing
complex IoT systems. We have developed atomic statechart components modelling
the heterogeneous aspects of IoT systems including sensors, actuators, physical
entities, network, and controller. Base system units for smart systems have
also been designed. A component for calculating power usage is available in the
library. Additionally, a smart hub template that controls interactions among
multiple IoT systems and manages power consumption has also been proposed. The
templates aim to facilitate the modelling and simulation of IoT systems. Our
work is demonstrated with a smart home system consisting of a smart hub of
lights, a smart microwave, a smart TV, and a smart fire alarm system. We have
created a multi statechart with itemis CREATE based on the proposed templates
and components. A smart home simulator has been developed by generating
controller code from the statechart and integrating it with a user interface.
