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

James’ Programming Journey part 11

Dynamically reloading rails_admin model concerns in development

How I Built My First MERN Stack App in a Week

Simple ways to pass to and share data with widgets/pages

GraphQL - Case Study : KASKUS Groups

Building the Business Case for Test Automation

Lambda Functions Continuous Deployments with GitHub Actions

Python — PIP

the result of pip help command

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

Crop Image to Face with Square Crop in Python

Easier Python Package Deploying

Sorting Algorithms in Python — Radix Sort

How to Update/Partial Update data in Elasticsearch Using Python Client