Advertisement
alseambusher

Untitled

Oct 1st, 2024
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. def set_wifi_bulb(color=None):
  2.     # get value from bash
  3.     if color == "girl":
  4.         color = "300 100 100"
  5.     elif color == "boy":
  6.         color = "200 100 100"
  7.     else:
  8.         color = "0 0 100" # white
  9.     for line in os.popen("kasa discover | grep -i host").readlines():
  10.         host = line.split(":")[1].strip()
  11.         print(host)
  12.         if not color:
  13.             command = f"kasa --host {host} off"
  14.             print(command)
  15.             os.popen(command).readlines()
  16.         else:
  17.             command = f"kasa --host {host} hsv {color}"
  18.             print(command)
  19.             os.popen(command).readlines()
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement