Oculus Quest Battery Level

Any chance anyone knows how to get the battery level from an Oculus Quest 2 Headset? I can obviously see if it’s online/awake when it’s connected to wifi but the kids tend to forget to charge it. I am poking around the Facebook API stuff but haven’t found anything useful just yet.

1 Like

Got this figured out using adb… and adb shell dumpsys battery - will share the code later when back on desktop

Using ADB Server Add-On to help keep ADB connection Alive

- platform: command_line
  name: "Oculus Quest 2 ADB Battery Level"
  command: "ssh -o StrictHostKeyChecking=no -i /config/ssh/id_rsa [email protected] 'docker exec addon_a0d7b954_adb adb -s 192.168.1.229:5555 shell dumpsys battery'"
  value_template: '{{ value.split(" ")[41] }}'
  command_timeout: 40
  scan_interval: 180

- platform: command_line
  name: "Oculus Quest 2 ADB Charging State"
  command: "ssh -o StrictHostKeyChecking=no -i /config/ssh/id_rsa [email protected] 'docker exec addon_a0d7b954_adb adb -s 192.168.1.229:5555 shell dumpsys battery'"
  value_template: '{{ value.split(" ")[7] }}'
  command_timeout: 40
  scan_interval: 180
3 Likes

is this you home assistant instance? Trying to get this setup for myself on HassOS, so would I log in via root to mine?

Yes that is the host system… but I’m running HA Supervised on Debian… not really sure how that translates to HassOS as I have never used it. Does it still use docker containers?

You could also probably do it right in the adb add-on container… I’m assuming that’s how HassOS is setup ? But that was the only method of connecting that I knew of at the time… as I was brand new to Supervised installs

it does use docker containers for the add-ons. I’ll have to do a little research and maybe some discording to figure out how to connect to it and run the command. Thanks!

So I’m not sure if you have portainer installed… so you could either go to the console in there for the homeassistant container, or at a command line type docker exec -it homeassistant /bin/bash and that will put you at the same CLI that the shell command/template sensor would be using… there you could then try

docker exec addon_a0d7b954_adb adb -s 192.168.1.229:5555 shell dumpsys battery'

Obviously making sure that is the name of your adb container and change ip to that of your oculus and see if you get a response…
All of this though, first requires that you have already connected via usb using

adb tcpip 5555

https://developer.oculus.com/documentation/native/android/mobile-adb/?device=QUEST

2 Likes