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.

Trying to connect to 2 tags at once

See original GitHub issue

As mentioned over in the Node-Red side of things, I’m having issues connecting to multiple tags at once.

The second discover never happens. I’m wondering if the discovery phase is shutdown by the connect call. If so I guess the only way to do it is to call discover all, save the list of discovered tags and then connect after a suitable time out period?

var SensorTag = require('sensortag');

SensorTag.discoverByUuid("34b1f7d136b9",function(tag){
    console.log("found " + tag.uuid);
    tag.connect(function(){
        tag.discoverServicesAndCharacteristics(function(){
            tag.notifySimpleKey(function(err){
                console.log(err);
            });
            tag.on('simpleKeyChange', function(left, right){
                console.log("button " + left + " 34b");
            });
        })
    });


});

SensorTag.discoverByUuid('1cba8c20caf3',function(tag){
    console.log("found " + tag.uuid);
    tag.connect(function(){
        tag.discoverServicesAndCharacteristics(function(){
            tag.notifySimpleKey(function(err){
                console.log(err);
            });
            tag.on('simpleKeyChange', function(left, right){
                console.log("button " + left + " 1cb");
            });
        })
       });
});

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:43 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
martin-doylecommented, Feb 9, 2016

What I found is that discovering stops when some data is sent. This the case when you do connectAndSetUp. In order to fix that I do the following:

  1. Discover All
  2. On connect stop discovering
  3. When connected start discovering again

You can find a test script at https://github.com/martin-doyle/SensorTagMQTT/blob/master/testSensorTag.js.

I could connect up to 5 SensorTags so far. Please let me know if that works for you.

0reactions
mukutprasad1992commented, Apr 24, 2019

Hi, I have two noble listeners one is listening only and another one is scan and connect. If Noble is scanning and then connect after that 1 connection attempts never automatically start scanning. I have to start scanning manually “Noble.startScanning()” after every broadcast. Is there any solution to prevent them. Thanks in advance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to connect multiple tags to block out interface? - 226387
To summarize, I'm trying to connect the two tags/outputs (next to blue arrow), to the out (next to the red arrow) of the...
Read more >
How to Combine Tags In Minecraft - YouTube
This video will show you how to combine tags such as the display tag and the enchantments tag into one item. Plus how...
Read more >
Can I select multiple tags using getElementsByTagName?
No, you can't select multiple tags with a single call to getElementsByTagName . You can either do two queries using getElementsByTagName or use ......
Read more >
Wrap multiple tags at once - Display & Video 360 Help
Step 1: Export the display creatives you want to wrap. Open Display & Video 360. ... Step 2: Send the tag wrapping spreadsheet...
Read more >
Send to Tags
Use an automated email to send a campaign when you add a specific tag to a contact. The message can be anything you...
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