The problem of task allocation in the Internet of Things and the consensus-based approach