Better refactoring of mqtt_listen.rb