GithubHelp home page GithubHelp logo

smart-mirror's People

Contributors

atainter avatar droogans avatar ewized avatar smileyn64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smart-mirror's Issues

Cannot Get Location

Hello

I installed the clone program last night. So far everything is running great with the exception of finding my location. The weather forecast comes up but I get a "cannot find location" message below.

I have done nothing with the lat/long line of code. My IP address and weather API are inputted

I'm a rookie at coding so I'm sure it's something simple I'm missing.

Thanks!

how to get git working

Typing in command in myPI :
pi@myPI ~/.ssh $ git clone [email protected]:HackerHouseYT/Smart-Mirror.git
Then I get this message :
Cloning into 'Smart-Mirror'...
Permission denied (publickey).
The remote end hung up unexpectedly

What I am doing wrong here? I am quit new in this..
I installed the git succesfull with command
sudo apt-get install git-all

just wondering what I am doing wrong here.

cant get weather?

please elaborate and help me with the issue..
Traceback (most recent call last):
File "smartmirror.py", line 158, in get_weather
weather_obj = json.loads(r.text)
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Error: No JSON object could be decoded. Cannot get weather.

(and i have added the API token)

Pixel Width

I'm curious how to fix this. I've tried adjusting the pad x and y but the text is somehow getting cut
image1
image2

unsupported locale setting

i am getting this error while running it on a raspberry pi. Tried fixing by changing locale but not able to correct it

cannot get weather

please help!
its working on previous days
now i cant run "smartmirror.py"
there's something showing like;

File: "smartmirror.py', line 190
print "Error: %s. Cannot get weather." % e

i'm still newbie sorry.

Text doesn't display fully

On my monitor, the text describing the weather and the news articles does not displays the entire String (shown in the images below). How can I fix it?
img_0079
img_0284

weather data

Hi, the code is running and showing only date and time, no weather or news. The Token and Ip address are correct. There are not error message either.

Error: 'currently'

Hi there,

I hope anyone can help me with this. Everything works, except the wheater.
I always get this message when I start it up:
Traceback (most recent call last): File "smartmirror.py", line 161, in get_weather temperature2 = "%s%s" %(str(int(weather_obj['currently']['temperature'])), degree_sign) KeyError: 'currently' Error: 'currently'. Cannot get weather.

I also put in the secret code as it should be.

Thanks and greets from Germany

Lukas

Something is wrong Please HELP!

When I try to run the code, I get this error and it does not display the weather but displays everything else:

File "smartmirror.py", line 147, in get_weather
weather_obj = json.loads(r.text)
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Error: No JSON object could be decoded. Cannot get weather.

permission denied

Permission denied (publickey).
fatal: Could not read from remote repository.

Degree Sign

Hi

I can't change temperature degree sign from Fahrenheit to Celsius!
Can anyone help me?
Thanks

getting error when running python smartmirror.py

pi@raspberrypi:/Code/Smart-Mirror/assets $ python smartmirror.py
Traceback (most recent call last):
File "smartmirror.py", line 173, in get_weather
image = Image.open(icon2)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2251, in open
fp = builtins.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'assets/Cloud.png'
Error: [Errno 2] No such file or directory: 'assets/Cloud.png'. Cannot get weather.
Traceback (most recent call last):
File "smartmirror.py", line 235, in get_headlines
headline = NewsHeadline(self.headlinesContainer, post.title)
File "smartmirror.py", line 248, in init
image = Image.open("assets/Newspaper.png")
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2251, in open
fp = builtins.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'assets/Newspaper.png'
Error: [Errno 2] No such file or directory: 'assets/Newspaper.png'. Cannot get news.

I HAVE CONFIRMED THOSE FILES ARE LOCATED IN assets directory
pi@raspberrypi:/Code/Smart-Mirror/assets $ ls -l
total 1116
-rwxr--r-- 1 pi pi 54893 Feb 12 16:08 Cloud.png
-rwxr--r-- 1 pi pi 56 Feb 12 16:08 CREDITS.txt
-rwxr--r-- 1 pi pi 71281 Feb 12 16:08 Hail.png
-rwxr-xr-x 1 pi pi 86360 Feb 12 16:08 Haze.png
-rwxr--r-- 1 pi pi 1070 Feb 12 16:08 LICENSE
-rwxr--r-- 1 pi pi 4358 Feb 12 16:08 LICENSE.txt
-rwxr--r-- 1 pi pi 73119 Feb 12 16:08 Moon.png
-rwxr--r-- 1 pi pi 120601 Feb 12 16:08 Newspaper.png
-rwxr--r-- 1 pi pi 71512 Feb 12 16:08 PartlyMoon.png
-rwxr--r-- 1 pi pi 75943 Feb 12 16:08 PartlySunny.png
-rwxr--r-- 1 pi pi 66161 Feb 12 16:08 Rain.png
-rw-r--r-- 1 pi pi 1190 Feb 12 16:08 README.md
-rwxr--r-- 1 pi pi 27 Feb 12 16:08 requirements.txt
-rwxr--r-- 1 pi pi 971 Feb 12 16:08 setup.py
-rwxr--r-- 1 pi pi 13017 Mar 14 11:18 smartmirror.py
-rwxr--r-- 1 pi pi 88925 Feb 12 16:08 Snow.png
-rwxr--r-- 1 pi pi 73883 Feb 12 16:08 Storm.png
-rw-r--r-- 1 pi pi 91276 Feb 12 16:08 Sun.png
-rw-r--r-- 1 pi pi 60635 Feb 12 16:08 Sunrise.png
-rw-r--r-- 1 pi pi 91868 Feb 12 16:08 Tornado.png
-rw-r--r-- 1 pi pi 40098 Feb 12 16:08 Wind.png

Not sure what i did wrong. I'm so close. Any advice or help would be greatly appreciated

Error when running smartmirror.py

Cloned the files.
Updated the IP and Weather API token then saved the smartmirror.py.
Confirmed following the procedure as instructed in the video and tried download the file again but having same issue.

Having following error when running:

pi@kenthpi:~/Smart-Mirror $ python smartmirror.py
Traceback (most recent call last):
File "smartmirror.py", line 142, in get_weather
r = requests.get(location_req_url)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 60, in get
return request('get', url, *_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/api.py", line 49, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send
r = adapter.send(request, *_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 407, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', gaierror(-2, 'Name or service not known'))
Error: ('Connection aborted.', gaierror(-2, 'Name or service not known')). Cannot get weather.

Global name "date" is not defined issue

File "smartmirror.py", line 323, in
w = FullscreenWindow()
File "smartmirror.py", line 300, in init
self.clock = Clock(self.topFrame)
File "smartmirror.py", line 76, in init
self.tick()
File "smartmirror.py", line 94, in tick
if date-+2 != self.date1:
NameError: global name 'date' is not defined

Question About News Output Text

I really don't think this is an issue with the code provided here, but I wasn't sure where else to ask. A roughly hour-long Google search didn't provide me with any answers.

I added a couple lines of code to allow me to get gaming-related news:

def get_headlines(self):
        try:
            # remove all children
            for widget in self.headlinesContainer.winfo_children():
                widget.destroy()
            if news_country_code == None:
                headlines_url = "https://news.google.com/news?ned=%s&output=rss"
            #Option For Gaming News
            if news_country_code == "game":
                headlines_url = "http://feeds.feedburner.com/QjGameNewsOpinionsBlogsandMore"
            else:
                headlines_url = "https://news.google.com/news?ned=%s&output=rss" % news_country_code

            feed = feedparser.parse(headlines_url)

            for post in feed.entries[0:5]:
                headline = NewsHeadline(self.headlinesContainer, post.title)
                headline.pack(side=TOP, anchor=W)
        except Exception as e:
            traceback.print_exc()
            print "Error: %s. Cannot get news." % e

        self.after(600000, self.get_headlines)

example

As you can see in the third line of the news, it says "& amp;" rather than a simple "&". Does anyone know what the problem might be?

ImageTK error

I'm receiving the following error when trying to run python smartmiorror.py within the smart mirror folder.

Traceback (most recent call last):
File "smartmirror.py", line 14, in
from PIL import Image, ImageTk
ImportError: cannot import name ImageTk

Any help would be greatly appreciated. Thanks!

locale.Error: unsupported locale setting

Hi, i have an issue when i try to execute "sudo python ./smartmirror.py", can anyone help ?
This is the error that's return :

pi@SmartMirror:~/Downloads/Smart-Mirror-master$ sudo python smartmirror.py
Traceback (most recent call last):
File "smartmirror.py", line 330, in
w = FullscreenWindow()
File "smartmirror.py", line 307, in init
self.clock = Clock(self.topFrame)
File "smartmirror.py", line 77, in init
self.tick()
File "smartmirror.py", line 80, in tick
with setlocale(ui_locale):
File "/usr/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "smartmirror.py", line 39, in setlocale
yield locale.setlocale(locale.LC_ALL, name)
File "/usr/lib/python2.7/locale.py", line 579, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
pi@SmartMirror:~/Downloads/Smart-Mirror-master$

Thanks and Happy New Year

forecast.io

line 118 forecast.io changed to darksky.net Solved weather problem for me.

news

i set my country to PH
then run the application smartmirror.py
and then US news displayed </3

Can't get News or Date and time

So I am pretty new to this and I am unable to get the date and time to be correct and I am unable to show the news. I went to IP chicken and used that IP address and when that didn't work I looked up my Lat & Long.

Having Issues with the weather. What am I doing wrong?

I have 0 knowledge in this. When I copy all the info i get this line of error code. Anyone know what I am doing wrong?
Traceback (most recent call last):
File "smartmirror.py", line 145, in get_weather
weather_obj = json.loads(r.text)
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Error: No JSON object could be decoded. Cannot get weather.

weather

Can you please let me know why I get these error ? And on the display only date/time and news comes up, nothing more.
Traceback (most recent call last):
File "smartmirror.py", line 158, in get_weather
weather_obj = json.loads(r.text)
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Error: No JSON object could be decoded. Cannot get weather.
Show less

Starting issues

Can you please help me, because I get multiple errors when i try to start the program.

File "smartmirror.py", line 330, in
w = FullscreenWindow()
File "smartmirror.py", line 307, in init
self.clock = Clock(self.topFrame)
File "smartmirror.py", line 77, in init
self.tick()
File "smartmirror.py", line 80, in tick
with setlocale(ui_locale):
File "/usr/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "smartmirror.py", line 39, in setlocale
yield locale.setlocale(locale.LC_ALL, name)
File "/usr/lib/python2.7/locale.py", line 579, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

Darksky.io can't retrieve it's weather.

`# smartmirror.py

requirements

requests, feedparser, traceback, Pillow

from Tkinter import *
import locale
import threading
import time
import requests
import json
import traceback
import feedparser

from PIL import Image, ImageTk
from contextlib import contextmanager

LOCALE_LOCK = threading.Lock()

ip = '39.109.216.240'
ui_locale = '' # e.g. 'fr_FR' fro French, '' as default
time_format = 12 # 12 or 24
date_format = "%b %d, %Y" # check python doc for strftime() for options
news_country_code = 'sg'
weather_api_token = 'https://api.darksky.net/forecast/056b122f6411966ec255a9ba8aa4b06e/37.8267,-122.4233' # create account at https://darksky.net/dev/
weather_lang = 'en' # see https://darksky.net/dev/docs/forecast for full list of language parameters values
weather_unit = 'sg' # see https://darksky.net/dev/docs/forecast for full list of unit parameters values
latitude = None # Set this if IP location lookup does not work for you (must be a string)
longitude = None # Set this if IP location lookup does not work for you (must be a string)
xlarge_text_size = 94
large_text_size = 48
medium_text_size = 28
small_text_size = 18

@contextmanager
def setlocale(name): #thread proof function to work with locale
with LOCALE_LOCK:
saved = locale.setlocale(locale.LC_ALL)
try:
yield locale.setlocale(locale.LC_ALL, name)
finally:
locale.setlocale(locale.LC_ALL, saved)

maps open weather icons to

icon reading is not impacted by the 'lang' parameter

icon_lookup = {
'clear-day': "assets/Sun.png", # clear sky day
'wind': "assets/Wind.png", #wind
'cloudy': "assets/Cloud.png", # cloudy day
'partly-cloudy-day': "assets/PartlySunny.png", # partly cloudy day
'rain': "assets/Rain.png", # rain day
'snow': "assets/Snow.png", # snow day
'snow-thin': "assets/Snow.png", # sleet day
'fog': "assets/Haze.png", # fog day
'clear-night': "assets/Moon.png", # clear sky night
'partly-cloudy-night': "assets/PartlyMoon.png", # scattered clouds night
'thunderstorm': "assets/Storm.png", # thunderstorm
'tornado': "assests/Tornado.png", # tornado
'hail': "assests/Hail.png" # hail
}

class Clock(Frame):
def init(self, parent, _args, *_kwargs):
Frame.init(self, parent, bg='black')
# initialize time label
self.time1 = ''
self.timeLbl = Label(self, font=('Helvetica', large_text_size), fg="white", bg="black")
self.timeLbl.pack(side=TOP, anchor=E)
# initialize day of week
self.day_of_week1 = ''
self.dayOWLbl = Label(self, text=self.day_of_week1, font=('Helvetica', small_text_size), fg="white", bg="black")
self.dayOWLbl.pack(side=TOP, anchor=E)
# initialize date label
self.date1 = ''
self.dateLbl = Label(self, text=self.date1, font=('Helvetica', small_text_size), fg="white", bg="black")
self.dateLbl.pack(side=TOP, anchor=E)
self.tick()

def tick(self):
    with setlocale(ui_locale):
        if time_format == 12:
            time2 = time.strftime('%I:%M %p') #hour in 12h format
        else:
            time2 = time.strftime('%H:%M') #hour in 24h format

        day_of_week2 = time.strftime('%A')
        date2 = time.strftime(date_format)
        # if time string has changed, update it
        if time2 != self.time1:
            self.time1 = time2
            self.timeLbl.config(text=time2)
        if day_of_week2 != self.day_of_week1:
            self.day_of_week1 = day_of_week2
            self.dayOWLbl.config(text=day_of_week2)
        if date2 != self.date1:
            self.date1 = date2
            self.dateLbl.config(text=date2)
        # calls itself every 200 milliseconds
        # to update the time display as needed
        # could use >200 ms, but display gets jerky
        self.timeLbl.after(200, self.tick)

class Weather(Frame):
def init(self, parent, _args, *_kwargs):
Frame.init(self, parent, bg='black')
self.temperature = ''
self.forecast = ''
self.location = ''
self.currently = ''
self.icon = ''
self.degreeFrm = Frame(self, bg="black")
self.degreeFrm.pack(side=TOP, anchor=W)
self.temperatureLbl = Label(self.degreeFrm, font=('Helvetica', xlarge_text_size), fg="white", bg="black")
self.temperatureLbl.pack(side=LEFT, anchor=N)
self.iconLbl = Label(self.degreeFrm, bg="black")
self.iconLbl.pack(side=LEFT, anchor=N, padx=20)
self.currentlyLbl = Label(self, font=('Helvetica', medium_text_size), fg="white", bg="black")
self.currentlyLbl.pack(side=TOP, anchor=W)
self.forecastLbl = Label(self, font=('Helvetica', small_text_size), fg="white", bg="black")
self.forecastLbl.pack(side=TOP, anchor=W)
self.locationLbl = Label(self, font=('Helvetica', small_text_size), fg="white", bg="black")
self.locationLbl.pack(side=TOP, anchor=W)
self.get_weather()

def get_ip(self):
    try:
        ip_url = "http://jsonip.com/"
        req = requests.get(ip_url)
        ip_json = json.loads(req.text)
        return ip_json['ip']
    except Exception as e:
        traceback.print_exc()
        return "Error: %s. Cannot get ip." % e

def get_weather(self):
    try:

        if latitude is None and longitude is None:
            # get location
            location_req_url = "http://freegeoip.net/json/%s" % self.get_ip()
            r = requests.get(location_req_url)
            location_obj = json.loads(r.text)

            lat = location_obj['latitude']
            lon = location_obj['longitude']

            location2 = "%s, %s" % (location_obj['city'], location_obj['region_code'])

            # get weather
            weather_req_url = "https://api.darksky.net/forecast/%s/%s,%s?lang=%s&units=%s" % (weather_api_token, lat,lon,weather_lang,weather_unit)
        else:
            location2 = ""
            # get weather
            weather_req_url = "https://api.darksky.net/forecast/%s/%s,%s?lang=%s&units=%s" % (weather_api_token, latitude, longitude, weather_lang, weather_unit)

        r = requests.get(weather_req_url)
        weather_obj = json.loads(r.text)

        degree_sign= u'\N{DEGREE SIGN}'
        temperature2 = "%s%s" % (str(int(weather_obj['currently']['temperature'])), degree_sign)
        currently2 = weather_obj['currently']['summary']
        forecast2 = weather_obj["hourly"]["summary"]

        icon_id = weather_obj['currently']['icon']
        icon2 = None

        if icon_id in icon_lookup:
            icon2 = icon_lookup[icon_id]

        if icon2 is not None:
            if self.icon != icon2:
                self.icon = icon2
                image = Image.open(icon2)
                image = image.resize((100, 100), Image.ANTIALIAS)
                image = image.convert('RGB')
                photo = ImageTk.PhotoImage(image)

                self.iconLbl.config(image=photo)
                self.iconLbl.image = photo
        else:
            # remove image
            self.iconLbl.config(image='')

        if self.currently != currently2:
            self.currently = currently2
            self.currentlyLbl.config(text=currently2)
        if self.forecast != forecast2:
            self.forecast = forecast2
            self.forecastLbl.config(text=forecast2)
        if self.temperature != temperature2:
            self.temperature = temperature2
            self.temperatureLbl.config(text=temperature2)
        if self.location != location2:
            if location2 == ", ":
                self.location = "Cannot Pinpoint Location"
                self.locationLbl.config(text="Cannot Pinpoint Location")
            else:
                self.location = location2
                self.locationLbl.config(text=location2)
    except Exception as e:
        traceback.print_exc()
        print "Error: %s. Cannot get weather." % e

    self.after(600000, self.get_weather)

@staticmethod
def convert_kelvin_to_fahrenheit(kelvin_temp):
    return 1.8 * (kelvin_temp - 273) + 32

class News(Frame):
def init(self, parent, _args, *_kwargs):
Frame.init(self, parent, _args, *_kwargs)
self.config(bg='black')
self.title = 'News' # 'News' is more internationally generic
self.newsLbl = Label(self, text=self.title, font=('Helvetica', medium_text_size), fg="white", bg="black")
self.newsLbl.pack(side=TOP, anchor=W)
self.headlinesContainer = Frame(self, bg="black")
self.headlinesContainer.pack(side=TOP)
self.get_headlines()

def get_headlines(self):
    try:
        # remove all children
        for widget in self.headlinesContainer.winfo_children():
            widget.destroy()
        if news_country_code == None:
            headlines_url = "https://news.google.com/news?ned=us&output=rss"
        else:
            headlines_url = "https://news.google.com/news?ned=%s&output=rss" % news_country_code

        feed = feedparser.parse(headlines_url)

        for post in feed.entries[0:5]:
            headline = NewsHeadline(self.headlinesContainer, post.title)
            headline.pack(side=TOP, anchor=W)
    except Exception as e:
        traceback.print_exc()
        print "Error: %s. Cannot get news." % e

    self.after(600000, self.get_headlines)

class NewsHeadline(Frame):
def init(self, parent, event_name=""):
Frame.init(self, parent, bg='black')

    image = Image.open("assets/Newspaper.png")
    image = image.resize((25, 25), Image.ANTIALIAS)
    image = image.convert('RGB')
    photo = ImageTk.PhotoImage(image)

    self.iconLbl = Label(self, bg='black', image=photo)
    self.iconLbl.image = photo
    self.iconLbl.pack(side=LEFT, anchor=N)

    self.eventName = event_name
    self.eventNameLbl = Label(self, text=self.eventName, font=('Helvetica', small_text_size), fg="white", bg="black")
    self.eventNameLbl.pack(side=LEFT, anchor=N)

class Calendar(Frame):
def init(self, parent, _args, *_kwargs):
Frame.init(self, parent, bg='black')
self.title = 'Calendar Events'
self.calendarLbl = Label(self, text=self.title, font=('Helvetica', medium_text_size), fg="white", bg="black")
self.calendarLbl.pack(side=TOP, anchor=E)
self.calendarEventContainer = Frame(self, bg='black')
self.calendarEventContainer.pack(side=TOP, anchor=E)
self.get_events()

def get_events(self):
    #TODO: implement this method
    # reference https://developers.google.com/google-apps/calendar/quickstart/python

    # remove all children
    for widget in self.calendarEventContainer.winfo_children():
        widget.destroy()

    calendar_event = CalendarEvent(self.calendarEventContainer)
    calendar_event.pack(side=TOP, anchor=E)
    pass

class CalendarEvent(Frame):
def init(self, parent, event_name="Event 1"):
Frame.init(self, parent, bg='black')
self.eventName = event_name
self.eventNameLbl = Label(self, text=self.eventName, font=('Helvetica', small_text_size), fg="white", bg="black")
self.eventNameLbl.pack(side=TOP, anchor=E)

class FullscreenWindow:

def __init__(self):
    self.tk = Tk()
    self.tk.configure(background='black')
    self.topFrame = Frame(self.tk, background = 'black')
    self.bottomFrame = Frame(self.tk, background = 'black')
    self.topFrame.pack(side = TOP, fill=BOTH, expand = YES)
    self.bottomFrame.pack(side = BOTTOM, fill=BOTH, expand = YES)
    self.state = False
    self.tk.bind("<Return>", self.toggle_fullscreen)
    self.tk.bind("<Escape>", self.end_fullscreen)
    # clock
    self.clock = Clock(self.topFrame)
    self.clock.pack(side=RIGHT, anchor=N, padx=100, pady=60)
    # weather
    self.weather = Weather(self.topFrame)
    self.weather.pack(side=LEFT, anchor=N, padx=100, pady=60)
    # news
    self.news = News(self.bottomFrame)
    self.news.pack(side=LEFT, anchor=S, padx=100, pady=60)
    # calender - removing for now
    # self.calender = Calendar(self.bottomFrame)
    # self.calender.pack(side = RIGHT, anchor=S, padx=100, pady=60)

def toggle_fullscreen(self, event=None):
    self.state = not self.state  # Just toggling the boolean
    self.tk.attributes("-fullscreen", self.state)
    return "break"

def end_fullscreen(self, event=None):
    self.state = False
    self.tk.attributes("-fullscreen", False)
    return "break"

if name == 'main':
w = FullscreenWindow()
w.tk.mainloop()
`

"Frame" not defined

I'm running into an error where the code is unable to run due to a problem with "class Clock(Frame)". Is anyone else having this problem and can help, thank you.

Not really an issue. But don't know where to ask.

14772514009261958839801
14772515832101079388629

I was just wondering if any one could help me. I added random messages in the middle of the screen using the calendar class as a template. But I can't seem to figure out how to update it so it prints a new message after a couple of minutes. Thanks for any help.

Error: 'currently'. Cannot get weather.

Hello!

I ran into a problem. i get this error when running the app:
root@raspberrypi:/home/pi/Downloads/Smart-Mirror-master# sudo python smartmirror.py
Traceback (most recent call last):
File "smartmirror.py", line 161, in get_weather
temperature2 = "%s%s" % (str(int(weather_obj['currently']['temperature'])), degree_sign)
KeyError: 'currently'
Error: 'currently'. Cannot get weather.

Please help me in solving this issue.
Thank You in Advance!

No "Wind.png" in the assets

Hello,

And thanks for this project, i love it.

I ran into an issue today : There's no "Wind.png" in the assets so i added one to my own Smart-Mirror but thing is the Image i used is CC-BY, so the author name is to be mentionned, can anyone find a CC "Wind.png" ( or even create one ? )

Cheers

feedparser error

Trying to run smart mirror and receive the following ImportError:

Traceback (most recent call last):
File "smartmirror.py", line 12, in
import feedparser
ImportError: No module named feedparser

Any help would be great.

nothing happened when start

i am using a raspberry pi with a 5 inch LCD display.

i run python smartmirror.py but nothing happened and no error message

i have installed all requirement.

May i know why ? Thanks for your help!

Can't get weather data.

I'm not sure if this is my issue, or your's, but I can't get any weather data.

Here is my issue:

Traceback (most recent call last):
File "smartmirror.py", line 130, in get_ip
ip_json = json.loads(req.text)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Traceback (most recent call last):
File "smartmirror.py", line 143, in get_weather
location_obj = json.loads(r.text)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19)
Error: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19). Cannot get weather.

It has to do with not getting the data from darksky, I'm pretty sure.

smartmirror.py

so I put in the api token but then what do i do what do I press plz halp!!!

Unsupported locale setting

This is what I got when I tried to run the app.
I can't seem to find what's stopping the program from booting.

BY the way this is my first raspberry pi project. :)

pi@raspberrypi:~/Downloads/Smart-Mirror-master $ python smartmirror.py
Traceback (most recent call last):
File "smartmirror.py", line 329, in
w = FullscreenWindow()
File "smartmirror.py", line 306, in init
self.clock = Clock(self.topFrame)
File "smartmirror.py", line 76, in init
self.tick()
File "smartmirror.py", line 79, in tick
with setlocale(ui_locale):
File "/usr/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "smartmirror.py", line 38, in setlocale
yield locale.setlocale(locale.LC_ALL, name)
File "/usr/lib/python2.7/locale.py", line 579, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

Fullscreen

I am using an raspberry screen for this project and when i run the python file just the clock and date appeared on the screen. Can you help me with this problem?

freegeoip.net will look up your IP address for you.

From their site.

If no IP or hostname is provided, then your own IP is looked up.

It would definitely make this system more user friendly to people who pack up their smart mirror and move across the country.

You can also use this data to determine the country code, so you only need to over ride it should you want news from another country. Now, all they need to do is get an api token for weather information!

Can't clone repository

I can't clone the repository. I enter:
git clone [email protected]:HackerHouseYT/Smart-Mirror.git
and it just returns:
Cloning into 'Smart-Mirror'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Attempting to make a calendar widget

Hi,

I was tinkering with your calendar code and I can't seem to make it work. It is to my presumption that it is unfinished. Is this someone you could work on?

News on PH

still can't get new from Philippines
i tried
news_country_code = 'en_PH' & 'PH'
and
news_country_code ='us'

they're the same, USA news.

can you help me?

Display

So I know this is probably an issue with my display settings on my monitor or something but the weather and new are being cutoff. any suggestions?

Missing Assets Error

Sometimes the program works nearly perfectly, as can be seen in my previous post. However, sometimes, I get the following output in terminal an on the screen when run "python Code/Smart-Mirror/smartmirror.py ":

Traceback (most recent call last):
  File "Code/Smart-Mirror/smartmirror.py", line 174, in get_weather
    image = Image.open(icon2)
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2251, in open
    fp = builtins.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'assets/PartlyMoon.png'
Error: [Errno 2] No such file or directory: 'assets/PartlyMoon.png'. Cannot get weather.
Traceback (most recent call last):
  File "Code/Smart-Mirror/smartmirror.py", line 238, in get_headlines
    headline = NewsHeadline(self.headlinesContainer, post.title)
  File "Code/Smart-Mirror/smartmirror.py", line 251, in __init__
    image = Image.open("assets/Newspaper.png")
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2251, in open
    fp = builtins.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'assets/Newspaper.png'
Error: [Errno 2] No such file or directory: 'assets/Newspaper.png'. Cannot get news.

example2

Can anyone help?

So close....

I've followed the instruction to the letter and everything installed correctly. When trying to run smartmirror.py, I get the following:

pi@raspberrypi:~/Smart-Mirror $ python smartmirror.py

Traceback (most recent call last):
File "smartmirror.py", line 330, in
w = FullscreenWindow()
File "smartmirror.py", line 307, in init
self.clock = Clock(self.topFrame)
File "smartmirror.py", line 77, in init
self.tick()
File "smartmirror.py", line 80, in tick
with setlocale(ui_locale):
File "/usr/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "smartmirror.py", line 39, in setlocale
yield locale.setlocale(locale.LC_ALL, name)
File "/usr/lib/python2.7/locale.py", line 579, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

Anyone know what's going on here? Thanks.

Cannot get weather

this is my problem
Traceback (most recent call last):
File "smartmirror.py", line 158, in get_weather
weather_obj = json.loads(r.text)
File "/usr/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Error: No JSON object could be decoded. Cannot get weather.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.