       nil
     end
 
-    {:ok, %{gpio_number: gpio_number, type: type, gpio_pid: pid}}
+    {:ok, %{gpio_number: gpio_number, type: type, gpio_pid: pid, last_signal: Time.now()}}
   end
 
   def handle_call(request, from, state) do

    {:noreply, state}
  end

  def handle_info({:gpio_interrupt, _gpio_port, :falling}, state) do
    Logger.info "Ding dong! Notifying..."
    door_id = Application.get_env(:gatekeeper, :door_lock)[:door_id]
    {:ok, _response} = HTTPoison.post @notify_url, {:multipart, [{"door_id", "#{door_id}"}]}
    {:noreply, state}
  end
  def handle_info(msg, state) do
    Logger.debug "Received Info msg - #{inspect msg} - state #{inspect state}"
    {:noreply, state}
  end
end


  require Logger

  use GenServer
  use Timex

  @notify_url "http://10.3.18.99:4000/api/door_bell"

