Mobile apps can integrate sensors and actuators in Internet-of-Things systems to achieve novel and diverse functionalities. For instance, apps can implement self-management and monitoring functions to help patients manage a large number of health conditions within their (smart-) homes. However, each smart-home may contain a different and often dynamic sensor-actuator confi guration and it is undesirable to write new code for every new installation or change. Statecharts present an appropriate formal and visual design model to design apps and support automatic code generation. However, these designs assume a specifi c and static sensor-actuator confi guration. We propose parametric statecharts, an extension to statecharts that can be automatically customised to a dynamic smart-home's con figuration. We develop a translator to convert parametric statecharts into standard statecharts customised to a given system confi guration, and then a custom compiler to generate Android code. Experimental results confi rm the flexibility of the proposed approach.