Metamodeling of Smart Environments: From design to implementation