To capture the full lifecycle of the IoT devices, the device model has multiple stages. This captures the whole behaviour of the devices as they can behave differently in different scenarios.
In any device model two stages, the Init and the Finished are always present and cannot be deleted. They represent the first stage of the device lifecycle as it is initialised and the final stage of the device when it needs to shut down.
Apart from these two stages, an additional stage named Running is created by default. This stage is supposed to be the active stage of the device. The bulk of the device logic should go in the running stage and other stages that can be created between Init and Finished. There is no limitations to the number of such stages.
Having the device model broken into such stages makes it easier to work with the device and allows for a high degree of complexity to be implemented in the device model.
Let's now look at how to work with these stages. Starting with the Init Stage.