-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlampControl.py
More file actions
44 lines (29 loc) · 1013 Bytes
/
lampControl.py
File metadata and controls
44 lines (29 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import time
"""
Requirements:
This program requirse the dotnet package.
Instructions for this can be found at https://dotnet.microsoft.com/download/linux-package-manager/ubuntu16-04/sdk-current
Once this is instaleld run: "npm i -g tplink-lightbulb" to get the lightbulb specfic data.
Details on the lightbulb command can be found at : https://www.npmjs.com/package/tplink-lightbulb
"""
def scan():
#scans for tplight bulbs
os.system("tplight scan")
#end scan
def lightOn(ip):
#accepts the ip address of the tplight and turns it on
os.system("tplight on " + ip)
#end lightOn
def lightOff(ip):
#accepts the ip of the tplight and turns it off
os.system("tplight off " + ip)
#end lightoff
def strobeLight(ip, strobeCT):
#accepts the ip of the tplight and number of repetitions and causes the light to perform a strobelight effect
i = 0
for i in range(strobeCT):
lightOn(ip)
time.sleep(2)
lightOff(ip)
#end strobeLight