minor things changed

This commit is contained in:
mischa 2019-11-03 14:17:34 +01:00
parent 780060e582
commit 3b39003811
6 changed files with 13 additions and 12 deletions

View File

@ -3,6 +3,7 @@
# Copyright 2019, Mischa Peters <mischa AT high5 DOT nl>, High5!.
# Version 1.0 - 20191030
#
# Control a light based on sensor information
# Get ['dark'] from sensor ID and switch on/off light ID
# depending where your sensor is located you can use ['daylight']
#
@ -20,7 +21,7 @@ import ssl
import urllib.request
import json
parser = argparse.ArgumentParser(description="Turn light on")
parser = argparse.ArgumentParser(description="Control light based on light sensor")
parser.add_argument("bridge", type=str, help="Hue Bridge IP")
parser.add_argument("token", type=str, help="Hue API Token")
parser.add_argument("-s", "--sensor", type=int, required=True, help="sensor id#")

View File

@ -19,7 +19,7 @@ import ssl
import urllib.request
import json
parser = argparse.ArgumentParser(description="Get all sensors from Hue Bridge")
parser = argparse.ArgumentParser(description="Get all group ids from Hue Bridge")
parser.add_argument("bridge", type=str, help="Hue Bridge IP")
parser.add_argument("token", type=str, help="Hue API Token")

View File

@ -19,7 +19,7 @@ import ssl
import urllib.request
import json
parser = argparse.ArgumentParser(description="Get all sensors from Hue Bridge")
parser = argparse.ArgumentParser(description="Get all light ids from Hue Bridge")
parser.add_argument("bridge", type=str, help="Hue Bridge IP")
parser.add_argument("token", type=str, help="Hue API Token")

View File

@ -22,7 +22,7 @@ import json
import re
import collections
parser = argparse.ArgumentParser(description="Get all sensors from Hue Bridge")
parser = argparse.ArgumentParser(description="Get all sensor ids from Hue Bridge")
parser.add_argument("bridge", type=str, help="Hue Bridge IP")
parser.add_argument("token", type=str, help="Hue API Token")

View File

@ -3,10 +3,10 @@
# Copyright 2019, Mischa Peters <mischa AT high5 DOT nl>, High5!.
# Version 1.0 - 20191102
#
# Control a light or plug
# Control a group of lights (room)
#
# For example:
# $ groupctl.py <bridge IP> <token> -i 24 -a on
# $ groupctl.py <bridge IP> <token> -g 4 -a on
#
# Follow the steps at the Hue Developer site to get the username/token
# https://developers.meethue.com/develop/get-started-2/
@ -19,10 +19,10 @@ import ssl
import urllib.request
import json
parser = argparse.ArgumentParser(description="Control group lights (room)")
parser = argparse.ArgumentParser(description="Control group of lights (room)")
parser.add_argument("bridge", type=str, help="Hue Bridge IP")
parser.add_argument("token", type=str, help="Hue API Token")
parser.add_argument("-i", "--id", type=int, required=True, help="light id#")
parser.add_argument("-g", "--group", type=int, required=True, help="group id#")
parser.add_argument("-a", "--action", type=str, default='on', help="on|off|relax|bright|dimmed|nightlight")
parser.add_argument("-v", "--verbose", action='store_true', help="verbose")
parser.add_argument("-d", "--debug", action='store_true', help="debug")
@ -31,7 +31,7 @@ try:
args = parser.parse_args()
bridge = args.bridge
token = args.token
group_id = args.id
group = args.group
action = args.action
verbose = args.verbose
debug = args.debug
@ -92,5 +92,5 @@ def put_state(id, state):
if verbose or debug: print (f"{res.status} {res.reason}")
return(res)
group_state = get_state(group_id)
put_state(group_id, group_state)
group_state = get_state(group)
put_state(group, group_state)

View File

@ -6,7 +6,7 @@
# Control a light or plug
#
# For example:
# $ lightctl.py <bridge IP> <token> -i 24 -a relax
# $ lightctl.py <bridge IP> <token> -l 24 -a relax
#
# Follow the steps at the Hue Developer site to get the username/token
# https://developers.meethue.com/develop/get-started-2/