3

I want to get MAC address of my webOS smart-tv pragmatically to send on api request but i can not find how to get . please Help

I used luna service api but it only gives device unique ID

var request = webOS.service.request("luna://com.webos.service.sm", {
    method: "deviceid/getIDs",
    parameters: { 
        "idType": ["LGUDID"]        
    },
    onSuccess: function (inResponse) {
        console.log("Result: " + JSON.stringify(inResponse));
        // To-Do something
    },
    onFailure: function (inError) {
        console.log("Failed to get system ID information");
        console.log("[" + inError.errorCode + "]: " + inError.errorText);
        // To-Do something
        return;
    }
});

I expect the output 74:40:BE:2A:B2:4A type Mac address

Nitin tiwari
  • 664
  • 1
  • 8
  • 23
  • MAC address is only valid on the internal network, so an API on an external service will not be able to see it. You need to use local OS calls (in your wb TV app, I assume that'sd what you are writing) to look at your network interfaces and retrieve the MAC from it. – Stefan Becker Aug 05 '19 at 06:59

2 Answers2

0

The API does not seem to expose the mac address of the interfaces. Note that there are two mac addresses (one for the wired and one for the wireless connection).

But you may be able to query ARP to get the mac address for the ip address of the tv, if you are on the same network segment.

MofX
  • 1,569
  • 12
  • 22
0
let mac = '';
let mac2 = '';
webOS.service.request("luna://com.webos.service.connectionmanager", {
    method: "getinfo",
    parameters: {},
    onSuccess: function (args) {
        mac = args.wiredInfo.macAddress;
        mac2 = args.wifiInfo.macAddress;
    },
    onFailure: function (args) {
        
    }
}); 
oussama zaqouri
  • 174
  • 1
  • 9
  • Please consider adding a brief explanation of [how and why this solves the problem](https://meta.stackoverflow.com/q/392712/13138364). This will help readers to better understand your solution. – tdy Nov 23 '21 at 18:46