cli balena device get public address

Balena dashboard shows Public Address for online devices (the device public IP). I am trying to get this IP address from the command line.
But balena device does not provide that:
➜ Anglo balena device xxx
== xxx
ID: xxx
DEVICE TYPE: raspberrypi3
STATUS: idle
IS ONLINE: true
IP ADDRESS: xxxx
MAC ADDRESS: xxxx
APPLICATION NAME: xxxx
LAST SEEN: 2021-03-14T02:50:07.787Z
UUID: xxxx
COMMIT: xxxx
SUPERVISOR VERSION: 11.14.0
IS WEB ACCESSIBLE: false
OS VERSION: balenaOS 2.60.1+rev1
DASHBOARD URL: xxxx
CPU USAGE PERCENT: 15
CPU TEMP C: 64
CPU ID: 0000000048f0908
MEMORY USAGE MB: 356
MEMORY TOTAL MB: 973
MEMORY USAGE PERCENT: 37
STORAGE BLOCK DEVICE: /dev/mmcblk0
STORAGE USAGE MB: 288
STORAGE TOTAL MB: 14138
STORAGE USAGE PERCENT: 2

Any suggestions on how to pull that public IP address from the cli using a UUID?

Thanks

Welcome to the forums Johan!

I’ll leave it to one of the Balena team to confirm, but it looks like based on the CLI source code the Public IP address isn’t being selected from the API, so it isn’t being returned in the CLI.

Hopefully it’ll be added soon :smiley:

1 Like

FYI I’ve opened a PR on GitHub to add the public_address to the output:

1 Like

Thank you Chris for the prompt reply and action.
Based on you mentioning CLI uses the API I just used a curl command to get it directly from the API. Kicking myself for not thinking about that earlier :slight_smile:

Yes, most things in the balena ecosystem are interconnected and use the API as the single source of truth. So as one source might not be providing the information, you have numerous other ways (API & SDK’s) to get the information you need and how you need it. Thanks Chriswiggins for opening the PR, and I see my colleague already left a review on it - Public address by chriswiggins · Pull Request #2218 · balena-io/balena-cli · GitHub

Here’s some more information and docs on,
API resource for Device - Resources - Balena Documentation
Node SDK - https://www.balena.io/docs/reference/sdk/node-sdk
Python SDK - https://www.balena.io/docs/reference/sdk/python-sdk

Just following up to say the PR was merged and released under balena-cli version 12.42.0 :partying_face:

Brilliant, thank you for the followup!