Esempio n. 1
0
def setup(mylist):
    R = int(mylist[1])
    A = int(mylist[2])
    E = int(mylist[3])
    IOT.connect()

    for x in range(0, R):
        dtype = "RaspberryPi" + str(x)
        print("complete device name: " + dtype)
        devlist = IOT.createDevice(dtype, "lightSensor", True)
        with open('devicess.txt', 'a') as file_:
            file_.write(devlist[1] + " " + devlist[0] + '\n')

    for x in range(0, A):
        dtype = "Arduino" + str(x)
        devlist = IOT.createDevice(dtype, "lightSensor", True)
        with open('devicess.txt', 'a') as file_:
            file_.write(devlist[1] + " " + devlist[0] + '\n')

    for x in range(0, E):
        dtype = "IntelDevice" + str(x)
        devlist = IOT.createDevice(dtype, "lightSensor", True)
        with open('devicess.txt', 'a') as file_:
            file_.write(devlist[1] + " " + devlist[0] + '\n')
        IOT.deleteDevice()
def setup(mylist):
    R=int(mylist[1])
    A=int(mylist[2])
    E=int(mylist[3])
    IOT.connect()
    
    for x in range(0, R):
        dtype = "RaspberryPi" + str(x)
        print("complete device name: "+dtype)
        devlist=IOT.createDevice(dtype, "lightSensor", True)
        with open('devicess.txt', 'a') as file_:
            file_.write(devlist[1] + " "+devlist [0] + '\n')

    for x in range(0, A):
        dtype = "Arduino" +str(x)
        devlist=IOT.createDevice(dtype, "lightSensor", True)
        with open('devicess.txt', 'a') as file_:
            file_.write(devlist[1] + " "+devlist [0] + '\n')

    for x in range(0, E):
        dtype = "IntelDevice"+str(x)
        devlist=IOT.createDevice(dtype, "lightSensor", True)
        with open('devicess.txt', 'a') as file_:
            file_.write(devlist[1] + " "+devlist [0] + '\n')
        IOT.deleteDevice()
Esempio n. 3
0


IOT.ClientId = "teamoopsindiahacks"
IOT.ClientKey ="5zgkgpfpxee"

#old setting working
#IOT.ClientId = "indiahack_oops"
#IOT.ClientKey ="1tbxrq5itbs"
IOT.connect()


# delete the output file devicess.txt

results=[]
with open('devicess.txt') as inputfile:
    results = list(csv.reader(inputfile))
    str1 =  ""
    print "inside file read"
    for line in results:
        print "inside lines... "
        str1 = ''.join(line)
        a = str1.split('\t')
        name= a[0]
        idd = 0
        IOT.DeviceId = str(a[1])
        print "This id deviceid:" + '\n'
        print IOT.DeviceId
       
        IOT.deleteDevice()