mirror of
https://github.com/RustyRaptor/sengled-python.git
synced 2026-12-03 23:45:18 -07:00
First commit
This commit is contained in:
commit
f303d63477
10 files changed
+204
No files matched your search
@@ -0,0 +1,41 @@
|
||||
from SengledElement import client
|
||||
import sys
|
||||
|
||||
home = None
|
||||
|
||||
|
||||
def list_devices():
|
||||
for name in home.devices.get_names():
|
||||
print(name)
|
||||
|
||||
|
||||
def set_state(name=None, state=None):
|
||||
if name is None:
|
||||
name = input("Which bulb?")
|
||||
if state is None:
|
||||
state = input("What state?")
|
||||
home.devices.set_device_state(state, device_name=name)
|
||||
|
||||
|
||||
def main_input():
|
||||
max_option = 3
|
||||
while True:
|
||||
print("1)\tList Bublbs")
|
||||
print("2)\tSet State")
|
||||
print("3)\tExit)")
|
||||
select = input("Select option: ")
|
||||
select = int(select)
|
||||
if 0 < select <= max_option:
|
||||
if select == 1:
|
||||
list_devices()
|
||||
elif select == 2:
|
||||
set_state()
|
||||
elif select == 3:
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
home = client.client(sys.argv[1], sys.argv[2])
|
||||
|
||||
main_input()
|
||||
|
||||
Reference in new issue
Block a user