File size: 4,939 Bytes
f18f04b
2923221
e9edc80
3ea419a
a0d46bb
 
2923221
e9edc80
5e5ef88
2923221
16a7715
 
c7511da
8545312
16a7715
7c30a13
c6ed031
c337d62
2923221
 
e9edc80
ec447d0
16a7715
 
 
8d825b0
16a7715
 
37bd79c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1ee52b
 
e9edc80
3ab3bfe
ec447d0
2923221
 
 
 
30cb684
7a42f0c
2923221
 
 
 
 
 
1bfefb1
71e318b
 
336718b
2ab4f80
2923221
 
 
 
 
2a9b787
247757c
2a3d5b7
 
2923221
 
2a3d5b7
 
 
 
 
9102404
 
 
 
 
 
 
 
 
 
2a3d5b7
09441e0
2923221
 
 
 
856645f
 
 
1bfefb1
2923221
856645f
 
e40f660
ff195d4
5e334b8
 
 
dd91eb9
 
 
 
 
 
856645f
 
2923221
 
 
 
 
 
 
 
bc09640
1321c2f
 
 
 
 
856645f
2923221
bc09640
bfd6aac
4de0c07
 
 
 
 
2923221
 
bc09640
12a6081
 
a1a3ecc
4de0c07
a1a3ecc
856645f
bc09640
6fcfbd6
74b1f4e
6fcfbd6
 
 
 
bc09640
ba064ac
 
 
 
 
 
bc09640
0cac539
 
 
 
 
ba064ac
2923221
bc09640
a365b41
 
 
 
 
 
2923221
 
bc09640
3bcb31f
 
 
 
 
 
2923221
 
 
bc09640
481eafd
 
 
 
 
 
2923221
23526fa
 
 
 
0db1c35
 
23526fa
 
 
 
 
 
 
 
 
 
 
2923221
1a7f16a
c7511da
 
 
 
2923221
7f47b57
 
a207445
5584ab1
2923221
 
23526fa
 
 
 
 
 
 
 
2923221
 
 
 
3e477c1
4595fee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2923221
 
 
 
f18f04b
2923221
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
import flask
from flask import request, jsonify, send_file
import os

import asyncio
import aiohttp

from dotenv import load_dotenv
import globs
from flask import render_template


from api_logic import api



from google_db import save_db 



load_dotenv()







globs.dey = 0
globs.wek = 0
globs.v_hid = 0
globs.v_min = 0                   
globs.ph = 0
globs.ec = 0
globs.tS = 0
globs.tA = 0
globs.hDm = 0
globs.sVen = 0
globs.rFul = 0
globs.rLi = 0
globs.rWat = 0
globs.rRas = 0
globs.rPH = 0
globs.rEC = 0
globs.rSl = 0
globs.rLe = 0
globs.alW = 0


globs.ph_eep = 0
globs.ph_on_eep = 0
globs.ec_eep = 0
globs.ec_A_eep = 0
globs.ec_B_eep = 0
globs.ec_C_eep = 0
globs.l_ON_h_eep = 0
globs.l_ON_m_eep = 0
globs.l_OFF_h_eep = 0
globs.l_OFF_m_eep = 0
globs.t_Voz_eep = 0


app = flask.Flask(__name__, template_folder="./")
app.config['DEBUG'] = True





@app.route("/")
def index():
    return flask.render_template('index.html')






@app.route('/online', methods=['GET'])
def online():
    return render_template('online.html')






@app.route('/online_api', methods=['GET'])
def online_api():
    return jsonify(dey=globs.dey,
                   wek=globs.wek,
                  v_hid=globs.v_hid,
                  v_min=globs.v_min,                   
                   ph=globs.ph,
                   ec=globs.ec,
                   tS=globs.tS,
                   tA=globs.tA,
                   hDm=globs.hDm,
                   sVen=globs.sVen,
                   rFul=globs.rFul,
                   rLi=globs.rLi,
                   rWat=globs.rWat,
                   rRas=globs.rRas,
                   rPH=globs.rPH,
                   rEC=globs.rEC,
                   rSl=globs.rSl,
                   rLe=globs.rLe,
                   alW=globs.alW
                  )





@app.route('/settings', methods=['GET'])
def settings():
    return render_template('settings.html')


@app.route('/settings_api', methods=['GET'])
def settings_api():
    return jsonify(ph_eep=globs.ph_eep,
                   ph_on_eep=globs.ph_on_eep,
                   ec_eep=globs.ec_eep,
                   ec_A_eep=globs.ec_A_eep,
                   ec_B_eep=globs.ec_B_eep,
                   ec_C_eep=globs.ec_C_eep,
                   l_ON_h_eep=globs.l_ON_h_eep,
                   l_ON_m_eep=globs.l_ON_m_eep,
                   l_OFF_h_eep=globs.l_OFF_h_eep,
                   l_OFF_m_eep=globs.l_OFF_m_eep,
                   t_Voz_eep=globs.t_Voz_eep
                  )









@app.route('/pH_set', methods=['GET'])
def set_pH_value():
    ph_value = request.args.get('value')
    globs.ph_set = ph_value
    globs.eep_set = 1
    return "pH value set successfully"


@app.route('/ph_on_set', methods=['GET'])
def ph_on_value():
    ph_on_value = request.args.get('value')
    globs.ph_on_set = ph_on_value
    globs.eep_set = 2
    return "EC value set successfully"



@app.route('/EC_set', methods=['GET'])
def set_EC_value():
    ec_value = request.args.get('value')
    globs.ec_set = ec_value
    globs.eep_set = 3
    return "EC value set successfully"

@app.route('/ec_A_set', methods=['GET'])
def ec_A_setValue():
    ec_A_setValue = request.args.get('value')
    globs.ec_A_set = ec_A_setValue
    globs.eep_set = 4
    return "EC value set successfully"

@app.route('/ec_B_set', methods=['GET'])
def ec_B_setValue():
    ec_B_setValue = request.args.get('value')
    globs.ec_B_set = ec_B_setValue
    globs.eep_set = 5
    return "EC value set successfully"

@app.route('/ec_C_set', methods=['GET'])
def ec_C_setValue():
    ec_C_setValue = request.args.get('value')
    globs.ec_C_set = ec_C_setValue
    globs.eep_set = 6
    return "EC value set successfully"


@app.route('/l_ON_set', methods=['GET'])
def l_ON_set():
    globs.l_ON_h_set = request.args.get('l_ON_h_set')
    globs.l_ON_m_set = request.args.get('l_ON_m_set')
    globs.eep_set = 7
    return "EC value set successfully"



@app.route('/l_OFF_set', methods=['GET'])
def l_OFF_set():
    globs.l_OFF_h_set = request.args.get('l_OFF_h_set')
    globs.l_OFF_m_set = request.args.get('l_OFF_m_set')
    globs.eep_set = 8
    return "EC value set successfully"




@app.route('/t_Voz_eep_set', methods=['GET'])
def t_Voz_eep_set():
    t_Voz_eep_set = request.args.get('value')
    globs.ec_t_Voz_set = t_Voz_eep_set
    globs.eep_set = 9
    return "EC value set successfully"







@app.route('/but_start', methods=['GET'])
def but_start():
    globs.eep_set = 10
    return jsonify(value_set="start")








    
@app.route("/api", methods=['GET'])
def handle_api():
    response = api()
    return response


@app.route("/save_db", methods=['GET'])
def handle_save_db():
    response = save_db()
    return response


@app.route('/set_res')
def set_res():
    globs.eep_set = 0
    return jsonify(value_set="reset")































if __name__ == '__main__':
    app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))