Skip to main content

Library to control Zerproc Bluetooth LED smart string lights

Project description

https://img.shields.io/pypi/v/pyzerproc.svg https://img.shields.io/travis/emlove/pyzerproc.svg https://coveralls.io/repos/emlove/pyzerproc/badge.svg

Library to control Zerproc Bluetooth LED smart string lights

  • Free software: Apache Software License 2.0

Features

  • Turn lights on and off

  • Set light color

  • Get light status

Command line usage

pyzerproc ships with a command line tool that exposes the features of the library.

$ pyzerproc turn-on AA:BB:CC:00:11:22
INFO:pyzerproc.light:Connecting to AA:BB:CC:00:11:22
INFO:pyzerproc.light:Turning on AA:BB:CC:00:11:22

$ pyzerproc turn-off AA:BB:CC:00:11:22
INFO:pyzerproc.light:Connecting to AA:BB:CC:00:11:22
INFO:pyzerproc.light:Turning off AA:BB:CC:00:11:22

$ pyzerproc set-color AA:BB:CC:00:11:22 ff0000
INFO:pyzerproc.light:Connecting to AA:BB:CC:00:11:22
INFO:pyzerproc.light:Changing color of AA:BB:CC:00:11:22 to #ff0000

$ pyzerproc set-color AA:BB:CC:00:11:22 00ff00
INFO:pyzerproc.light:Connecting to AA:BB:CC:00:11:22
INFO:pyzerproc.light:Changing color of AA:BB:CC:00:11:22 to #00ff00

$ pyzerproc is-on AA:BB:CC:00:11:22
INFO:pyzerproc.light:Connecting to AA:BB:CC:00:11:22
INFO:pyzerproc.light:Got state of AA:BB:CC:00:11:22: <LightState is_on='True' color='(255, 0, 0)'>
True

$ pyzerproc get-color AA:BB:CC:00:11:22
INFO:pyzerproc.light:Connecting to AA:BB:CC:00:11:22
INFO:pyzerproc.light:Got state of AA:BB:CC:00:11:22: <LightState is_on='True' color='(255, 0, 0)'>
ff0000

Usage

Turn a light on and off

import pyzerproc
import time

address = "AA:BB:CC:00:11:22"

light = pyzerproc.Light(address)

try:
    light.connect()
    light.turn_on()

    time.sleep(5)

    light.turn_off()
finally:
    light.disconnect()

Change the light color

import pyzerproc
import time

address = "AA:BB:CC:00:11:22"

light = pyzerproc.Light(address)

try:
    light.connect()

    while True:
        light.set_color(255, 0, 0) # Red
        time.sleep(1)
        light.set_color(0, 255, 0) # Green
        time.sleep(1)
finally:
    light.disconnect()

Get the light state

import pyzerproc
import time

address = "AA:BB:CC:00:11:22"

light = pyzerproc.Light(address)

try:
    light.connect()

    state = light.get_state()

    if state.is_on:
        print(state.color)
    else:
        print("Off")
finally:
    light.disconnect()

Changelog

0.0.2 (2020-05-05)

  • Get the current light state

0.0.1 (2020-05-04)

  • Initial release

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyzerproc-0.0.2.tar.gz (7.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page