Blynk Tools
Command-line automation tools for working with Blynk IoT Platform
Installation
npm install -g blynk-tools
Features
- Device
- Maintain device list
- Show device status
- Read/write virtual pins
- Provision device WiFi credentials
- Initiate OTA (soon)
- Gateway
- Connect your BLE devices to the Blynk server
- Connect your USB/Serial devices to the Blynk server (soon)
- Firmware
- Extract info tags from the firmware
- Replace/patch info tags
Getting Started
Register an account using Blynk App, and create a new project.
Use the provided auth token to register your device for use in blynk tools
:
> blynk device add 1a5c3988d60f477db6bac3417df7396d --name=CoolDevice1⠋ Adding device...● CoolDevice1
If the device is recognized, it displays it's name and online/offline status. You can add multiple devices.
For more info on device add
command, run device add --help
.
Now let's check the device status:
> blynk device list⠋ Refreshing device status...┌────────┬────────────────┬────────┬───────────┐│ Status │ Name │ Server │ Token │├────────┼────────────────┼────────┼───────────┤│ ● │ PC Remote │ Blynk │ ...36a645 ││ ○ │ Bluetooth test │ Test │ ...427f4c ││ ● │ CoolDevice1 │ Blynk │ ...f7396d │└────────┴────────────────┴────────┴───────────┘
We can manipulate virtual pins of your devices (you need to specify either device name or auth token):
> blynk virtualWrite --device=CoolDevice1 V0 123V0 set to [123]> blynk virtualRead --device=CoolDevice1 V0[123]
Many commands in this suite require a --device
to be specified.
It may become cumbersome, so let's select the default device:
> blynk config default.device "CoolDevice1"New default.device value: "CoolDevice1"
Now blynk virtualWrite V0 123
works, and you can also see the default device in the device list:
> blynk device list┌────────┬────────────────┬────────┬───────────┐│ Status │ Name │ Server │ Token │├────────┼────────────────┼────────┼───────────┤│ ● │ PC Remote │ Blynk │ ...36a645 ││ ○ │ Bluetooth test │ Test │ ...427f4c ││ ● ⇨ │ CoolDevice1 │ Blynk │ ...f7396d │└────────┴────────────────┴────────┴───────────┘
For more commands and examples, run blynk [command] --help
.
You can also enable command completion on BASH/ZSH/etc:
eval "$( blynk completion )"