Newbie question - Online status Virtual LED in app

Because I use a single auth key on multiple devices.
Sometimes I cannot tell which device is down. The status in the app can only show if any device is online.

I want to add a virtual led to indicate the status if my device is online.
If my device is offline the v-led will be off too.

Stupid like me just simply thought I can do it in this way.
My plan is to use virtual led widget and bind it to V50~V55 (different v-pin on different device).
My script is something like:

WidgetLED led1(V50);

   if(Blynk.connected())
  {
    Blynk.run();
    led1.on();
  } else{
    led1.off();
}

Then I made a device can be online forever. :rofl:

Is there any way to make a push type led or example to achieve what I want?

Thanks in advance.

@HongChen Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.

Triple backticks look like this:
```

Pete.

1 Like

While you continue to do this, Blynk won’t work as designed.
One of the fundamental expectations of Blynk is that the Auth token is unique to the device.

This is impossible to do from the device. When the device is offline (not connected to the Blynk server) then it can’t tel the server that it’s offline.
The on/offline indication has to come from the server itself.when the server sees a device with a unique Auth token connect to it, it marks that device as being online. When that device disappears from the server’s view for the default timeout period, the server marks it as offline.
Of course, this requires only one device to be using that particular Auth token.

Pete.

Thank you Pete! Yeah I know your idea.
I think that’s why the app is considerately provided a status icon on the top right corner.
I should use different auth token on different device then I can get the status of them.
But so far I only learned I can add 4 devices in the same page (maybe I can add more? sorry I am still learning. maybe I need to use bridge or something to make it more…)
But now I have 8 gates to control (I meant 8 different devices to open the gates)
and they actually doing the same thing even using the same script.
So I intuitively just use the same auth token to control them.
That might be the easiest way for me now.

So I think I need to make a new device (like a server ) to detect response from all other devices.
And add a script to other devices to send a signal to the server “Hey I am alive”. Then I can collect the status from the server.

Are you using Blynk Legacy or Blynk IoT ?
If it’s Blynk IoT, what subscription plan do you have?

Not necessary. Use separate Auth tokens as Blynk intended and the Blynk server will give you the on/offline status of each device.

Pete.

I am still using Blynk Legacy.

Anyway I think I have new idea after your answer.
In this project I will try another solution to make it.

In other project I will follow the design of Blynk to use separate auth tokens.

Thank you so much.

Pages are a Blynk IoT concept.I assume youare talking about a single project?
I’m not aware of any limitations, but if there are then you can simply use Bridge to send data from one device to another.

Pete.

Yes. I meant in a single project.

Thank you for the advice.
Now I am heading the project this way. :wink:

It’s just been announced that the Legacy servers will be shut down at the end of this year, so all Legacy projects will stop working then…

so you might want to head in the Blynk IoT direction first.

Pete.

2 Likes