MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Help needed simple API based module

    Scheduled Pinned Locked Moved Development
    19 Posts 4 Posters 11.1k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • yawnsY Offline
      yawns Moderator @washichi
      last edited by

      @washichi
      hm. Did you try to output latitude and longitude as well in getDom to see if this is working?

      W 1 Reply Last reply Reply Quote 0
      • W Offline
        washichi @yawns
        last edited by

        @yawns No I didn’t, but that should be exactly the same thing.
        If I hardcode the (any) variable in “issRequest.onreadystatechange = function() {”
        then it just doesn’t display, so it looks like it isn’t going in that function.
        but if I hardcode the (any) variable after that function It displays.

        So I can display the variable (message), but the variable doesn’t get filled with the request.

        1 Reply Last reply Reply Quote 0
        • yawnsY Offline
          yawns Moderator
          last edited by

          Simple way to test if it entering the function:

          Log.error("function entered");

          Press F12 in browser, check for console output and refresh the website. If the function is entered you will see “function entered” in the console.

          1 Reply Last reply Reply Quote 0
          • W Offline
            washichi
            last edited by

            thank you! It’s now working :)
            I thought that my scheduleupdate was working but it didn’t (only 2 times )
            with the Log function I could find the problem easy .

            1 Reply Last reply Reply Quote 1
            • yawnsY Offline
              yawns Moderator
              last edited by

              great. Now tidy up your code ;) and present your module in modules showcase

              ooom416354O 1 Reply Last reply Reply Quote 2
              • ooom416354O Offline
                ooom416354 @yawns
                last edited by

                @washichi @yawns this is great work. I am wondering, would this completed code be kind of a base for making other API calls which return data in JSON format?

                W cowboysdudeC 2 Replies Last reply Reply Quote 1
                • W Offline
                  washichi @ooom416354
                  last edited by

                  @ooom416354 Yes, but other modules are also that.
                  I used the default module “weatherforecast” it is an simple api based module that gets the data and displays it in a table.

                  I’m now trying to add a map, and then display the ISS current position on that, but implementing this in a module is a lot harder then normal javascript :p.

                  ooom416354O 1 Reply Last reply Reply Quote 0
                  • yawnsY Offline
                    yawns Moderator
                    last edited by

                    @ooom416354
                    Yes, kind of. At least with JSON calls without additional headers. The you need to use request and a node_helper

                    1 Reply Last reply Reply Quote 0
                    • ooom416354O Offline
                      ooom416354 @washichi
                      last edited by

                      @washichi Yea, I am still not even sure how to translate the returned JSON to an actual visual table on the mirror. Not very good at this lol

                      cowboysdudeC 1 Reply Last reply Reply Quote 1
                      • cowboysdudeC Offline
                        cowboysdude Module Developer @ooom416354
                        last edited by

                        @ooom416354 It could be yes ;)

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy