Version: 1.6.34.0
Frequency: Consistently
Severity: Blocker
Bug description:
We are attempting to retrieve METAR data from an HTML/JS instrument (EFB) using the documented Coherent calls:
GET_METAR_BY_IDENT
GET_METAR_BY_LATLON
However, both APIs consistently return "Invalid METAR" even when:
-
Live Weather is enabled
-
Online services are enabled
-
The aircraft is located at a major airport
-
A facility listener is registered
SimVars return correct weather data, but the METAR APIs always fail. We would like clarification on the correct initialisation or usage pattern for these APIs.
Here are the essentials of our implementation:
Facility listener
let facilityReady = false;
RegisterViewListener("JS_LISTENER_FACILITY", () => {
facilityReady = true;
console.log("[EFB] Facility listener ready");
});
METAR retrieval
async function efbGetMetar(icao, airportLat, airportLon) {
// 1 — try ident
try {
const metar = await Coherent.call("GET_METAR_BY_IDENT", icao);
if (metar && metar !== "Invalid METAR") {
return metar;
}
} catch(e) {}
// 2 — try airport coordinates
try {
const metar = await Coherent.call("GET_METAR_BY_LATLON", airportLat, airportLon);
if (metar && metar !== "Invalid METAR") {
return metar;
}
} catch(e) {}
// 3 — try swapped coordinates
try {
const metar = await Coherent.call("GET_METAR_BY_LATLON", airportLon, airportLat);
if (metar && metar !== "Invalid METAR") {
return metar;
}
} catch(e) {}
// 4 — try aircraft position
const lat = SimVar.GetSimVarValue("PLANE LATITUDE", "degrees");
const lon = SimVar.GetSimVarValue("PLANE LONGITUDE", "degrees");
try {
const metar = await Coherent.call("GET_METAR_BY_LATLON", lat, lon);
if (metar && metar !== "Invalid METAR") {
return metar;
}
} catch(e) {}
// 5 — swapped aircraft coordinates
try {
const metar = await Coherent.call("GET_METAR_BY_LATLON", lon, lat);
if (metar && metar !== "Invalid METAR") {
return metar;
}
} catch(e) {}
return null;
}
Example test
EGSS
lat = 51.885
lon = 0.235
Console output:
[EFB] Facility listener ready
[PERF][WX] takeoff metar_unavailable lastSource=LATLON_PLANE_SWAP err=Invalid METAR
[PERF][WX] takeoff source=SIMVARS_FALLBACK icao=EGSS wind=20/9 oat=11C qnh=1019hPa
Both calls consistently return: Invalid METAR
Are there additional initialization steps required before calling GET_METAR_BY_IDENT or GET_METAR_BY_LATLON?
- Is the facility listener alone sufficient to enable the METAR APIs?
- Are there timing constraints or weather subsystem readiness checks required before these APIs return valid results?
- Are these APIs still supported for HTML/JS instruments in MSFS 2024?
Thanks in advance for any assistance,
Martyn



