@weedorbeat good idea. I’ll put that on my list.
Read the statement by Michael Teeuw here.
Posts made by LukeCodewalker
-
RE: MMM-DWD-WarnWeather - Wetterwarnungen
-
RE: MMM-DWD-WarnWeather - Wetterwarnungen
@Jopyth Thank you. Yes I will add it.
Sure I will fix it soon. -
RE: MMM-DWD-WarnWeather - Wetterwarnungen
Hey @tajno,
they don’t really provide an API. I did a bit of reverse engineering on their website and found that you can get a JSON file with all the warnings for Germany for a specific time.
This JSON contains warnings for all regions (Landkreise) of Germany.
If you find an API for Switzerland I can help you to implement it. -
RE: MMM-DWD-WarnWeather - Wetterwarnungen
I made some small changes to the formatting of the date. It now looks like this:
-
RE: MMM-Globe
@iMAGiC & @gshimself: thanks for your feedback. would it be possible, that one of you could post a picture of the module on a mirror. I just started building mine (don’t have the glass yet) and would like to know how it looks on a mirror. right now I can only look at it on my monitor.
-
RE: save some information from a xml or json to a txt file
Now it should work
#!/usr/bin/python # -*- coding: utf-8 -*- import codecs import json import subprocess APP_ID = '' FILE_PATH = 'test.txt' url = 'http://api.openweathermap.org/data/2.5/weather?id=2934486&lang=de&units=metric&mode=json&appid=' + APP_ID curl_req = 'curl -L ' + '"' + url + '"' p = subprocess.Popen(curl_req, stdout=subprocess.PIPE, shell=True) (output, err) = p.communicate() p_status = p.wait() try: decoded = json.loads(output) weather = decoded['weather'][0]['description'] temp = decoded['main']['temp'] f = codecs.open(FILE_PATH,'w', 'utf-8') f.write('Today is ' + weather + ' and ' + str(temp) + ' degrees.') f.close() except (ValueError, KeyError, TypeError): pass
-
RE: save some information from a xml or json to a txt file
@gismo2006 I think I got the problem. The german description can contain letters like äöü etc. i will fix that later when i’m at home.
-
RE: save some information from a xml or json to a txt file
@gismo2006 here it is. just place your app id and the path of the file, where the text should go.
import json import subprocess APP_ID = '' FILE_PATH = 'test.txt' url = 'http://api.openweathermap.org/data/2.5/weather?id=2934486&lang=de&units=metric&mode=json&appid=' + APP_ID curl_req = 'curl -L ' + '"' + url + '"' p = subprocess.Popen(curl_req, stdout=subprocess.PIPE, shell=True) (output, err) = p.communicate() p_status = p.wait() try: decoded = json.loads(output) weather = decoded['weather'][0]['description'] temp = decoded['main']['temp'] f = open(FILE_PATH,'w') f.write('Today is ' + weather + ' and ' + str(temp) + ' degrees.') f.close() except (ValueError, KeyError, TypeError): pass