Philips Hue with python

Python philips hue
Source unsplash


pip install huesdk


Bridge IP


App username

from huesdk import Hue
username = Hue.connect(bridge_ip=YOUR_BRIDGE_IP)


hue = Hue(bridge_ip=YOUR_BRIDGE_IP, username=YOUR_USERNAME)


# Get all the lights connected to the bridge
lights = hue.get_lights()
# get a single light with id
light = hue.get_light(id_=1)

# get light with name
light = hue.get_light(name="Room 1")
light.bri # Brightness from 1 to 254
light.hue # the color with a value between 0 and 65535
light.sat # Saturation from 1 to 254
# turn on

# turn off

# Change color
# with hue, red=65535, green=21845 and blue=43690

# with hexadecimal

# Change brightness

# Change light's name
light.set_name("Hue color lamp 2")

# Change saturation
# the light will slowly turn off in 5secs
# the color's light will transition from the current color to red in 10seconds
light.set_color(hexa="#ff0000", transition=100)


# get all groups
groups = hue.get_groups()
# get group with id
group = hue.get_group(id_=1)

# get group with name
group = hue.get_group(name="kitchen")
group.set_name("Hue color lamp 2")
group.set_color(hexa="#065535", transition=100)




I work at yper. I’m a python developer, learning data science. I’ve made a app

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Reverse Engineering Sphero R2D2 With Javascript

Your first Augmented Reality app with Vuforia and Unity Engine

How to set up Lumen with Doctrine

CS371p Fall 2021: Sruthi Rudravajjala

WebSockets Demystified, Part 1: Understanding the Protocol

Deploying Django websites on Apache

Meet the Team: Imre Dobos

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alexis Gomes

Alexis Gomes

I work at yper. I’m a python developer, learning data science. I’ve made a app

More from Medium

Exception Handling Python

How python is used in automation?

Robot Framework in Python

Adding local dependency to a python project