Could not start scanning, state is unknown (not poweredOn)

See original GitHub issue

Hello, I’ve tried to scan for BLE devices:

noble = require('noble')

noble.startScanning();
console.log "Scanning"

this results in a error message (?):

noble: Could not start scanning, state is unknown (not poweredOn)
Scanning

Is the code wrong or is the message wrong? Is intended, that a message is printed on the screen? Shouldn’t an exception being thrown if a precondition is not met?

I’ve tried 1.1.0 on OS/X 10.10

Cheers, Torsten

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

4reactions
carlstcommented, Aug 13, 2015

@TorstenRobitzki: you might try waiting for the state to become poweredOn:

noble.on('stateChange', function(state) {
  if (state === 'poweredOn')
    noble.startScanning();
  else
    noble.stopScanning();
});
1reaction
quique123commented, Jul 29, 2018

Im trying to read a ble char from a ble relay board from my rpi3. startScanning() simply hangs or returns error that ble device isnt powered on. Why is that?

I know the ble on the rpi3 works because I use it to write to the relay board every so often and it works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to power BLE back on using node-red-contrib-noble ...
Any ideas how to prevent or catch this error? Error scanning for devices: Error: Could not start scanning, state is poweredOff (not poweredOn)....
Read more >
sandeepmistry/bleno - Gitter
hello im using bleno for a demo but i cannot get it start advertising , everytime it ... Could not start scanning, state...
Read more >
noble.state is set to "poweredOff" immediately after running ...
When the state is set to "poweredOff" it stops scanning so I am never able to find devices. Here is my code: const...
Read more >
@lemariva/noble - npm
Some BLE adapters cannot connect to a peripheral while they are scanning ... NOTE: noble.state must be poweredOn before scanning is started.
Read more >
API misuse | Apple Developer Forums
unknown state, just as we implement the centralManagerDidUpdateState method. In any case, the state doesn't change until the scan is called. So, how...
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