-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathWater_Lv.py
More file actions
31 lines (15 loc) · 739 Bytes
/
Water_Lv.py
File metadata and controls
31 lines (15 loc) · 739 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
import mysql.connector
import Config
import Speak
class get_WaterLv:
def __init__(self):
sql_connection = mysql.connector.connect(host=Config.HOST_NAME, user=Config.USER_NAME, password=Config.PASSWORD,database=Config.DATABASE_NAME)
connection = sql_connection.cursor()
SQL = "SELECT Water_Level from real_time_box_2;"
connection.execute(SQL)
result = connection.fetchall()
for x in result:
data_get = (int(x[0])/470)*100
print("Current Water Level In Hydroponics Area " + str(round(data_get)) + ' percentage')
Speak.Speak("Current Water Level In Hydroponics Area " + str(round(data_get)) + 'percentage')
sql_connection.close()