Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AAO Lvars porocessing not working

Featured Replies

Hello all, 

 

First of all I wanna state that I am very new to this world and I am sorry if my questions are too stupid, i am not IT savvy and am doing my best. 

I am trying to light some leds for a DIY Overhead panel using AAO, and I am having a hard time getting information from the pmdg 737 into the AAO and out, to use with an arduino. 

I am using a AAO 4.10 B51 - MSFS version, and I am trying to collect Lvars from sim (which always end up in collection failed). I am also trying to observe variables in sumulator, but it doesnt seem to work. I am also trying to get the info trough the web api port, but the port 43381, which is the one I use for vri, doesnt seem to give me info when I try to use the url http://192.168.1.132:43380/webapi/lvars

I have dataenabled, and as I am using a VRI Insignt Combo and it gets the info from the pmdg, it is supposed to be working, but I am not sure what am I doing wrong. 

 

 

I am trying to work my way trough with chatGPT, but it always asks me to do things and click in options that are non existent on AAO, so I am quite lost. 

 

Please have son mercy and give me some light on this topic. 
Thank you

  • Commercial Member
25 minutes ago, ANA1650 said:

chatGPT

...hasn't got the faintest idea what AAO is and how it works. How could it? AAO is a very niche app, not really AI database material.

25 minutes ago, ANA1650 said:

pmdg 737

What simulator? MSFS?

Can you give me a concrete example of an LVar that you are using/watching?

Remember that LVars require a unit in AAO when you want to read/write them to the simulator. When in doubt, use the default "Number".
Example: the landing light switch in the PMDG 737: "(L:switch_110_73X)" will not work in AAO, it must be written as "(L:switch_110_73X, Number)"

25 minutes ago, ANA1650 said:

LVar...collection failed

Make sure that the AAO package "lorbysi-content-hooks" is present and active in your Community folder

Edited by Lorby_SI

LORBY-SI

  • Commercial Member
26 minutes ago, ANA1650 said:

to use with an arduino

Then AAO is not the ideal choice, because not many people are actually running this combination. So there is little to no help available online from actual users. 

I would recommend using MobiFlight instead.

LORBY-SI

I had posted a question a while back about using an ESP32 and Lorby brought up using the webapi for it as those devices support wifi. Just this weekend I got around to looking at that. So my first comment is - what arduino are you using because a Mega or Uno need supplemental boards to be able to do http requests. If you're using an ESP32 then here is a sketch that will show an approach to get data from the sim (I'm using MSFS 2024). This example pulls just the title of the airplane. I started with it because my biggest issue at the moment is each airplane uses different variables so I will need to have plane detection so I can pull the right data for my small displays (cabin pressure, hydraulic pressure, brake pressure, etc..). EDIT: I will also say that you should download one of Lorby's example webpages (like the buttonexample one) and open that from a non-sim PC to make sure your port forwarding and such are working. If you can't using one of those example pages you have firewall or other issues. I'm also using the latest AAO.

#include <WiFi.h>
#include <ArduinoJson.h>
#include <HTTPClient.h>

// Replace with your network credentials
const char* ssid = "YourSSIDHere";
const char* password = "YourPassHere";
const char* serverUrl = "http://YourIPHere:43380/webapi";

void setup() {
// Only needed for debugging using serial monitor
Serial.begin(115200);

// Set WiFi mode to Station
WiFi.mode(WIFI_STA);

// Start connecting to the WiFi network
WiFi.begin(ssid, password);
Serial.println("Connecting to WiFi...");

// Wait until connected
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}

// Print the local IP address once connected
Serial.println("\nConnected!");
Serial.print("ESP32 IP Address: ");
Serial.println(WiFi.localIP());

}

void loop() {

// Send JSON request
if (WiFi.status() == WL_CONNECTED) {
  HTTPClient http;
  http.begin(serverUrl); // Specify the server URL
  http.addHeader("Content-Type", "application/json"); // Set content type to JSON

  // Create JSON object
  JsonDocument jsonDoc;
  // Create the 'getvars' array
  JsonArray getvars = jsonDoc.createNestedArray("getstringvars");
  // Create an object inside of the array
  JsonObject item = getvars.createNestedObject();
  item["var"] = "(A:TITLE, String)";
  item["value"] = "";
  // Serialize JSON to string
  String jsonString;
  serializeJson(jsonDoc, jsonString);

  // Send POST request
  int httpResponseCode = http.POST(jsonString);

  // Handle response
  if (httpResponseCode > 0) {
    String response = http.getString();
    Serial.println("Response:");
    Serial.println(response);
    deserializeResponse(response);
  } else {
    Serial.print("Error on sending POST: ");
    Serial.println(httpResponseCode);
  }

  http.end(); // Free resources
}

// update every second
delay(1000);
}

void deserializeResponse(String response) {
  JsonDocument doc;
  DeserializationError error = deserializeJson(doc, response);

  if (error) {
    Serial.print("JSON Deserialization failed: ");
    Serial.println(error.c_str());
    return;
  }

  // Extract the value from getstringvars
  JsonArray getstringvars = doc["getstringvars"];
  if (!getstringvars.isNull() && getstringvars.size() > 0) {
    String aircraftTitle = getstringvars[0]["value"].as<String>(); // Store the value in a string
    Serial.println("Aircraft Title: " + aircraftTitle);
  } else {
    Serial.println("getstringvars is null or empty");
  }
}

 

Edited by HadronFlux

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.