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.

    MMM-ISS by daterell

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    3 Posts 2 Posters 288 Views 2 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.
    • N Offline
      Nidra57
      last edited by sdetweil

      I tried to install the module , but I don’t get any data on my mirror, just “Next ISS fly over”, “Visible”, “Max Height” “Appears” and “Disappears”. Has anyone have suggestions to solve this?

      {
        module: 'MMM-ISS',
        position: 'bottom_right',
        config: {
          // These values must come from available locations on the SpotTheStation site: https://spotthestation.nasa.gov/
          country: "Netherlands",
          region: "Flevoland",
          city: "Almere",
          minElevation: 40 // 40 Lowest elevation for the panel to show up
        }
      },
      
      N 1 Reply Last reply Reply Quote 0
      • N Offline
        Nidra57 @Nidra57
        last edited by sdetweil

        Nidra57

        Oorzaak:
        NASA heeft SpotTheStation op 12 juni 2025 offline gehaald, waardoor alle MMM-ISS installaties wereldwijd niet meer werken.

        Oplossing:

        • gratis N2YO API-sleutel aanvragen op n2yo.com/api
        • node_helper.js herschreven om de N2YO API te gebruiken — zonder dat de rest van de module aangepast hoeft te worden.

        Config.js:

        {
          module: "MMM-ISS",
          position: "bottom_right",
          config: {
            apiKey: "JOUW_N2YO_SLEUTEL",   // ← nieuw
            lat: 52.37,
            lng: 5.22,
            units: "km",
            minElevation: 40
            // country, region en city zijn niet meer nodig
          }
        },
        

        Node helper.js:

        /* Magic Mirror
         * Node Helper: MMM-ISS
         *
         * By Dave Terrell
         * MIT Licensed.
         *
         * Modified to use N2YO API instead of NASA SpotTheStation
         * (SpotTheStation was shut down on June 12, 2025)
         *
         * Requires a free N2YO API key from https://www.n2yo.com/api/
         * Add `apiKey: 'YOUR_KEY'` to your module config in config.js
         */
        
        let NodeHelper = require('node_helper');
        const https = require('https');
        
        // ISS NORAD satellite ID
        const ISS_ID = 25544;
        
        // Compass directions lookup
        const DIRECTIONS = [
          'N', 'NNE', 'NE', 'ENE',
          'E', 'ESE', 'SE', 'SSE',
          'S', 'SSW', 'SW', 'WSW',
          'W', 'WNW', 'NW', 'NNW'
        ];
        
        function degreesToCompass(deg) {
          return DIRECTIONS[Math.round(deg / 22.5) % 16];
        }
        
        module.exports = NodeHelper.create({
        
          requestInFlight: false,
        
          getData: function (config) {
            if (this.requestInFlight) return;
            this.requestInFlight = true;
        
            if (!config.apiKey) {
              console.error('MMM-ISS: No N2YO API key set. Add `apiKey: "YOUR_KEY"` to your config.');
              this.sendSocketNotification('ERROR', 'No API key');
              this.requestInFlight = false;
              return;
            }
        
            let lat = config.lat || 52.37;
            let lng = config.lng || 5.22;
            let alt = config.alt || 0;
            let days = config.days || 10;
            let minElevation = parseInt(config.minElevation) || 40;
        
            // N2YO visual passes endpoint
            let url = `https://api.n2yo.com/rest/v1/satellite/visualpasses/${ISS_ID}/${lat}/${lng}/${alt}/${days}/${minElevation}/&apiKey=${config.apiKey}`;
        
            let self = this;
            https.get(url, (res) => {
              let data = '';
        
              res.on('data', chunk => data += chunk);
        
              res.on('end', () => {
                try {
                  let json = JSON.parse(data);
        
                  if (!json.passes || json.passes.length === 0) {
                    console.log('MMM-ISS: No passes found.');
                    self.sendSocketNotification('DATA_RESULT', {});
                  } else {
                    let result = self.parsePass(json.passes[0]);
                    self.sendSocketNotification('DATA_RESULT', result);
                  }
                } catch (e) {
                  console.error('MMM-ISS: Error parsing N2YO response:', e);
                  self.sendSocketNotification('ERROR', e.message);
                }
        
                self.requestInFlight = false;
              });
            }).on('error', (err) => {
              console.error('MMM-ISS: HTTP error:', err);
              self.sendSocketNotification('ERROR', err.message);
              self.requestInFlight = false;
            });
          },
        
          socketNotificationReceived: function (notification, payload) {
            if (notification === 'GET_DATA') {
              this.getData(payload);
            }
          },
        
          parsePass: function (pass) {
            // N2YO returns Unix timestamps (UTC)
            let startTime = new Date(pass.startUTC * 1000);
            let duration = Math.round(pass.duration / 60); // seconds → minutes
        
            let durationStr = duration < 1 ? '<1 min' : duration + ' min';
        
            return {
              date: startTime.toLocaleDateString([], { weekday: 'short', month: 'short', day: 'numeric' }),
              time: startTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }),
              visible: durationStr,
              maxHeight: pass.maxEl + '°',
              appears: pass.startEl + '°',
              appearsDirection: degreesToCompass(pass.startAz),
              disappears: pass.endEl + '°',
              disappearsDirection: degreesToCompass(pass.endAz),
            };
          }
        });
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @Nidra57
          last edited by

          @Nidra57 please , code block around config, log, js

          There could be errors shown in the place you start MagicMirror

          If pm2, then

          pm2 logs —lines=xxxx
          

          Where xxxx is the count of most recent lines, default 15

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • 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