Skip to content

sandrocods/Bardi-Led-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bardi Led Automation

Automation for BARDI Bluetooth Light Bulb 9W RGBWW. use ADB automation need to use android smartphone :D

Result

Interaction ADB using Ngrok over network 4g

My.Video1.mp4

Feature

Name Status
Change Color βœ…
On / Off Device βœ…
Change Brightness βœ…
Connection via Wifi / USB / Ngrok βœ…
Change Theme βœ…
Termux / Linux / Windows Support βœ…

Run Locally

Clone the project

  git clone https://github.com/sandrocods/Bardi-Led-Automation

Go to the project directory

  cd Bardi-Led-Automation

Install dependencies

  pip3 install -r requirements.txt

Start the example

  cd example
  python3 connection.py

you can use console application to interaction with Bardi LED

  python3 main.py

Output :

Connect and Select Devices

image

After Connected you can use menu

image

Enable Connection ADB via Wifi

βœ” You must have adb program

  • Connect usb cable to your phone
  • Open cmd
  • Type: adb tcpip 5555
  • Get your phone ip address

How to connect multiple android devices with ADB over wifi :

How to use Ngrok

βœ” You must have adb program

  • Connect usb cable to your phone

  • Open cmd

  • Type: adb tcpip 5555

  • Get your phone ip address

  • Install Ngrok and set token

  • run this command

   ./ngrok tcp <ip phone>:5555

API Reference

Connect Device

# Via Wifi
connector_bardi = BardiConnector(
    timeout=10.0,
    connection_type="wifi",
    address="192.168.0.161:5555"
)

# Via USB
connector_bardi = BardiConnector(
    timeout=10.0,
    connection_type="usb"
)

# Via Ngrok ( Over Network ) 
connector_bardi = BardiConnector(
        timeout=10.0,
        connection_type="ngrok",
        address="6.tcp.xxxxxxx:5555"
    )

Output :

    {
        "status": True,
        "message": "Device connected"
    }

Get all color

   print(connector_bardi.location_color)

Output :

  {'green': (0.693, 0.598), 'pink': (0.144, 0.447), 'blue': (0.769, 0.396), 'lime': (0.258, 0.595), 'cyan': (0.802, 0.545)}

Get all brightness

   print(connector_bardi.brightness)

Output :

  {'50': (0.529, 0.727), '100': (0.815, 0.672), '1': (0.182, 0.671), '25': (0.331, 0.715), '75': (0.655, 0.717)}

Get Theme by Music

  connector_bardi.get_theme_by_music()
  print(connector_bardi.theme_data)

Output :

  [{'theme_name': 'Music rhythm', 'theme_location': (887, 608)}, {'theme_name': 'Game', 'theme_location': (887, 608)}, {'theme_name': 'Romantic', 'theme_location': (887, 608)}]

Get Default Theme

    connector_bardi.get_theme()
    print(connector_bardi.theme_data)

Output :

  [{'theme_name': 'Good Night', 'theme_location': (397, 448)}, {'theme_name': 'Leisure', 'theme_location': (864, 448)}, {'theme_name': 'Gorgeous', 'theme_location': (383, 725)}, {'theme_name': 'Dream', 'theme_location': (860, 725)}, {'theme_name': 'Sunflower', 'theme_location': (386, 1003)}, {'theme_name': 'Grassland', 'theme_location': (889, 1003)}]

unlist color

  [
      'white',
      'half white',
      'sepia'
  ]