Groovy get of hubitat MAC address

Is there a function call to get the Hubitat's network MAC address, i.e., the one printed on the bottom of each hubitat?

I'm not having much luck with a search here in Developers. I hope this is the correct channel to post this.

Thanks in advance!

There is a method coming out in 2.2.4 that does this directly, getMacAddress().

For older builds, do a GET against localhost/api/hubitat.xml

In the response from that 'serialNumber' is the MAC address.

2 Likes

Thank you! We shall try.

We're getting an error with the get, here's the code:

httpGet("http://192.168.1.119:80/api/hubitat.xml") { resp ->
        logDebug "httpGet() response status: ${resp.status}"
        }
org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused) on line 298 (updated)

Try port 8080. You cannot send and receive simultaneously from the same TCP port.

3 Likes