added humidity to weather module
This commit is contained in:
parent
2b3bcd4604
commit
dc85b64631
@ -4,32 +4,31 @@ import pywapi
|
|||||||
class Weather(IntervalModule):
|
class Weather(IntervalModule):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module gets the weather from weather.com
|
This module gets the weather from weather.com using pywapi module
|
||||||
First, you need to get the code for the location from the website
|
First, you need to get the code for the location from the www.weather.com
|
||||||
Available formatters:
|
Available formatters:
|
||||||
{temp}
|
{current_temp}
|
||||||
|
{humidity}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
interval = 20
|
interval = 20
|
||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
"location_code",
|
"location_code",
|
||||||
|
"units",
|
||||||
"format",
|
"format",
|
||||||
)
|
)
|
||||||
required = ("location_code")
|
#required = ("location_code")
|
||||||
|
format = "{current_temp}"
|
||||||
location_code='PLXX0028'
|
|
||||||
|
|
||||||
format = "{current_temp}°C"
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
current_temp = pywapi.get_weather_from_weather_com(self.location_code)['current_conditions']['temperature']
|
#current_temp = pywapi.get_weather_from_weather_com(self.location_code)['current_conditions']['temperature']
|
||||||
|
result = pywapi.get_weather_from_weather_com(self.location_code, self.units)
|
||||||
|
conditions = result['current_conditions']
|
||||||
|
temperature = conditions['temperature']
|
||||||
|
humidity = conditions['humidity']
|
||||||
|
units = result['units']
|
||||||
|
current_temp = '{t}°{d}'.format(t=temperature, d=units['temperature'])
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": self.format.format(current_temp=current_temp)
|
"full_text": self.format.format(current_temp=current_temp, humidity=humidity)
|
||||||
}
|
}
|
||||||
#print ( self.output )
|
|
||||||
|
|
||||||
#w=Weather()
|
|
||||||
#w.run()
|
|
||||||
#def on_leftclick(self):
|
|
||||||
#webbrowser.open_new_tab(self.instance.get_url())
|
|
||||||
|
Loading…
Reference in New Issue
Block a user