Пример #1
0
def MakeEFramePicture(epaperserverip="127.0.0.1"):

    #epd = epd7in5b.EPD()
    epd = epd7in5b.EPD(epaperserverip)

    #epd.init()
    #print("Clear...")
    #epd.Clear(0xFF)
    #epd.sleep()

    w = OpenWeatherMap("/var/ram")
    w.FromAuto()

    plugins = [
        (EFrameCalendar(), 0, 0),
        (EFrameTemperature(w), 0, 250),
        (EFrameWeather(w), 0, 565),
        (EFrameClock(), 366, 5),  #366, 640),
    ]

    #HBlackImage = Image.open('..\pic\cat.bmp')
    #HBlackImage = Image.open('..\pic\kettle.bmp')
    #HBlackImage = Image.open('..\pic\jun1_1979_black.bmp')
    #HRedImage = Image.open('..\pic\jun1_1979_red.bmp')

    HBlackImage = Image.new('1', (epd7in5b.EPD_HEIGHT, epd7in5b.EPD_WIDTH),
                            255)
    HRedImage = Image.new('1', (epd7in5b.EPD_HEIGHT, epd7in5b.EPD_WIDTH), 255)

    for (p, x, y) in plugins:
        p.SetPaper(HBlackImage, HRedImage)
        p.Paint(x, y, epd7in5b.EPD_HEIGHT, epd7in5b.EPD_WIDTH, None)

    HBlackImage = HBlackImage.transpose(Image.ROTATE_270)
    HRedImage = HRedImage.transpose(Image.ROTATE_270)

    #try:

    print("EPD Init...")
    epd.init()
    print("EPD Display...")
    epd.display(epd.getbuffer(HBlackImage), epd.getbuffer(HRedImage))
    print("EPD Sleep...")
    epd.sleep()
Пример #2
0
from flask import Flask, render_template, request
from openweathermap import OpenWeatherMap
from capteur import Capteur

app = Flask(__name__)

meteo = OpenWeatherMap()
sense= Capteur()
PORT=8080

#
@app.route('/', methods=['GET'])
def home():
    sense.mesure()
    sense.get_cpu_temp()
    sense.renderText(str(sense.datas.get("temperature")))
    return render_template("home.html",datas=sense.datas)

#
@app.route('/weather', methods=['GET','POST'])
def weather():
    
    if request.method=="POST":
        city=request.form.get("city")
        if city is not None:
            if meteo.fetchDatas(city):
                # print(meteo.datas.get("name"))
                # print(meteo.datas.get("temperature"))
                # print(meteo.datas.get("pressure"))
                # print(meteo.datas.get("humidity"))
                # print(meteo.datas.get("description"))
Пример #3
0
    import epd7in5b_sock as epd7in5b
    from PIL import Image,ImageDraw,ImageFont
    import PIL.ImageOps 

    HOST = "127.0.0.1"
    #HOST = "192.168.0.30"
    epd = epd7in5b.EPD(HOST)


    print("Image size %i,%i" % (epd7in5b.EPD_HEIGHT,epd7in5b.EPD_WIDTH))

    HBlackImage = Image.new('1', ( epd7in5b.EPD_HEIGHT,epd7in5b.EPD_WIDTH), 255)  
    HRedImage = Image.new('1', (epd7in5b.EPD_HEIGHT,epd7in5b.EPD_WIDTH), 255)  
    
    w = OpenWeatherMap()
    w.FromAuto()


    t = EFrameTemperature(w)
    t.SetPaper( HBlackImage, HRedImage)

    t.Paint( 0,0,epd7in5b.EPD_HEIGHT, epd7in5b.EPD_WIDTH, None)



    HBlackImage = HBlackImage.transpose(Image.ROTATE_270)
    HRedImage = HRedImage.transpose(Image.ROTATE_270)
        
        
    print("Init...")
Пример #4
0
#--------------
# setup weather APIs
#--------------
log.lprint("setup weather APIs")
if not os.path.exists(file_path+'openweathermap.conf'):
    log.lprint("conf files missing!")
    quit()

conf = APIConfig()
conf.loadFromFile(file_path+'wettercom.conf')
wCom = WetterCom(conf)

conf2 = APIConfig()
conf2.loadFromFile(file_path+'openweathermap.conf')
owm = OpenWeatherMap(conf2)

conf3 = APIConfig()
conf3.loadFromFile(file_path+'forecastio.conf')
fio = ForecastIOAPI(conf3)

#--------------
# get forecasts
#--------------
log.lprint("get forecasts")
wCom.get_forecast()
owm.get_forecast()
fio.get_forecast()

#--------------
# get time series