Skip to main content

Blynk.io

Blynk.io provides an IoT dashboard for devices with virtual pins.

The pelikhan/devicescript-blynk package uses the HTTPS REST API to send data from devices.

Getting started

  • Create a new DeviceScript project
  • Add the library to your DeviceScript project:
npm install --save pelikhan/devicescript-blynk

Configuration

# .env.local
BLYNK_TOKEN=your-token

Uploading data

Use updateDatastream to update multiple virtual pins at once.

import { Temperature, Humidity } from "@devicescript/core"
import { delay, millis } from "@devicescript/core"
import { updateDatastream } from "devicescript-blynk"

// connect sensors
const temperature = new Temperature()
const humidity = new Humidity()

while (true) {
// read sensor values
const t = await temperature.reading.read()
const h = await humidity.reading.read()

// send blynk.io data
await updateDatastream({
v1: t,
v2: h,
})

// take a break
await delay(10000)
}