question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Battery service (180F) not available

See original GitHub issue

Not sure if this is a Linux/Chrome bug or related to #94. I’m running on Ubuntu 18.04 with Chrome. Heartrate test seems to work fine, so I’m confused why there are issues with Battery simulation.

I’m testing through this page: https://googlechrome.github.io/samples/web-bluetooth/battery-level.html Seeing the following “Live Output”:

Requesting Bluetooth Device...
Connecting to GATT Server...
Getting Battery Service...
Argh! NotFoundError: No Services matching UUID 0000180f-0000-1000-8000-00805f9b34fb found in Device.

I found that exact 0000180f-... battery_service UUID in the android code here: https://github.com/WebBluetoothCG/ble-test-peripheral-android/blob/277fbf7c586d579a9d270d71f7891144dea5e4d5/app/src/main/java/io/github/webbluetoothcg/bletestperipheral/BatteryServiceFragment.java#L45

The reset energy app works: https://googlechrome.github.io/samples/web-bluetooth/reset-energy.html

Live output of:

Requesting Bluetooth Device...
Connecting to GATT Server...
Getting Heart Rate Service...
Getting Heart Rate Control Point Characteristic...
Writing Heart Rate Control Point Characteristic...
> Energy expended has been reset.

Which successfully resets the energy expended value to zero in the android app.

Trying to troubleshoot with bluetoothctl (Linux CLI utility). Seeing reasonable GATT listing “Heart Rate Control Point” (2A39) when opening the heartrate tab in the android app:

menu gatt
list-attributes
Primary Service
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0001
	00001801-0000-1000-8000-00805f9b34fb
	Generic Attribute Profile
Characteristic
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0001/char0002
	00002a05-0000-1000-8000-00805f9b34fb
	Service Changed
Primary Service
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0028
	0000180d-0000-1000-8000-00805f9b34fb
	Heart Rate
Characteristic
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0028/char0029
	00002a37-0000-1000-8000-00805f9b34fb
	Heart Rate Measurement
Descriptor
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0028/char0029/desc002b
	00002902-0000-1000-8000-00805f9b34fb
	Client Characteristic Configuration
Descriptor
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0028/char0029/desc002c
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
Characteristic
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0028/char002d
	00002a38-0000-1000-8000-00805f9b34fb
	Body Sensor Location
Characteristic
	/org/bluez/hci0/dev_65_56_A7_7E_47_2C/service0028/char002f
	00002a39-0000-1000-8000-00805f9b34fb
	Heart Rate Control Point

But when switching over to the Battery tab, I don’t see the battery service listed.

menu gatt
list-attributes
Primary Service
	/org/bluez/hci0/dev_5C_91_FB_35_1C_CE/service0001
	00001801-0000-1000-8000-00805f9b34fb
	Generic Attribute Profile
Characteristic
	/org/bluez/hci0/dev_5C_91_FB_35_1C_CE/service0001/char0002
	00002a05-0000-1000-8000-00805f9b34fb
	Service Changed

Upon a fresh connection, I do see the 180F battery status UUID logged with the [CHG] tag, but it does not persist with list-attributes.

[miles g5]# connect 5C:91:FB:35:1C:CE
Attempting to connect to 5C:91:FB:35:1C:CE
[CHG] Device 5C:91:FB:35:1C:CE Connected: yes
Connection successful
[CHG] Device 54:59:49:F9:57:73 ServicesResolved: no
[CHG] Device 54:59:49:F9:57:73 Connected: no
[DEL] Characteristic
	/org/bluez/hci0/dev_54_59_49_F9_57_73/service0001/char0002
	00002a05-0000-1000-8000-00805f9b34fb
	Service Changed
[DEL] Primary Service
	/org/bluez/hci0/dev_54_59_49_F9_57_73/service0001
	00001801-0000-1000-8000-00805f9b34fb
	Generic Attribute Profile
[DEL] Device 54:59:49:F9:57:73 miles g5
[NEW] Primary Service
	/org/bluez/hci0/dev_5C_91_FB_35_1C_CE/service0001
	00001801-0000-1000-8000-00805f9b34fb
	Generic Attribute Profile
[NEW] Characteristic
	/org/bluez/hci0/dev_5C_91_FB_35_1C_CE/service0001/char0002
	00002a05-0000-1000-8000-00805f9b34fb
	Service Changed
[CHG] Device 5C:91:FB:35:1C:CE UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:91:FB:35:1C:CE UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:91:FB:35:1C:CE UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device 5C:91:FB:35:1C:CE ServicesResolved: yes

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dlechcommented, Dec 13, 2020

FWIW, sudo systemctl edit bluetooth.service with the following contents will probably work better for most people.

[Service]
ExecStart=
ExecStart=-/usr/lib/bluetooth/bluetoothd -P battery

If changes are made directly to /lib/systemd/system/bluetooth.service, they will be overwritten whenever the bluez package is updated.

0reactions
dlechcommented, Dec 13, 2020

It is not an “empty” command, it means delete all previous commands. Since the dbus type can only have one command, we have to delete the old one before we can add a new one. In the end there is still exactly one command.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Battery Service 0x180F - Silicon Labs Community
I am trying to define a service for the battery level as defined in the standard. I realized that it is not writable....
Read more >
BLE device battery service | Apple Developer Forums
I'm devloping an iOS App for the Polar H7 and H10 Heart Rate sensors and it's crucial that the App monitors the attached...
Read more >
Nano BLE, Central cant read values - Arduino Forum
Hi everyone, I recently bought a nano 33 ble and wanted to test out its BLE capabilities, the receiving/sending advertising data works fine....
Read more >
Battery Service on OSX (Yosemite) broken? #133 - GitHub
On linux I appear to have a connectable battery service, but not in yosemite. ... [Error: failed to set service 180F, UUID not...
Read more >
How to add two more characteristics under Standard Battery ...
I am trying to add two more parameters(Characteristics Value) under the Battery Service. Some how it is not creating.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found