Since the template can only choose 1 connection type, I am thinking to send the same data to 2 different templates. Is it possible? Does anyone do it before? if so, how do I code?
As far as I know, the connection type in the template has no functionality attached to it - it’s simply a note.
I’ve used the same template for devices connected via WiFi, Ethernet and Node-Red.
Pete.
Do you mean one single program connected to Blynk via WiFi, Ethernet and Node-Red simultaneously? not in separate program?
No.
I mean that a device based on a template which has (let us say) a connection type of WiFi can be used to connect with whatever connection type you like.
Maybe if you stopped asking hypothetical questions and explained exactly what it is that you are trying to achieve then you’d get answers that helped you move towards a solution.
Pete.
@Joe777 It is possible to have one device connecting to 2 separate templates on the Platform, not sure why you would want this, here is a brief overview:
Template 1 - Lets Call it Temperature Monitor, this will use the Wi-Fi Connection
// Your WiFi credentials.
// Set password to "" for open networks.
char wifi_ssid[] = "ssid";
char wifi_pass[] = "pass";
char wifi_auth[] = "template_1_token";
Template 2 - Lets call this humidity, this will use cellular
// Your GSM credentials.
char gsm_apn[] = "internet";
char gsm_pass[] = "pass";
char gsm_user_name[] = "me_user"
char gsm_auth[] = "template_2_token";
Your code will need to run two separate instances of Blynk
if (temperature_update == 1)
{
Blynk.begin(wifi_auth, wifi_ssid, wifi_pass);
..... do all Blynk updates
Disconnect and close the Wifi connection
}
else
{
Blynk.begin(gsm_auth, gsm_apn, gsm_user_name, gsm_pass);
... Do Blynk Updates
... Disconnect and close
}
Honestly this is too much software overhead, a simple rule in IoT 1 connection solves 1 problem. When Using GSM and Wi-Fi, the Wi-Fi is the primary connection, when that fails only then use GSM and keep the "Auth_Token" for a single interface.
I am working on a project, which want to have WiFi and GSM.( Use WiFi to send data while there’s WiFi, and GSM to send data if out of WiFi area)
However ,Blynk can only use either WiFi / GSM in a time.
But this has nothing to do with the connection type that you choose when you create your Blynk template, because as I explained earlier this is really just a memo field in the Blynk database.
The restriction comes from your device’s capabilities and the libraries and coding methods that you use.
Pete.