# `NestGen2.Host.Viewer`
[🔗](https://github.com/integration-technology/nest_gen2_sdk/blob/v0.6.6/lib/nest_gen2/host/viewer.ex#L1)

The Nest's screen in a browser, when running on a computer (`target: :host`).

Serves `http://localhost:4000` with OTP's own web server (`:inets`), so it
adds no dependencies. The page shows the screen as it is drawn and turns the
ring with the mouse wheel or the arrow keys; click or press Space/Enter to
press it. Buttons give a double click, a long press and someone walking past.

Config: `host_viewer` (default true), `host_viewer_port` (4000),
`host_viewer_ip` (`{127, 0, 0, 1}`: only this computer; from another one, use
an SSH tunnel, see `docs/host.md`) and `host_viewer_controls` (true; false
makes it watch-only, for showing the app publicly: no buttons, every POST
refused, and replies a cache in front may keep for a second).

Endpoints, for scripts and tests too:

  * `GET /screen.png` — the screen
  * `GET /state` — `awake` or `asleep`
  * `POST /turn?deg=N`, `/step?dir=cw|ccw`, `/click`, `/double_click`,
    `/long_press`, `/motion`, `/climate?t=21.5&h=45`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
