Code Monkey home page Code Monkey logo

Comments (7)

Betree avatar Betree commented on May 22, 2024

I never tried with a v6. Did you order it recently ?

Try connecting with a public address type :

sudo gatttool -t public -b EA:9C:0F:A6:A0:22 -I

from magicblue.

dragonxtek avatar dragonxtek commented on May 22, 2024

I tried with -t public with V8 and it doesn't works. (only works with -t random).
With v6, I can't connect with both of them.
I bought it through aliexpress 6 months ago.
For v8 I use handle 0x000c and for v6 handle 0x0043, but as I said you, I can't connect throught gattool to test it without the official Android application.

from magicblue.

dragonxtek avatar dragonxtek commented on May 22, 2024

I tested bulb v6 with your app and it works, but only on interactive mode:

sudo python3 magicblueshell.py                                          
Magic Blue interactive shell v0.4.2
Type "help" for a list of available commands
> list_devices
Listing Bluetooth LE devices in range for 300 seconds. Press CTRL+C to abort searching.
ID    Name                           Mac address 
--    ----                           ----------- 
1     LEDBlue-72C816D6               d0:39:72:c8:16:d6

> connect 1
INFO:__main__:Connected
> set_color green

When I tried to change the color without interactive mode, it doesn't work:

sudo python3 magicblueshell.py -c 'set_color blue' -m d0:39:72:c8:16:d6
Traceback (most recent call last):
  File "magicblueshell.py", line 307, in <module>
    sys.exit(main())
  File "magicblueshell.py", line 298, in main
    shell.cmd_connect([params.mac_address])
  File "magicblueshell.py", line 159, in cmd_connect
    self._magic_blue.connect(self.bluetooth_adapter)
  File "/usr/local/lib/python3.5/dist-packages/magicblue-0.4.2-py3.5.egg/magicblue/magicbluelib.py", line 119, in connect
    
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 318, in __init__
    self.connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 367, in connect
    "Failed to connect to peripheral %s, addr type: %s" % (addr, addrType))
bluepy.btle.BTLEException: Failed to connect to peripheral d0:39:72:c8:16:d6, addr type: random

Do you know why it doesn't works? What is the difference between interactive connection and non-interactive connection?

from magicblue.

dragonxtek avatar dragonxtek commented on May 22, 2024

I tried with MAC but it doesn't work, but if I use the ID it works. Why is it?

> list_devices
Listing Bluetooth LE devices in range for 300 seconds. Press CTRL+C to abort searching.
ID    Name                           Mac address 
--    ----                           ----------- 
1     LEDBlue-72C816D6               d0:39:72:c8:16:d6
^C

> connect d0:39:72:c8:16:d6
ERROR:__main__:Unexpected error with command "connect d0:39:72:c8:16:d6": Failed to connect to peripheral d0:39:72:c8:16:d6, addr type: random
> connect 1
INFO:__main__:Connected

from magicblue.

dragonxtek avatar dragonxtek commented on May 22, 2024

I solved!
I don't know why, but version 6, is equal to version 9 or 10.

read device_info
INFO:__main__:Received device_info: {'r': 0, 'effect_speed': 0, 'brightness': 255, 'device_type': 21, 'version': 6, 'on': True, 'g': 0, 'effect': None, 'effect_no': 65, 'b': 0}

If I choose any of these versions, it works
sudo python3 magicblueshell.py -c 'set_warm_light 1.0' -m d0:39:72:c8:16:d6 -b 9

from magicblue.

Betree avatar Betree commented on May 22, 2024

Do you know why it doesn't works? What is the difference between interactive connection and non-interactive connection?

Interactive mode auto-detect address type during scan. We don't do this when connecting directly or using the library for performance reasons.

However setting version to 9 or 10 forces address type to be a public address, that means v6 uses a public address type too. I'll make a commit to officially support this version with the info you provided.

Thanks for your feedback 👍

from magicblue.

Betree avatar Betree commented on May 22, 2024

Merged with master, will be included in next release. You can continue to use -b 9 or -b 10, it won't have any other impacts.

from magicblue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.