Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def set_wifi_bulb(color=None):
- # get value from bash
- if color == "girl":
- color = "300 100 100"
- elif color == "boy":
- color = "200 100 100"
- else:
- color = "0 0 100" # white
- for line in os.popen("kasa discover | grep -i host").readlines():
- host = line.split(":")[1].strip()
- print(host)
- if not color:
- command = f"kasa --host {host} off"
- print(command)
- os.popen(command).readlines()
- else:
- command = f"kasa --host {host} hsv {color}"
- print(command)
- os.popen(command).readlines()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement