README.md

# NervesHeadlessWifi

[![Build Status](https://travis-ci.org/laibulle/nerves_headless_wifi.svg?branch=master)](https://travis-ci.org/laibulle/nerves_headless_wifi)

__Disclamer__: This package is only an experiment and is not ready for production.

Nerves Headless Wifi create an access point to configure wifi at runtime. It can be used as a REST API or as a webform.

```bash
curl -X POST \
  http://your_ip:4001/ \
  -H 'Content-Type: application/json' \
  -d '{
        "ssid": "your ssid",
        "psk": "your secret",
        "key_mgmt": "WPA-PSK"
```

## Todo

- Configure wifi via bluetooth

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `nerves_headless_wifi` to your list of dependencies in `mix.exs`:

```elixir
def application do
  [
    mod: {MyApp.Application, [:nerves_headless_wifi]},
  ]
end

def deps do
  [
    {:nerves_headless_wifi, git: "https://github.com/laibulle/nerves_headless_wifi.git", tag: "master"}
  ]
end
```

__config.exs__

```elixir
config :nerves_network, :default,
  wlan0: [
    networks: [
      [
        ssid: "MyAccesPoint",
        psk: "0123456789",
        key_mgmt: :"WPA-PSK",
        mode: 2,
        ipv4_address_method: :dhcpd
      ]
    ]
  ],
  eth0: [
    ipv4_address_method: :dhcp
  ]

config :nerves_headless_wifi,
  config_path: "/root/wifi.json",
  mdns: "myapp.local",
  port: 4001,
  iface: "wlan0"
```



Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/nerves_headless_wifi](https://hexdocs.pm/nerves_headless_wifi).