Blynk 2.0 - Notifications are not working correctly

Hi guys.
Notifications do not work correctly, more precisely - when you enable the “Enable notifications management” In Add new Event, you get access to the notification settings - you can turn them off, turn them off for 1 hour, 1 day, etc. If you turn it off, they all the same come, turn it on again - they start to come twice on when the Blynk application is open on the smartphone. Check it pls.

Artem.

Hello. How do you send the notifications? Are you sure you don’t have double events with the same receiver?

By button throug V0:

BLYNK_WRITE( V0 )
{
int stat = 1;
stat = param.asInt();

Blynk.logEvent( String( “01”) );
}
01 - Code in Event list

If option “Enable notifications managmant” - disabled then notifications are working fine.

Artem.

@Tema you need to use triple backticks at the beginning and end of your code when you post it to the forum.
Triple backticks look like this:
```

Your BLYNK_WRITE(V0) command doesn’t have any if statement inside it.
When you press the button it sends a “1” then when you release the button it sends a “0”. This means the the BLYNK_WRITE(V0) function will be triggered twice, so two logEvent commands will always be generated each time the button is pressed the released.

Pete.

Ok,I will do ``` next time.

My BLYNK_WRITE(V0) command is executed only once because I am using the Switch widget. I wrote that the problem occurs when the option “Enable notifications managmant” is activated. If this option DISABLED - notification work fine.


Artem.

I checked. It’s not a bug, it’s a feature :slight_smile: .

When you create the Events in the Template you can specify the default recipients. Default recipients will always get notifications. No matter what. In the device notifications, you can extend the list.

It may sound not logical, but it was done on purpose. For example, if you are a device manufacturer and you would like to see the specific event always, so the end-user can’t turn it off for you.

I agree that UX is not obvious. We’ll think how to improve that.

So for your use case - you just need to remove the default recipient in the template and that’s it.

Sorry, where are the default recipients set in the template?

Artem.

Please refer to Https://docs.blynk.io

It’s an Event in the template:

Hi Pete, you are the most loved person on this community, please help me regarding notifications issue on new blynk 2.0 i could not recieve notifications till now.

I was using this line of code in my previous blynk 1.0 with blynk legacy app in android phone.

Blynk.notify ("Warning! No Sensor");

Now i am using this line

Blynk.logEvent(String("warning_no_sensor"));

but i am not getting any notifications in new Blyn IOT app in my smartphone.

I’ve created new “Event” in my specific template in my blynk.console account and this “warning_no_sensor” is the event code copied from the “Events” list from blynk.console.

I also have performed the settings below in the images.

@Hashmi123 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:
```

Copy and paste the backticks I’ve provided if you can’t find the correct character on your keyboard.

Pete.

hello Pete, i’ve edited my post according to your instructions now is it in required format ?

Why?

The documentation says that the correct syntax is…
Blynk.logEvent("warning_no_sensor", "Optional event message");

I’ve never used this feature, so can’t provide more insight I’m afraid.

Pete.

because i found this statement in a docs.blynk.io

Replace Blynk.notify, Blynk.email, Blynk.tweet, Blynk.sms with Blynk.logEvent

at that point no other change were mentioned, you can see in the link below.

https://docs.blynk.io/en/blynk-1.0-and-2.0-comparison/migrate-from-1.0-to-2.0

after a two days search i still have not gone through this document which you are mentioning please refer me to this document so that i might check where i am mistaking because i am still not getting the notifications after putting the correct syntax like this one below you have just told. thanks so much

Blynk.logEvent("warning_no_sensor", "Optional event message");

You are the hope, lets try together, i know i am having a very little mistake somewhere.

And where in that statement does it say to convert a string literal into a string with the String command?

I don’t use Blynk in the same way as most people, so don’t run Blynk code on my devices - I use Node-Red and HTTP(S) API calls, so I don’t have any need for this functionality.

Pete.

I guess it’s Blynk.logEvent(“event_code”, String(" warning_no_sensor ") );

Pete, i followed this syntax due to another person’s code line in this post above. Here it is

by “Tema”, who initiated this thread.

Yes, i have corrected my syntax perfectly in accordance with the document you have provided me, thanks so much for this. I got away a little while from the laptop and the smartphone and came after two hours and then i saw the desired notification on the smartphone screen and i noted down the time interval in which the notifications came.
Now notifications again stopped coming as i forgot the changes which i have made in code and the “Events” in the blynk.console too due to the two hours gap.

and again stucked at the same issue :grimacing:

I thought you are an official from the Blynk team thats why i expected your little try, thanks again for your support.

Hi John, you are also having a good guess but this syntax worked fine, two hours ago

Blynk.logEvent("warning_no_sensor", "Optional event message");

but now again, not having any notifications after several tries on code as well as “Events” in blynk.console

Putting text inside quotes makes it a string literal (or text that can be seen as a char also, but that’s not relevant here).
String() is used to turn a different variable type into a string, so if you had an integer with the value of 100 then `String(integer_variable_name) will convert 100 to “100”.

Converting what is already a string into a string is pointless, so the String() in this command is redundant.

Pete.