# eink-feed

A lightweight system for delivering dynamic images to eInk display (like Kindles) over a WebSocket-based protocol.
It enables remote rendering and real-time updates for information displays.

## eink-feed-server

```
eink-feed-server
    -h, --help
            Display this help and exit.

        --port <u16>
            Web server port.

        --config <str>
            Path to config file.
```

### API

- `GET /api/channel?id=<CHANNEL_ID>`:
  Returns channel configuration. Can be used by a rendering server to get display information about the image channel.
- `POST /api/frame?id=<CHANNEL_ID>&orientation=<(portrait|landscape)_(left|right)>`:
  Accepts a multipart form with a PNG (or BMP) file.
- `/api/ws/display`:
  WebSocket endpoint for protobuf communication between a display client and the server. Image data is sent over this socket.

### Configuration

```json
{
  "channels": [
    {
      "id": 1,
      "name": "test-channel",
      "display": {
        "width": 800,
        "height": 600,
        "orientation": "landscape_left"
      }
    }
  ],
  "clients": [
    {
      "name": "test-kindle",
      "channel_id": 1
    }
  ]
}
```

## eink-feed-client

Currently only runs on a Kindle 4/5 (https://git.dergrimm.net/dergrimm/kindle)

```
eink-feed-client
    -h, --help
            Display this help and exit.

        --host <str>
            eink-feed server host (e.g. hostname:port).

        --name <str>
            Client name.

        --partial
            Enable partial eink framebuffer updates. May not look as sharp but reduces flickering.
```

## eink-feed-render-departures

Render implementation that displays departure information of a public transit stop using an EFA-JSON endpoint.

```
eink-feed-render-departures
    -h, --help
            Display this help and exit.

        --url <str>
            URL of eink-feed server.

        --channel <u32>
            Channel ID.

        --efa <str>
            URL of EFA server.

        --stop <str>
            Stop ID.

        --tz <str>
            Time zone.

        --max <usize>
            Max number of departures listed.

        --show-operator
            Show operator.

        --stopfinder <str>
            Search for stops on the EFA server with the given search query.
```

<hr />

Search for stops:

`eink-feed-render-departures --efa 'https://example.com' --stopfinder 'Stuttgart' | jq`

<hr />

Render departures for a stop ID:

`eink-feed-render-departures --url 'http://<HOST>:<PORT>' --channel <CHANNEL_ID> --efa 'https://example.com' --tz 'Europe/Berlin' --show-operator --stop 'de:08111:6115'`

<hr />

![Photo of a Kindle with train departures](assets/departures.jpg)
