Skip to content

💡 Unofficial Python API to control bluetooth speaker bulb

License

Notifications You must be signed in to change notification settings

orrpan/bluetooth_speaker_bulb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bluetooth Speaker Bulb

Use at own risk! This library is only for the settings of the bulb, not playing music. Brands

  • Alloyseed
  • Mylight
  • MSC
  • TCP Smart LED
  • Boombeat
  • SweetLF

Bluetooth speaker bulbs using iLink app (ios)

Bluetooth Speaker Bulb

Usage

Module

import asyncio
import logging
from bluetooth_speaker_bulb.bulb import Bulb

logging.basicConfig(level=logging.DEBUG)

ADDRESS = "00:00:00:00:00:00"
ADAPTER = "hci0"


async def main(target_mac_address, host_adapter):
    bulb = Bulb(mac_address=target_mac_address, adapter=host_adapter)
    print(await bulb.connect())

    await bulb.update()
    print(await bulb.get_device_name())
    await bulb._connection.get_services()

    await bulb.turn_off()
    for k in range(1, 10, 1):
        print(await bulb.get_light_info())
        print(await bulb.turn_on())
        await bulb.turn_on(20*k)
        await asyncio.sleep(0.1)

    await bulb.update_light()

    await bulb.set_volume(50)

    await bulb.set_speaker_effect('flat')
    await bulb.update_speaker()
    print(bulb._speaker.effect)
    await asyncio.sleep(2)

    await bulb.set_speaker_effect('classical')
    await bulb.update_speaker()
    print(bulb._speaker.effect)
    await asyncio.sleep(2)

    await bulb.set_speaker_effect('pop')
    await bulb.update_speaker()
    print(bulb._speaker.effect)
    await asyncio.sleep(2)

    await bulb.set_speaker_effect('bass')
    await bulb.update_speaker()
    print(bulb._speaker.effect)
    await asyncio.sleep(2)

    await bulb.set_speaker_effect('jazz')
    await bulb.update_speaker()
    print(bulb._speaker.effect)
    await asyncio.sleep(2)

    print(await bulb.disconnect())


asyncio.run(main(ADDRESS, ADAPTER))

Todo

See List

Package description

Send

{4 byte} header [0x55, 0xaa]
{2 byte} data length
{2 byte} 0x08 lamp/effect, 0x05 timer, 0x04 music/sound settings
{2 byte} function
{data length byte} data
{2 byte} checksum

Receive

{4 byte} header [0x55, 0xaa]
{2 byte} data length
{2 byte} 0x88 lamp/effect, 0x85 timer, 0x84 music/sound settings
{2 byte} function
{data length byte} data
{2 byte} checksum

Credits / Special Thanks

About

💡 Unofficial Python API to control bluetooth speaker bulb

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%