MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. LukeCodewalker
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    Offline
    • Profile
    • Following 0
    • Followers 4
    • Topics 5
    • Posts 66
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: MMM-DWD-WarnWeather - Wetterwarnungen

      @weedorbeat good idea. I’ll put that on my list.

      posted in Utilities
      LukeCodewalkerL
      LukeCodewalker
    • RE: MMM-DWD-WarnWeather - Wetterwarnungen

      @Jopyth Thank you. Yes I will add it.
      Sure I will fix it soon.

      posted in Utilities
      LukeCodewalkerL
      LukeCodewalker
    • 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.

      posted in Utilities
      LukeCodewalkerL
      LukeCodewalker
    • RE: MMM-DWD-WarnWeather - Wetterwarnungen

      I made some small changes to the formatting of the date. It now looks like this:
      0_1479147474217_screenshot.png

      posted in Utilities
      LukeCodewalkerL
      LukeCodewalker
    • RE: MMM-Globe

      @iMAGiC wow that looks great =)

      posted in Utilities
      LukeCodewalkerL
      LukeCodewalker
    • RE: save some information from a xml or json to a txt file

      Welcome :)

      posted in Requests
      LukeCodewalkerL
      LukeCodewalker
    • 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.

      posted in Utilities
      LukeCodewalkerL
      LukeCodewalker
    • 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
      
      posted in Requests
      LukeCodewalkerL
      LukeCodewalker
    • 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.

      posted in Requests
      LukeCodewalkerL
      LukeCodewalker
    • 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
      
      posted in Requests
      LukeCodewalkerL
      LukeCodewalker
    • 1 / 1