Commit 768cf3e3 authored by Piotr "PHT" Jasiek's avatar Piotr "PHT" Jasiek

Addition LCD on startup

parent 772543ed
Pipeline #6 failed with stages
......@@ -2,8 +2,9 @@
import sys
import time
import datetime
from RPLCD.gpio import *
from RPLCD.gpio import *
from modules.database import *
from modules.device import *
GPIO.setwarnings(False)
......@@ -11,26 +12,39 @@ lcd = CharLCD(cols=20, rows=4, pin_rs=27, pin_e=22, pins_data=[14, 15, 18, 23],
while True:
outside_temp = get_prev_value('outside_temp')
outside_hum = get_prev_value('outside_hum')
outside_pressure = get_prev_value('outside_pressure')
inside_temp = get_prev_value('inside_temp')
inside_hum = get_prev_value('inside_hum')
greenhouse_temp = get_prev_value('greenhouse_temp')
greenhouse_hum = get_prev_value('greenhouse_hum')
now = datetime.datetime.now()
greenhouse_pressure = get_prev_value('greenhouse_pressure')
outside_line = ('%s*C %s%% %s') % (outside_temp, outside_hum, outside_pressure)
inside_line = ('%s*C %s%%') % (inside_temp, inside_hum)
greenhouse_line = ('%s*C %s%% %s') % (greenhouse_temp, greenhouse_hum, greenhouse_pressure)
lcd.clear()
lcd.cursor_pos = (0, 0)
lcd.write_string(now.strftime("%H:%M:%S %Y-%m-%d"))
lcd.cursor_pos = (1, 0)
lcd.write_string(outside_line)
lcd.cursor_pos = (2, 0)
lcd.write_string(inside_line)
lcd.cursor_pos = (3, 0)
lcd.write_string(greenhouse_line)
time.sleep(10)
try:
outside_temp = get_prev_value('outside_temp')
outside_hum = get_prev_value('outside_hum')
outside_pressure = get_prev_value('outside_pressure')
inside_temp = get_prev_value('inside_temp')
inside_hum = get_prev_value('inside_hum')
# greenhouse_temp = get_prev_value('greenhouse_temp')
# greenhouse_hum = get_prev_value('greenhouse_hum')
# greenhouse_pressure = get_prev_value('greenhouse_pressure')
now = datetime.datetime.now()
outside_line = ('%s*C %s%% %s') % (outside_temp, outside_hum, outside_pressure)
inside_line = ('%s*C %s%%') % (inside_temp, inside_hum)
lcd.clear()
lcd.cursor_pos = (0, 0)
lcd.write_string(now.strftime("%H:%M:%S %Y-%m-%d"))
lcd.cursor_pos = (1, 0)
lcd.write_string(outside_line)
lcd.cursor_pos = (2, 0)
lcd.write_string(inside_line)
lcd.cursor_pos = (3, 0)
lcd.write_string(" IP: " + get_ip_address("eth0"))
time.sleep(10)
except:
lcd.clear()
lcd.cursor_pos = (1, 0)
lcd.write_string(" MySQL ERROR!!")
time.sleep(10)
......@@ -54,6 +54,7 @@ try:
add_record(request_time, 'inside_temp', inside_temp)
add_record(request_time, 'inside_hum', inside_hum)
# add_record(request_time, 'desktop_temp', temp_desktop)
# add_record(request_time, 'greenhouse_temp', greenhouse_temp)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment