     # Copy configs
     [current, _] = repos
     copy_configs(current)
-    {:ok, %{repos: repos, needs_hard_sync: needs_hard_sync}}
-  end
-
-  defp copy_configs(repo) do
-    case repo.one(Device) do
-      nil -> :ok
-      %{timezone: tz} ->
-        ConfigStorage.update_config_value(:string, "settings", "timezone", tz)
-        :ok
-    end
-  end
-
-  def terminate(_,_) do
-    BotState.set_sync_status(:sync_error)
+    {:ok, %{repos: repos, needs_hard_sync: needs_hard_sync, timer: start_timer()}}
+  end
+
+  def terminate(reason,_) do
+    if reason not in [:normal, :shutdown] do
+      BotState.set_sync_status(:sync_error)
+    end
+  end
+
+  def handle_call(:force_hard_sync, _, state) do
+    maybe_cancel_timer(state.timer)
+    BotState.set_sync_status(:sync_now)
+    {:reply, :ok, %{state | timer: nil, needs_hard_sync: true}}
   end
 
   def handle_call(:current_repo, _, %{repos: [repo_a, _]} = state) do

        obj.__struct__.changeset(existing, Map.from_struct(obj))
        |> repo.update()
    end

    case res do
      {:ok, _} -> :ok
      {:error, reason} -> {:error, obj.__struct__, reason}
    end
  end


         :ok <- sync_resource(repo, Tool, "/api/tools")
    do
      :ok
    else
      err ->
        Logger.error 1, "sync on #{repo} failed: #{inspect err}"
        err
    end
  end

  defp sync_resource(repo, resource, slug) do
    Logger.debug 3, "syncing: #{resource} (#{slug})"
    as = if resource in @singular_resources, do: struct(resource), else: [struct(resource)]

    with {:ok, %{status_code: 200, body: body}} <- Farmbot.HTTP.get(slug),
         {:ok, obj_or_list} <- Poison.decode(body, as: as)
    do
      case do_insert_or_update(repo, obj_or_list) do
        {:ok, _} when resource in @singular_resources -> :ok
        :ok -> :ok
        err -> err
      end
    else
      {:error, reason} -> {:error, resource, reason}
      {:error, resource, reason} -> {:error, resource, reason}
      {:ok, %{status_code: code, body: body}} ->
        case Poison.decode(body) do
          {:ok, %{"error" => msg}} -> {:error, resource, "HTTP ERROR: #{code} #{msg}"}
          {:error, _,} -> {:error, resource, "HTTP ERROR: #{code}"}
          {:error, _, _} -> {:error, resource, "JSON ERROR: #{code}"}
        end
    end
  end
