Creating multiple "Virtual Devices" on a single physical device

Hello all - I’m looking for suggestions on how to create many “virtual devices” (each with their own auth token) all running from the same physical device. In my case, this is a Raspberry Pi device, and I need to create many virtual devices as the Pi is aggregating many networked devices that are not able to operate using Blynk. For example, I have lights that are controlled via Wifi, pumps that are controlled via a dedicated (closed) controller over RS422, and a security platform that has it’s own dedicated (closed) controller.

A “simple” approach would be to have a different process instantiation (launch the program) for each device, where I use a configuration file and/or command line options to instruct each launched process what device is it managing and what auth token it should use). Anyone have any reason why this might not work? I’ll be trying it in the next couple of days unless somebody says it’s not going to work.

But a better answer would be to have a single process able to subscribe to the Blynk server as multiple devices (again, each with their own Auth Token). But in looking at the documentation, I don’t see an obvious way to approach this.

Anyone else tried to tackle this problem?

Thanks…

Chris

Am I correct in understanding that you only want a single “control/monitoring” App for everything?

If so, it is easy to create multiple “hardware clients” on an RPi, all linked by “Device” in the App, with or without device selector. You just run each one as a separate sketch with it’s own AUTH and vPins (memory and CPU will be your bottleneck). But to what purpose? There is still a finite number of GPIO and you shouldn’t need multiple clients to utilise discrete API commands to/from your other stuff anyhow.

Perhaps I am misinterpreting your needs?

I would much prefer to have a single device / auth token for sure. But I’m struggling with a user interface limitation where I need each of the devices (of a particular type) have a secondary page with control options and settings, and the Device Selector is a great fit.

For example, the dashboard would have a tab at the top with the various major device types (lights, pumps, etc). Then on the lights template, it would have a Device Selector - one for each light. By clicking on a tile I can turn on/off the light, but by long-press I can get a management page to set more detailed options (color, brightness, etc). For this to work, Device Selector requires that each light be managed by a unique device (auth token), and not just pins on the same device.

Until the day comes that we have a widget like a “Pin Selector”, I’m thinking the best way to solve this is to create multiple “virtual devices” for those that need to use the Device Selector.

Does that make sense? Perhaps I’m missing a better way to do this?

Thanks, Gunner!

It would be quite a bit of work to achieve (but then again, a project of this complexity would anyway), but one solution is to use Node-Red and MQTT running on your Pi.
The Blynk plug-in for Node-Red allows as many devices as you want to be created, each with their own auth code (actually, I think there may be a device limit within Blynk, but I’m not sure if this applies just to cloud server).

With this arrangement, Node-Red provides the logic and processing for communicating with the remote devices. This could be via direct pin communication on the Pi, or by sending a command via an MQTT message to the remote device. Node-Red has many other plug-ins that support different types if peripherals and this may make life easier. For example, I use plug-ins for Amazon Alexa and IKEA Tradfri as well as Blynk.

Node-Red also has its own dashboard, but I wouldn’t go down that route if I were you.

Pete.

Sounds like you are describing Hub topology, which is not supported by Blynk yet.

Once it’s done, such scenarios would require additional UX solutions.

Pete - thanks for the recommendation. Looks like it could be a great fit and substantially simplify the project. I’m going to give it a go and see what happens…! Appreciate the help.

Take a look at this series of posts on the subject…

Pete.

So Hub Topology would allow a single “physical device” (with one and only one auth token) to present itself as multiple “virtual devices” (e.g., one Device Tiles widget tile per virtual device)?

Joe

It’s an open question, for sure. We would definitely need some identifiers of nodes that talk to the hub.