jesmak / MMM-FlightRadarTracker

MagicMirror module that tracks nearby planes based on Flightradar24 data
MIT License
20 stars 3 forks source link

If all planes leave radius, the list does not revert to 'No Planes Nearby' #7

Open mgmread opened 3 years ago

mgmread commented 3 years ago

I live near to an airport, so use a very small radius so that I only have flights appear when they fly pretty much directly overhead. When the plane leaves, the list does not revert to 'No Planes Nearby' as it would when the program first starts.

Selyjohns commented 2 years ago

Hello, Same problem for me with a 7km radius. When a plane is going outside the radius, the MM still show it until a more closer plane enter the radius. It will never return to "No Planes Nearby"

MM version : 2.18.0

Config { module: 'MMM-FlightRadarTracker', header: 'Avion le plus proche', position: 'bottom_left', classes: 'scheduler', config: { module_schedule: [ {from: '0 9 * * 1-5', to: '0 23 * * 1-5'}, {from: '* * * * 6-7', to: '* * * * 6-7'} ], updateInterval: 15, distance: 7, passingByThreshold: -1, limit: 1, speedUnits: 'metric', altitudeUnits: 'metric', centerPoint: [XXX, XXX], showAirline: true, showType: true, showSpeed: true, showAltitude: true, showHeading: true, showDirectionAsArrow: true, showRoute: true, noPlanesLabel: 'Aucun avion detecté', atTheWindowLabel: 'Visible', passingByLabel: 'Non visible', sort: 'distance', sortDescending: false } } For information, with remote control we can see the MM on port 8080. If we do reload page (with juste the F5 touch on the keyboard), the module will display "no Planes Nearby". So, it's just look like a refresh problem of web page I think, but MM directly doesn't do that. That is the problem.

george-dilthey commented 2 years ago

Was there any update to this? I'm seeing the same thing. Is there any way to force that module to refresh so that the list shows as no planes when its outside the radius?

Selyjohns commented 2 years ago

Was there any update to this? I'm seeing the same thing. Is there any way to force that module to refresh so that the list shows as no planes when its outside the radius?

This module seem to be abandonned. So I've delete it :(

george-dilthey commented 2 years ago

Was there any update to this? I'm seeing the same thing. Is there any way to force that module to refresh so that the list shows as no planes when its outside the radius?

This module seem to be abandonned. So I've delete it :(

Everything else seems to work, but this would be a great feature add.

george-dilthey commented 2 years ago

For anyone following this, I found out the issue here and added a quick if/else statement to get it going. Basically if the node_helper.js didn't find any planes, it wouldn't pass anything back to the MMM-FlightRadarTracker.js file, so the module only updated when a new plane was found.

In node_helper.js on line 94, I set it to send a notification back with an empty array if no aircraft was found, and it will now update.

.then(function (result) {
                if(result.length !== 0){
                    result.forEach(function(f) {
                        self.getFlightDetails(payload.centerPoint[0], payload.centerPoint[1], payload.limit, payload.sort, payload.sortDescending, result, f); 
                    });
                } else {
                    self.sendSocketNotification('MMM-FlightRadarTracker_DATA_RECEIVED', []);
                }
})

Use at your own risk!

dsellers1 commented 1 year ago

@george-dilthey's fix worked for me. I think restarting MM was needed because I don't think a simple refresh was enough. Also, his code replaces lines 94-98.