BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Automation based on template in stead of device

Hi,

I have started implementing automations to generate notifications.

I have a vpin that contains the battery percentage and want to send an email when the level is too low.

As I (hopefully) will have 100s of devices I do not want to configure this (exactly the same automation) for each device.

Is there a way to define this on template level?

Regards,
Jeroen

Try Blynk notify. With few lines of code you can get it running. No need of automation.

did some more in detailed reading, if I understand correctly automations are for end users and not to do generic (template wide)… pity you cannot also use them for all devices. Maybe nice feature update?

Madukesh, I assume you mean generating notifications in the code on the esp that trigger an event that sends a notification…?
We will look into this, thx!

1 Like

Actually, you can.
For example, you can create multiple automations, if device A virtual pin is equal to 100, send notification to all organization members. If device B virtual pin is equal to 50, send email to all organization members. If device C virtual pin is greater than 100, forward device data to device D etc…

@John93 I think you mean making separate automations per device per virtual pin?

In the 1st post I mentioned only 1 sensor to simplify my question, but in fact I have 5 wireless sensors per device for which I all want to get a low bat notification.

So if I have 100 devices I would need to make 500 automations :frowning:

So I am looking for a way to do this generic per template then I only would need to make 5 automations.

I know I can use events but that would mean I have to put it in the fw of the device, this is an option but having notifications on template level would be more felxible.

In this case, I’d suggest using Node-RED and blynk plugin instead of automation.

Why are you even thinking about using Automations to do this?

Pete.

That is indeed a viable option.

Why not… :slight_smile: I thought it would be the perfect central (meaning not needing to use another tool like node-red) and flexible solution for defining/sending notifications based on a config on template level.

Maybe some background will clarify my requirements, we use Blynk as back-end for managing holiday houses (water usage, electricity usage, heating control, electronic lock etc…). So the holiday park will be the owner of all (maybe 100+) devices. We have a pre-defined set of alerts/notifications that we want to roll out for each device.

I guess this differs from the use case where you sell 1 device to 1 owner that can make his own automations.

Personally, I see Automations as a way to provide an end-user customisable interface - such as when your lights are going to turn on an off, or as a tool for people with no coding skills.

In a situation where you want an alert to tell you that one of your sensors has a low battery then coding this in the sketch seems like the simplest and most reliable solution. You aren’t going to need those alerts to be customised by the end users (and even if you did then there are ways to do that) and from what you’ve said there will always be the same number of sensors (but again you can deal with that possibility in other ways).

I’m a big fan of Node-Red (when used with MQTT) and it forms the core of all my home automation systems, with Blynk as a UI. However, I don’t think it’s necessary to achieve what you want in this situation, and it adds a degree of complexity that may not be necessary.
If you do use Node-Red then running MQTT rather than Blynk code on your devices is the way forward in my opinion (based on about 5 years of doing this). I prefer my Node-Red/MQTT server to be on-site, which may make it a non-starter if you want a simple fit-and-forget solution.

Pete.

1 Like

Yes, I understand now that is the way it was intended.

We do use node red to interface with databases and third parties (booking software) and I understand what you say about the simplicity of MQTT.
But I really like how Blynk provides the UI for the customer/support (both app as web-dashboard), the option to update firmware remotely and the ability to group devices by organizations.
Building/maintaining this ourselves would take a lot of effort…

thx for the feedback!!

As I said, I use Blynk as my UI and the only thing that I lose-out on by not running the Edgent based code on my devices is the ability to do dynamic provisioning and Blynk.Air updates.
For me, dynamic provisioning isn’t an issue anyway, as I have a WiFi SSID specifically for home automation devices to connect to, which is different to my regular and guest SSIDs, so that is 100% within my control and having devices hard-coded to that SSID and it’s associated password is preferable in this situation.
I use Arduino OTA to do OTA updates, but this is limited to operating within the same network. I keep meaning to take a look at whether sending the Blynk.Air OTA url via an MQTT topic would work, but haven’t tried that yet.

Pete.