Skip to content

Instantly share code, notes, and snippets.

@vigevenoj
Created December 31, 2018 21:54
Show Gist options
  • Save vigevenoj/3087078a99eaf07dd0bfbd3b0139dfa5 to your computer and use it in GitHub Desktop.
Save vigevenoj/3087078a99eaf07dd0bfbd3b0139dfa5 to your computer and use it in GitHub Desktop.
pretty-print hue bulbs with id, model, serial number, and name
#! /usr/bin/env python3
import argparse
from phue import Bridge
def main(bridge_ip):
bridge = Bridge(bridge_ip)
api = bridge.get_api()
lights = api['lights']
for light in lights:
print("{0}\t{1}\t{2:20}\t{3}\t{4}".format(
light,
lights[light]['modelid'],
lights[light]['type'],
lights[light]['uniqueid'],
lights[light]['name']))
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="A tool to pretty-print information about your hue bulbs")
parser.add_argument("bridge_ip",
help="IP address of the Hue bridge")
args = parser.parse_args()
main(args.bridge_ip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment