-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblynk_integration.py
More file actions
31 lines (23 loc) · 857 Bytes
/
blynk_integration.py
File metadata and controls
31 lines (23 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# imports
import BlynkLib
import os
from time import sleep
from dotenv import load_dotenv
# loading contents of .env
load_dotenv('.env')
# retrieving blynkAuth from .env
blynkAuth = os.getenv('blynkAuth')
# initialize Blynk
blynk = BlynkLib.Blynk(blynkAuth)
# register handler for virtual pin V0 write event (not used but was conceived to allow user to dictate start time via phone input)
@blynk.on("V0")
def v3_write_handler(value):
sleep(.5)
# register handler for virtual pin V1 write event (this is the virtual pin used to display ETA on the users phone in-app)
@blynk.on("V1")
def v3_write_handler(value):
sleep(.5)
# register handler for virtual pin V2 write event (this is the virtual pin used for automations relating to phone notifications)
@blynk.on("V2")
def v3_write_handler(value):
sleep(.5)