     end)
     {:noreply, final_state}
   end
+  def handle_info({:new, {:device, id, name}}, state = %__MODULE__{devices: ds}) do
+    d = %Device{id: id, name: name}
+    Logger.info "New controller: #{inspect d}"
+    {:noreply, %__MODULE__{state | devices: Map.put(ds, id, d)}}
+  end
+  def handle_info({:change, {:device, id, attributes}}, state = %__MODULE__{devices: ds}) do
+    case Map.get(ds, id) do
+      nil -> Logger.error("Unknown device #{id}")
+      d ->
+        new_d = struct!(d, attributes)
+        {:noreply,  %__MODULE__{state | devices: Map.put(ds, id, new_d)}}
+    end
+  end
   def handle_info({:new, {:controller, id, name}}, state = %__MODULE__{controllers: cs}) do
     c = %Controller{id: id, name: name}
+    Logger.info "New controller: #{inspect c}"
     {:noreply, %__MODULE__{state | controllers: Map.put(cs, id, c)}}
   end
   def handle_info({:change, {:controller, id, attributes}}, state = %__MODULE__{controllers: cs}) do
     case Map.get(cs, id) do
       nil -> Logger.error("Unknown controller #{id}")
       c ->
-        new_c = struct(c, attributes)
+        new_c = struct!(c, attributes)
         {:noreply,  %__MODULE__{state | controllers: Map.put(cs, id, new_c)}}
     end
   end

    GenServer.call(ble, :controllers)
  end

  defstruct [:driver, :monitor_ref, :controllers]

  defmodule Controller do
    @moduledoc """

    Logger.info("Driver #{inspect state.driver} is down")
    {:stop, :driver_down, state}
  end
  # def handle_info(msg, state) when is_tuple(msg) do
  #   Logger.error "GenBle.handle_info: Ignoring unknown message #{inspect msg}"
  #   {:noreply, state}
  # end

  defp reply(ret_value, state) do
    {:reply, ret_value, state}
