View on GitHub

code-deck

πŸŸͺ🟧🟩πŸŸ₯ Code Deck is a cross platform and open source alternative to the official Stream Deck application.

WebRequest

The WebRequest plugin contains a collection of tiles that can request and display data from the Internet.

Updates run immediately and then at the configured interval. Pressing a tile requests another update; manual and periodic updates for that tile do not overlap. Failures are logged through ILogger with exception details and appear in Plugin Tasks… for recurring updates. The last successful text/image remains visible, and the next periodic update retries. Expected cancellation during reload or shutdown is not logged as an update failure.

Tiles share one HTTP client per plugin load. It is disposed when the plugin is unloaded. Image buffers owned by a tile are released when replaced or deinitialized. URLs must be absolute HTTP/HTTPS URLs, and update intervals must be positive.

PlainTextTile

This tile does a web request to the specified URL and shows the text result on the key. This tile should be used when requesting plain text (Content-Type: text/plain) data.

Usage

A use case for this tile could be to retrieve and display some sensor data or maybe get a random integer from random.org.

Settings

Setting Default Description
Url null The URL to request.
Format {0} How to format the text on the key.
Interval 60000 ms Update interval.

Example Config

{
  "FontSize": 22,
  "FontBold": true,
  "LineSpacing": 1.2,
  "Plugin": "WebRequest",
  "Tile": "PlainTextTile",
  "ActivityIndicatorColor": "#ffffff",
  "BackgroundColor": "#4d0977",
  "TextColor": "#bbbbbb",
  "Settings": {
    "Interval": "10000",
    "Url": "https://www.random.org/integers/?num=1&min=1&max=50&col=1&base=10&format=plain&rnd=new",
    "Format": "🌑️\n{0}°"
  }
}

Url

The URL to retrieve data from. The URL should point to some data served as plain text (Content-Type: text/plain).

Format

The format to use when showing the data on the key.

Examples:

Interval

The time between requests to the specified URL.

ImageTile

This tile does a web request to the specified URL and shows the retrieved image on the key. This tile should be used to retrieve image data. The image data must be in a format listed here.

Usage

A use case could be to display an image from a webcam.

Settings

Setting Default Description
Url null The URL to request.
Interval 60000 ms Update interval.
Size 72 Positive output image size in pixels; the result is square.
Crop false Crop the image to fill the key.

Example Config

  {
  "Plugin": "WebRequest",
  "Tile": "ImageTile",
  "Settings": {
      "Url": "https://heinandre.no/code-deck/Images/icon-128.png"
    }
  }

Url

The URL to retrieve an image from. The image data must be in a format listed here.

Interval

The time between requests to the specified URL.

Crop

If set to true, the image will be cropped to a square aspect ratio to fill the entire key. The image will be cropped from the center of the image.