 
   def init([]) do
     token = ConfigStorage.get_config_value(:string, "authorization", "token")
+    email = ConfigStorage.get_config_value(:string, "authorization", "email")
 
     import Farmbot.Jwt, only: [decode: 1]
     with {:ok, %{bot: device, mqtt: mqtt_host, vhost: vhost}} <- decode(token),
-         {:ok, conn}  <- open_connection(token, device, mqtt_host, vhost),
+         {:ok, conn}  <- open_connection(token, email, device, mqtt_host, vhost),
          {:ok, chan}  <- AMQP.Channel.open(conn),
          q_base       <- device,
 

    end
  end

  defp open_connection(token, device, mqtt_server, vhost) do
    opts = [
      host: mqtt_server,
      username: device,
      password: token,
      virtual_host: vhost]
    AMQP.Connection.open(opts)
  end

  def terminate(reason, state) do


         {:ok, _tag}  <- Basic.consume(chan, q_base <> "_from_clients", self(), [no_ack: true]),
         {:ok, _tag}  <- Basic.consume(chan, q_base <> "_auto_sync", self(), [no_ack: true]),
         state <- %State{conn: conn, chan: chan, bot: device}
    do
      _ = Process.monitor(conn.pid)
      _ = Process.monitor(chan.pid)
      _ = Process.flag(:sensitive, true)
      _ = Process.flag(:trap_exit, true)
      {:consumer, state, subscribe_to: [Farmbot.BotState, Farmbot.Logger]}
    else
      {:error, {:auth_failure, msg}} = fail ->
