Smart cities currently rely on the deployment of dedicated IoT infrastructures, each from a given stakeholder, and mostly for monitoring applications. We investigate a solution to transform these vertical organizations into horizontal ones, to allow several stakeholders to share the infrastructure, for both monitoring and control applications. Our proposal uses state- based models inherited from typical embedded systems models, to represent sensors, actuators and portions of space like streets, crossings, etc. These models are automatically translated into REST resources to provide a standard interface for monitoring and control purposes. We also propose a distributed infrastructure able to execute applications with various timing requirements and conflicting needs. We illustrate these ideas with a proof of concept implementation, a programming model and guidelines for application programmers.