 
   defp frontend_topic(bot), do: "bot/#{bot}/from_device"
   defp bot_topic(bot), do: "bot/#{bot}/from_clients"
+  defp sync_topic(bot), do: "bot/#{bot}/sync"
   defp status_topic(bot), do: "bot/#{bot}/status"
   defp log_topic(bot), do: "bot/#{bot}/logs"
 end

  end

  def on_publish(["bot", _bot, "from_clients"], msg, state) do
    Logger.warn("not implemented yet: #{msg}")
    msg
    |> Farmbot.CeleryScript.AST.parse()
    |> Farmbot.CeleryScript.VirtualMachine.execute()
    {:ok, state}
  end



  def on_connect(state) do
    GenMQTT.subscribe(self(), [{bot_topic(state.device), 0}])
    GenMQTT.subscribe(self(), [{sync_topic(state.device), 0}])
    Logger.info("Connected!")

    if state.cache do
