Skip to main content

A python connector for WiZ light bulbs (e.g SLV Play)

Project description

pywizlight

A python connector for WiZ light bulbs. Work in progress an only tested with the SLV Play RGB bulb.

Example

    from pywizlight import wizlight

    light = wizlight("<your bulb ip")
    # turn on the light
    light.turn_on()
    # set bulb to warm white color
    light.warm_white = 255
    # print the value 
    print(light.warm_white)
    # set red to 255 = 100%
    light.rgb = 255, 0, 0
    # set green to 255 = 100%
    light.rgb = 0, 255, 0
    # set blue to 255 = 100%
    light.rgb = 0, 0, 255
    # get the current values
    r, g, b = light.rgb
    print("red %i green %i blue %i" % (r, g, b))
    # start a scene 
    light.scene = 14 # party
    # get the name of the current scene
    print(light.scene)
    # set brightness to 255 = 100%
    light.brightness = 255
    # turns the light off
    light.turn_off()

Bulb paramters (UDP RAW):

  • sceneId - calls one of thr predefined scenes (int from 0 to 32) Wiki
  • speed - sets the color changing speed in precent
  • dimming - sets the dimmer of the bulb in precent
  • r - red color range 0-255
  • g - green color range 0-255
  • b - blue color range 0-255
  • c - cold white range 0-255
  • w - warm white range 0-255
  • id - the bulb id

Classes

wizlight(ip) Creates a instance of a WiZ Light Bulb. Constructor with ip of the bulb

Instance variables

brightnessgets the value of the brightness 0-255

color get the rgbW color state of the bulb and turns it on

colortemp get the color temperature ot the bulb

rgb get the rgb color state of the bulb and turns it on

status returns true or false / true = on , false = off

Methods

getBulbConfig(self) returns the configuration from the bulb

getState(self) gets the current bulb state - no paramters need to be included

hex_to_percent(self, hex) helper for convertring 0-255 to 0-100

percent_to_hex(self, percent) helper for converting 0-100 into 0-255

lightSwitch(self) turns the light bulb on or off like a switch

sendUDPMessage(self, message) send the udp message to the bulb

turn_off(self) turns the light off

turn_on(self) turns the light on

Bulb methodes (UDP nativ):

  • getSystemConfig - gets the current system configuration - no paramters need
  • syncPilot - sent by the bulb as heart-beats
  • getPilot - gets the current bulb state - no paramters need to be included
  • setPilot - used to tell the bulb to change color/temp/state
  • Pulse - uncertain of purpose
  • Registration - used to "register" with the bulb: This notifies the built that it you want it to send you heartbeat sync packets.

Example requests

Send message to the bulb: {"method":"setPilot","params":{"r":255,"g":255,"b":255,"dimming":50}} Response: {"method":"setPilot","env":"pro","result":{"success":true}}

Get state of the bulb: {"method":"getPilot","params":{}} Response: {"method":"getPilot","env":"pro","result":{"mac":"0000000000","rssi":-65,"src":"","state":false,"sceneId":0,"temp":6500,"dimming":100}}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pywizlight-0.2.4-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file pywizlight-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pywizlight-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.0

File hashes

Hashes for pywizlight-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a1b0de7e6fc01cb79a422fea24d5c206306be1880685c61985753731d9ed0eed
MD5 8e3c0c45f039337bee9738f20934b0f6
BLAKE2b-256 b9aeb6d088a978d97c816d066b4e21ed249cdc11339884c38f18950988076b37

See more details on using hashes here.

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