-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail_spreadsheet.py
More file actions
32 lines (25 loc) · 973 Bytes
/
email_spreadsheet.py
File metadata and controls
32 lines (25 loc) · 973 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
32
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 14 15:54:13 2019
@author: pi
"""
import email_handler
import graph
import time
class Email_Spreadsheet:
def __init__(self, config, schedule):
self._config = config
self.schedule = schedule
def send_spreadsheet_and_graph(self, file_name):
Graph = graph.GraphDrawer()
email = email_handler.EmailHandler(self._config)
Graph.draw_light_level_graph(file_name)
Graph.draw_moisture_level_graph(file_name)
print('Emailing spreadsheet')
email.send_email("AutoGroundKeeper -- Spreadsheet", "Data on light and moisture of plant", [
file_name, "LightGraph.png", "MoistureGraph.png"],
self.schedule, False)
def send_email_every_week(self, file_name):
self.send_spreadsheet_and_graph(file_name)
return time.time() + self._config.get_user_preferences('Email_Duration')