This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thingy and blutoothctl - How to read data via Linux console?

Hello everybody!

How can i read the temperature, the battery-% or other data from the Thingy when using the Linux console and not the SDK? My steps so far

1. With

Fullscreen
1
sudo hcitool lescan
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
i was able to find the Thingy, a device with unknown name (but same MAC as the Thingy) and a third one which turns off with the Thingy.

2. start bluetoothctl and run

Fullscreen
1
info [MACofThingy]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
displays the name, an alias and trust/block/connect status

3. pairing with the Thingy did not work, but

Fullscreen
1
connect [MACofThingy]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(still in the bluetoothctl environment) did work and showed me nine UUIDs

4. diving into gatt submenu: one should be able to list the attributes and read/write them. But this does not work because no attributes are listed.

Another option i tried was the

Fullscreen
1
gatttool -b [MACofThingy] --char-read --uuid=2800
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
command with the Thingy still connected (green breathing light). The connection got refused (Error 111) for each UUID i tried.

Operating system is Ubuntu 16.04 on a Thinkpad with its Standard, BLE-capable, Wifi module.

  • Hi,

    This is likely an issue with your BLE drivers on Linux and not the Thingy:52 itself. See if you can connect to any other BLE devices. If not, you should do an update (or possibly rollback) of your BLE driver.

    We have have an example of Thingy:52 and Raspberry Pi using Raspbian Jessie which might be helpful. 

    Ketil

  • HI

    I thought so after trying with my phone (which has no problems reading the data). After searching the web for ages i found: hcitool and gatttool no longer distributed with standard BlueZ packages

    One has to use btmgmt now which is in the bluez packet. The newest packet (right now 5.49) can be downloaded at bluez.org

    This help for using btmgmt is also displayed in the console. But i did not manage to connect to the Thingy yet.

    1. Before calling this tool a "sudo rfkill unblock all" is needed.
    2. bgmgmt has to be opened as sudo
    3. Make sure BLE is on (Call "power on" and "le on") and connectable ("connectable on")
    4. use "find" to scan for devices --> list with MACs and RSSIs is displayed
    5. try pair [MACofThingy] and receiver a 0x04 error (connect failed).

    FAIL - I have to work some more on this problem. Not beeing able to connect bugs me.

  • Hi,

    Thanks for providing the details. I saw that there were fixes to GATT in 5.49 but I am not sure what these are. Maybe you could try to ask a question on the Bluez Mailing List?

    Ketil