-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix service - send data to firebase every hour
- Loading branch information
Showing
11 changed files
with
182 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
firebase-admin | ||
grpcio==1.13.0rc3 | ||
google-cloud-firestore==0.29.0 | ||
google-cloud-storage==1.10.0 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/python3 | ||
import os | ||
import schedule | ||
from blink import blink | ||
import time | ||
import files | ||
import firebase | ||
import calculation | ||
|
||
firebase.validateAccount() | ||
#ledPin = 11 | ||
newBlink = blink() | ||
|
||
|
||
def simpleJob(): | ||
|
||
try: | ||
for i in range(10): | ||
newBlink.ledOn(0.5) | ||
newBlink.ledOff(0.5) | ||
|
||
#Get dateTime Now | ||
currentDatetime = files.currentTime() | ||
#Diccionario - firebase | ||
nodes = firebase.dicNodes(currentDatetime, calculation.genereRandomList(), calculation.genereRandomList(), calculation.genereRandomList(), calculation.genereRandomList(), calculation.genereRandomList()) | ||
#firebase.validateAccount() | ||
firebase.insertData(nodes) | ||
#Add to logs.txt | ||
newMessage = 'New data added on:' | ||
nowConvert = files.dateTimeConvert(currentDatetime) | ||
files.manageFiles(message=newMessage ,time=nowConvert, status=True) | ||
|
||
for i in range(10): | ||
newBlink.ledOn(0.5) | ||
newBlink.ledOff(0.5) | ||
except: | ||
newBlink.ledOff() | ||
|
||
|
||
|
||
def main(): | ||
#schedule.every().hour.at(":27").do(simpleJob) | ||
schedule.every(2).minutes.do(simpleJob) | ||
while True: | ||
schedule.run_pending() | ||
time.sleep(1) | ||
|
||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/python3 | ||
import os | ||
import schedule | ||
from blink import blink | ||
import time | ||
import files | ||
import firebase | ||
import calculation | ||
|
||
firebase.validateAccount() | ||
#ledPin = 11 | ||
newBlink = blink() | ||
|
||
def simpleJob(): | ||
|
||
try: | ||
|
||
for i in range(10): | ||
newBlink.ledOn(0.5) | ||
newBlink.ledOff(0.5) | ||
|
||
#Get dateTime Now | ||
currentDatetime = files.currentTime() | ||
#Diccionario - firebase | ||
nodes = firebase.dicNodes(currentDatetime, calculation.genereRandomList(), calculation.genereRandomList(), calculation.genereRandomList(), calculation.genereRandomList(), calculation.genereRandomList()) | ||
#firebase.validateAccount() | ||
firebase.insertData(nodes) | ||
#Add to logs.txt | ||
newMessage = 'New data added on:' | ||
nowConvert = files.dateTimeConvert(currentDatetime) | ||
files.manageFiles(message=newMessage ,time=nowConvert, status=True) | ||
|
||
for i in range(10): | ||
newBlink.ledOn(2) | ||
newBlink.ledOff(2) | ||
|
||
except: | ||
newBlink.ledOff() | ||
|
||
|
||
|
||
def main(): | ||
#schedule.every().hour.at(":27").do(simpleJob) | ||
schedule.every(2).minutes.do(simpleJob) | ||
while True: | ||
schedule.run_pending() | ||
time.sleep(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |