BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk.notify() not working in raspberry pi-python

rpi
#1

So basically I am trying to send notification from my Pi to my smart-phone but I am not getting the output on the phone.I want to send a notification everyday at 8oclock stating that it’s morning.Please Help.
Code:

import BlynkLib
import time

BLYNK_AUTH = 'YourAuthToken'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
blynk.notify('Goodmorning.')
blynk.run()
0 Likes

#2

Notifications work for me in Python… do you have the Notification widget placed in your project?

@blynk.VIRTUAL_WRITE(3)  // Button on V3
def my_write_handler(value):
    if int(value) == 1:
        blynk.notify('Button Pressed')

image

0 Likes

#3

I don’t want to keep any buttons.I just want to send a simple notification saying goodmorning.

0 Likes

#4

Silly… you don’t have to do as I did… I just grabbed a sample from my project to show it works and how I call it.

So… do you or do you not have the widget in your project?

0 Likes

#5

I have just a notification as a widget on my blynk app,and with the code I had sent above,I am not getting the notification.Please help.

0 Likes

#6

Well, you have to do something to activate the command… button, timer, happy thoughts… something.

Probably the simple Timer Widget that sends a 1 and 0 at Start and Stop times… Assign it a vPin and then use the code I already showed, set with the same vPin (minus the V) and when the Start (1) is sent so is the notification. You could even use the Stop (0) to send a “Good Night” notification :sleeping:

@blynk.VIRTUAL_WRITE(vPin)  // Timer Widget on vPin (NO V)
def my_write_handler(value):
    if int(value) == 1:
        blynk.notify('Good Morning')
    else:
        blynk.notify('Good Night')
0 Likes

#7

The above code that you just sent,sends a good morning text once I push a Virtual pin.I don’t want to do that,I just want to send a GoodMorning at 8oclock in the morning where the user doesn’t need to push any buttons to get a notification.

0 Likes

#8
  1. Replace the Auth / put this in your crontab.

  2. Add the line, all on one line to your crontab at 8:am.
    YOU’LL have to research crontab… its really easy, there are 1 billion google articles about it.

curl --header "Content-Type: application/json" --request POST --data '{"body": "google is our friend."}' http://blynk-cloud.com/<AUTH>/notify

1 Like

#9

Thank you for your help,I really appreciate it.
Does anyone else has any other ideas,I want to write it in a python script.

0 Likes

#10

Again… I just offered a suggestion :stuck_out_tongue: I am sure with a little reading of the documentation you can figure out a way to use something “button like, but not a button” to trigger your actions… if only Blynk had timer widgets… perhaps if Python/RPi only had clock features… alas, if only the scarecrow had a brain…

2 Likes