Docs

Image

The Image widget shows a picture from a URL.

Use it for: a camera snapshot, a diagram of your wiring, a floor plan, a status graphic that changes with the state.

SettingWhat it does
Pinthe virtual pin that selects the image
URLsthe list of images, one per index
Scalehow the picture fits the tile

Open these from the canvas: tap Edit, then long press the widget and choose Configure.

Example

Send an index and the widget swaps the picture.

image.ino
#include <PlynxSimpleEsp32.h>

#define DOOR_PIN 4

PlynxTimer timer;
bool wasOpen = false;

void checkDoor()
{
  bool isOpen = digitalRead(DOOR_PIN) == HIGH;

  if (isOpen != wasOpen) {
    Plynx.virtualWrite(V33, isOpen ? 2 : 1);   // 1 closed, 2 open
    wasOpen = isOpen;
  }
}

void setup()
{
  Serial.begin(115200);
  pinMode(DOOR_PIN, INPUT_PULLUP);

  // Auto setup: WiFi and the Plynx token are configured from the app.
  //
  // To provide them directly in the sketch instead, use:
  //   Plynx.begin(auth, ssid, pass);
  Plynx.begin();

  timer.setInterval(2000L, checkDoor);
}

void loop()
{
  Plynx.run();
  timer.run();
}

Indexes start at one, matching the order of the URLs in the widget settings.

The image loads from the internet on the phone. A URL on your home network works at home and shows nothing when you are out.

Troubleshooting

ProblemCheck
Tile stays blankthe URL is unreachable from the phone, or needs a login
Picture never changesthe index sent does not match a URL in the list
Image is stalethe phone cached it; add a changing query to the URL
Loads slowlythe file is large; a dashboard tile needs a small picture

Next