Exemple #1
0
def main():
    platform = Platform()
    recipe = Recipe() 
    
    # Step 0: Preform hard reset to calibrate platform position during startup
    #platform.hard_Reset()   

    # Step 1: get recipe from user either from onboard gui or android app
    #sampleRecipe = sys.argv[1]
    sampleRecipe = "1,19.3,2,19.3,3,19.3,4,19.3,5,19.3,6,19.3,7,19.3,8,19.3,true" 

    # Step 2: split recipe string to a stack of seperate ingredients
    recipe.initilize_Stack(sampleRecipe)

    # Step 3: specify the order of the recipe
    if recipe.isOrdered == True:
        recipeOrder = recipe.recipeStack 
    else: 
        recipeOrder = platform.get_Shortest_Path(recipe)
    
    hbridge.turnOff()
    time.sleep(.3)
    # Step 4: interate over each ingredient then move platform
    for ingred in recipeOrder: 
        print "Getting %rmL of segment %r" %(ingred.mL, ingred.segNum)

        #segNum is NOT 0 indexed
        platform.move_To_Segment(platform.segList[ingred.segNum-1].name) 
        time.sleep(WAIT) 

        # Step 5: once platform reached its mark, pour amount
        
        hbridge.turnOn()
        time.sleep(.2)
        Actuator.actuate(Actuator.actDict[ingred.segNum-1], float(ingred.mL))
        hbridge.turnOff()
        time.sleep(WAIT) 



    # Step 6: repeat step 4 till stack is empty

    # Step 7: Move platform back to the middle
    print "Final offset: %r " % Platform.offset
    platform.reset()
def get_braille(text):
    global priority
    global def_priority
    global speed

    if (priority == 2):
        print("Decoding as per grade 2")
        braille = GD2.braille.process_word(text)
        if (braille == 1):
            priority = 1
    if (priority == 1):
        print("Decoding as per grade 1")
        braille = GD1.braille.encode_braille(text)
    print("Given word: " + text)
    print("Braille converted text: ")
    print_braille(braille)
    for i in braille:
        Actuator.actuate(i)
        sleep(speed)
        Actuator.set_all_low()
        sleep(0.4 * speed)
    print(" ")
    priority = def_priority
Exemple #3
0
    def __init__(self, stats):
        self._machtoadd = 1
        self._machtoaddBefore = 1  #set to 0 if Fibonacci sequence from the beggining
        self._reconfigure = True
        self._stats = stats
        self._actuator = Actuator.Actuator(self._stats)
        #current state of the system - initially is empty
        self._machine_type = {}
        self._current_config = {}

        #DECISION MAKER PARAMETERS
        self._CPU_IDLE_MIN = decisionmaker_config.cpu_idle_min
        self._CPU_IDLE_MAX = decisionmaker_config.cpu_idle_max
        self._IO_WAIT_MAX = decisionmaker_config.io_wait_max
        self._CRITICAL_PERC = decisionmaker_config.critialStatePercentage
        self._READ_WRITE_DISTANCE_MIN = decisionmaker_config.read_write_distance_min
        self._MIN_SCAN_RATIO = decisionmaker_config.min_scan_ratio

        logging.info('DecisionMaker started.')
Exemple #4
0
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import time
import Communication
from Communication import CommSimulator
from Communication import CommSerial
import Actuator
from compiler.ast import Print

#comm = CommSimulator()  #TODO read a configuration file to use the correct parameters for CommSimulator
comm_tty = CommSerial(
)  #TODO read a configuration file to use the correct parameters for CommSimulator
#comm.connect()
comm_tty.connect()
#actuator = Actuator.Actuator(comm)
actuator_tty = Actuator.Actuator(comm_tty)

motor_id = 6

print "actuator_tty.set_AngleLimit(motor_id, 0x0000, 0x0000)"
actuator_tty.set_AngleLimit(motor_id, 0x0000, 0x0000)
time.sleep(1)

print "actuator_tty.setTorque(motor_id, False)"
actuator_tty.setTorque(motor_id, False)
time.sleep(1)

print "actuator_tty.set_speed_actuator(motor_id, 0x200, 0x0)"
actuator_tty.set_speed_actuator(motor_id, 0x200, 0x0)
time.sleep(1)
# -*- coding: utf-8 -*-
import Braille_Dictionary_Grade_1 as GD1
import Braille_Dictionary_Grade_2 as GD2
import Actuator
import string
from time import sleep
import RPi.GPIO as GPIO

global priority
global def_priority
global speed

priority = 0
def_priority = 0
speed = 0.5
Actuator.init()


def ini():
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BOARD)

    GPIO.setup(31, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(32, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

    GPIO.setup(35, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(36, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

    grade_left_stat = GPIO.input(35)
    grade_right_stat = GPIO.input(36)
Exemple #6
0
    BackendPi = RaspPi()

    # Actuators as define in schematic tab at https://upverter.com/design/blazesandersinc/tapomatic-v2020-1
    immunityHealthAdditivePins  = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME, BackendPi.I2C_SCL1_NAME]
    #immunityHealthAdditivePins = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.BOARD7]
    vitaminHealthAdditivePins  = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME, BackendPi.I2C_SCL1_NAME]
    #vitaminsHealthAdditivePins = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.BOARD11]
    #TODO SWITCHED TO PUMPS actuatorList = [Actuator('S', IMMUNITY_ADDITIVE_SERVO, immunityHealthAdditivePins, "Immunity Boost Servo: Seamuing MG996R", Actuator.CW)]
	#actuatorList.append(Actuator('S', VITAMIN_ADDITIVE_SERVO, vitaminsHealthAdditivePins, "Daily Vitamins Servo: Seamuing MG996R", Actuator.CW))
    #powderActuatorList = actuatorList

    rumFlavorPins = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME, BackendPi.I2C_SCL1_NAME]
    pinaColadaFlavorPins = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME, BackendPi.I2C_SCL1_NAME]
    pineappleFlavorPins = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME, BackendPi.I2C_SCL1_NAME]
    orangeFlavorPins = [Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME, BackendPi.I2C_SCL1_NAME]
    fluidActuatorList =  [Actuator('R', RUM_PUMP, rumFlavorPins, "Rum Flavor Motor: Zjchao 202", Actuator.CW)]
    fluidActuatorList.append(Actuator('R', PINA_COLADA_FLAVOR_PUMP, pinaColadaFlavorPins, "Pina Colada Flavor Motor: Zjchao 202", Actuator.CW))
    fluidActuatorList.append(Actuator('R', PINEAPPLE_FLAVOR_PUMP, pineappleFlavorPins, "Orange Flavor Motor: Zjchao 202", Actuator.CW))
    fluidActuatorList.append(Actuator('R', ORANGE_FLAVOR_PUMP, orangeFlavorPins, "Orange Flavor Motor: Zjchao 202", Actuator.CW))
    fluidActuatorList.append(Actuator('R', IMMUNITY_ADDITIVE_PUMP, immunityHealthAdditivePins, "Immunity Boost Pump: Zjchao 202", Actuator.CW))
    fluidActuatorList.append(Actuator('R', VITMAN_ADDITIVE_PUMP, vitaminHealthAdditivePins, "Daily Vitamins Pump: Zjchao 202", Actuator.CW))

	# Add fluid actuators to the full system actuator list
    actuatorList.append(fluidActuatorList)

    liftMotor1Pins = [Actuator.HIGH_PWR_12V, Actuator.GND]
    liftMotor2Pins = [Actuator.HIGH_PWR_12V, Actuator.GND]
    liftingActuatorList = [Actuator('L', Z1_LINEAR_LIFT_MOTOR, liftMotor1Pins, "Lift Motor 1: PA-07-12-5V", Actuator.LINEAR_OUT)]
    liftingActuatorList.append(Actuator('L', Z2_LINEAR_LIFT_MOTOR, liftMotor2Pins, "Lift Motor 2: PA-07-12-5V", Actuator.LINEAR_OUT))

	# Add lifting actuators to the full system actuator list
Exemple #7
0
'''
Created on May 7, 2013

@author: matias
'''

import time
from Communication import CommSerial
import Actuator

comm_tty = CommSerial()
comm_tty.connect()
actuator = Actuator.Actuator(comm_tty)
motor_id = 99


actuator.reset(0xfe)
time.sleep(2)
actuator.setear_id(motor_id)



for i in range(1, 50):
    if (i%2 == 0):
        actuator.led_state_change(motor_id, 1)
    else:
        actuator.led_state_change(motor_id, 0)
    time.sleep(.1)
#
Exemple #8
0
def main():
	""" Run instances of encrypted LQG with Labeled Homomorphic Encryption."""

	flag = 0 # The Setup computes gives the gain matrices Gamma to the cloud if flag = 0, otherwise, the cloud and actuator compute their encryption
	verbose = 0 # Print values of variables if verbose = 1, does nothing otherwise

	# folder = 'building_1_room' 
	# folder = 'Random_instance_5_1'
	folder = 'building_2_rooms'
	# folder = 'Random_instance_25_5'
	# folder = 'Random_instance_50_10'
	# folder = 'Random_instance_75_15'
	# folder = 'Random_instance_100_20'
	# folder = 'Random_instance_125_25'

	lf = DEFAULT_PRECISION
	T = 100
	setup = Client.Client()
	usk_setup = setup.usk
	setup.Plant(T,folder)
	n = setup.n; m = setup.m; p = setup.p; d = setup.d
	A = setup.Af; B = setup.Bf; C = setup.Cf
	K = setup.Kf; L = setup.Lf
	W = setup.Wf; V = setup.Vf; F = setup.F

	client = Client.Client()
	usk_client = client.usk
	client.setPoints(folder,n,m,p,d,T,setup.A,setup.B,setup.C,setup.W,setup.V,setup.F)
	x0 = client.xf;	
	xr = client.xr; ur = client.ur
	xrf = client.xrf; urf = client.urf
	plaintext_x_series = np.zeros((n,T))

	act = Actuator.Actuator(usk_setup,usk_client)
	privkey = act.privkey
	msk = privkey.msk; upk = privkey.upk
	pubkey = act.pubkey

	client.getPubkey(pubkey)
	setup.getPubkey(pubkey)

	start = time.time()
	setup.genLabelsSetup(flag)
	time_off_setup = time.time() - start
	print('Offline time for setup: ', "%.5f" % (time_off_setup), ' sec')
	start = time.time()

	client.genLabels()
	time_off_clients = time.time() - start
	print('Offline time for clients: ', "%.5f" % (time_off_clients), ' sec')
	start = time.time()

	cloud = Cloud.Cloud(act.pubkey,n,m,p,T)
	cloud.generateRandomness()
	time_off_cloud = time.time() - start
	print('Offline time for cloud: ', "%.5f" % (time_off_cloud), ' sec')
	start = time.time()

	act.genLabels(n,m,p,T,flag)
	
	if flag == 1:
		act.genProgramSecrets()
	time_off_act = time.time() - start
	print('Offline time for actuator: ', "%.5f" % (time_off_act), ' sec')
	start = time.time()

	setup.encryptMatrices(flag)
	time_in_setup = time.time() - start
	print('Online time to compute constants for setup: ', "%.5f" % (time_in_setup), ' sec')

	start = time.time()
	client.encryptSetPoints()
	time_in_clients = time.time() - start
	print('Online time to compute constants for clients: ', "%.5f" % (time_in_clients), ' sec')

	if flag == 1:
		start = time.time()
		cloud.getCoeff(setup.enc_A,setup.enc_B,setup.enc_C,setup.enc_L,setup.enc_K,client.enc_xr,client.enc_ur)
		cloud.getProgramSecrets(act.enc_bLC,act.enc_bLA,act.enc_bCA,act.enc_bLB,act.enc_bCB)

		blinded_enc_Gamma3 = cloud.computeGamma3()
		# The actuator needs to refresh Gamma3
		start_act = time.time()			
		blinded_enc_Gamma3 = act.refresh_Gamma3(blinded_enc_Gamma3)
		time_in_act = time.time() - start_act
		cloud.getGamma3(blinded_enc_Gamma3)
		blinded_enc_Gamma, blinded_enc_Gamma2 = cloud.computeProducts()
		# The actuator needs to refresh Gamma, Gamma2, Gamma3
		start_act = time.time()	
		blinded_enc_Gamma, blinded_enc_Gamma2 = act.refresh_Gamma1_2(blinded_enc_Gamma, blinded_enc_Gamma2)
		time_in_act = time.time() - start_act + time_in_act
		print('Online time to compute constants for actuator: ', "%.5f" % (time_in_act), ' sec')
		cloud.getGamma1_2(blinded_enc_Gamma, blinded_enc_Gamma2)
		cloud.computeConstants()
		time_in_cloud = time.time() - start - time_in_act
		print('Online time to compute constants for cloud: ', "%.5f" % (time_in_cloud), ' sec')

	if flag == 0:
		Gamma = setup.Gamma; Gamma2 = setup.Gamma2; Gamma3 = setup.Gamma3
		enc_Gamma = setup.enc_Gamma; enc_Gamma2 = setup.enc_Gamma2; enc_Gamma3 = setup.enc_Gamma3
	else:
		Gamma = np.dot(np.eye(n, dtype = object) - np.dot(setup.L,setup.C),setup.A + np.dot(setup.B,setup.K))
		Gamma2 = np.dot(np.eye(n, dtype = object) - np.dot(setup.L,setup.C),np.dot(setup.B,setup.K))
		Gamma3 = np.dot(np.eye(n, dtype = object) - np.dot(setup.L,setup.C),setup.B)
		enc_Gamma = util_fpv.von_enc(pubkey,util_fpv.vfp(Gamma),act.bGamma,act.enc_bGamma)
		enc_Gamma2 = util_fpv.von_enc(pubkey,util_fpv.vfp(Gamma2),act.bGamma2,act.enc_bGamma2)
		enc_Gamma3 = util_fpv.von_enc(pubkey,util_fpv.vfp(Gamma3),act.bGamma3,act.enc_bGamma3)

	Gref = np.dot(Gamma3, client.ur) - np.dot(Gamma2, client.xr)
	Gref_2 = 2**lf*Gref
	uref = ur - np.dot(setup.K, client.xr)
	uref_2 = np.dot(uref,2**lf*np.eye(m,dtype = object))

	cloud.enc_Gamma = enc_Gamma
	cloud.enc_Gamma2 = enc_Gamma2
	cloud.enc_Gamma3 = enc_Gamma3

	if flag == 0:
		time_in_act = 0
		start = time.time()
		cloud.getCoeff(setup.enc_A,setup.enc_B,setup.enc_C,setup.enc_L,setup.enc_K,client.enc_xr,client.enc_ur)
		cloud.computeConstants()
		time_in_cloud = time.time() - start
		print('Online time to compute constants for cloud: ', "%.5f" % (time_in_cloud), ' sec')

	if verbose == 1:
		hat_x = np.zeros((n,T+1))
		enc_x0 = util_fpv.von_enc(pubkey,x0,act.bx[:,0],util_fpv.vencrypt(pubkey.Pai_key,act.bx[:,0]))
		print('x0: ',util_fpv.vretrieve_fp(util_fpv.von_dec(privkey,enc_x0,
				util_fpv.vencrypt(pubkey.Pai_key,act.bx[:,0]))))

	start = time.time()

	k = 0
	cloud.xk = client.enc_x0
	enc_u0 = cloud.computeInput()
	u0 = act.getInput(enc_u0,k)
	if verbose == 1:
		plaintext_xk = client.x
		plaintext_x_series[:,k] = plaintext_xk
		hat_x[:,k] = util_fpv.vretrieve_fp(util_fpv.von_dec(privkey,cloud.xk,act.bx[:,k]))
		print('decrypted x%d: '%k, ["%.5f"% i for i in hat_x[:,k]])
		print('decrypted u%d: '%k, ["%.5f"% i for i in u0])
		print('u0: ', ["%.5f"% i for i in np.dot(setup.K,client.x) + uref])

	# Get next state and measurement
	client.closedLoop(u0,k+1)
	enc_zk = client.getMeasurement(k) # The measurement time is k+1 but the labels are generated for k
	if verbose == 1:
		plaintext_zk = client.z
		print('z1: ', ["%.5f"% i for i in plaintext_zk])
		print('decrypted z%d: '%(k+1), ["%.5f"% i for i in util_fpv.vretrieve_fp(util_fpv.von_dec(privkey,enc_zk))])

		print('Online time for iteration %d: '%k, "%.5f" % (time.time() - start), ' sec')

	time_act = np.zeros((T-1,1))
	time_cloud = np.zeros((T-1,1))
	time_client = np.zeros((T-1,1))

	# Start the control loop
	for k in range(1,T):
		start_it = time.time()
		blinded_xk = cloud.computeEstimate(cloud.xk,enc_zk)
		start_act = time.time()	
		enc_xk2 = act.refresh_xk(blinded_xk,k)
		end_act = time.time()-start_act
		cloud.getEstimate(enc_xk2)		# get xk

		if verbose == 1:
			hat_x[:,k] = util_fpv.vretrieve_fp(util_fpv.von_dec(privkey,cloud.xk,act.bx[:,k]))
			print('decrypted x%d: '%k, ["%.5f"% i for i in hat_x[:,k]])
			plaintext_xk = np.dot(Gamma,plaintext_xk)+np.dot(setup.L,plaintext_zk)+Gref
			plaintext_x_series[:,k] = plaintext_xk
			print('x%d: '%k, ["%.5f"% i for i in plaintext_xk])

		enc_uk = cloud.computeInput()

		start_act = time.time()
		uk = act.getInput(enc_uk,k)			# get uk
		time_act[k-1] = end_act + time.time() - start_act
		if verbose == 1:
			print('decrypted u%d: '%k, uk)
			print('u%d: '%k, ["%.5f"% i for i in np.dot(setup.K,plaintext_xk)+uref])

		client.closedLoop(uk,k+1)

		start_cl = time.time()
		enc_zk = client.getMeasurement(k)	# get zk+1
		time_client[k-1] = time.time() - start_cl
		if verbose == 1:
			plaintext_zk = client.z
			plaintext_zk = util_fpv.vretrieve_fp(util_fpv.von_dec(privkey,enc_zk,
					util_fpv.vencrypt(pubkey.Pai_key,act.bz[:,k])))
			print('z%d: '%(k+1), ["%.5f"% i for i in plaintext_zk])

		time_cloud[k-1] = time.time() - start_it - time_act[k-1] - time_client[k-1]

	print('Total online time for %d iterations: '%T, "%.5f" % (time.time() - start), ' sec')

	print('Mean online time for client for one iteration: ', " %.5f" % np.mean(time_client), ' sec')
	print('Mean online time for actuator for one iteration: ', " %.5f" % np.mean(time_act), ' sec')
	print('Mean online time for cloud for one iteration: ', " %.5f" % np.mean(time_cloud), ' sec')

	# print("%.5f, %.5f MB" % (memory_usage_resource(),memory_usage_psutil()))

	with open(os.path.abspath('results_'+str(DEFAULT_KEYSIZE)+'_'+str(DEFAULT_PRECISION)+'.txt'),'a+') as f: 
		f.write("%d, %d, %d, flag %d\n " % (n,m,T,flag));
		f.write("Offline time:\n setup: %.5f, client: %.5f, cloud: %.5f, actuator %.5f\n" % (time_off_setup, time_off_clients, time_off_cloud, time_off_act))
		f.write("Initialization time:\n setup: %.5f, client: %.5f, cloud: %.5f, actuator %.5f\n" % (time_in_setup, time_in_clients, time_in_cloud, time_in_act))
		f.write("Online time 1 iter:\n client: %.5f, cloud: %.5f, actuator %.5f\n" % (np.mean(time_client), np.mean(time_act), np.mean(time_cloud)))


	if folder == 'building_2_rooms' and verbose == 1:
		# evenly sampled time at 440s intervals
		Ts = 420
		t = Ts*np.arange(0., T)

		fig, ax = plt.subplots(figsize=(16,8))

		for i in range(int(n/2)):
			ax.plot(t, hat_x[i,:-1], 'C'+str(i), linewidth=2)
			ax.plot(t, hat_x[int(n/2)+i,:-1], 'C'+str(int(n/2)+i)+'--', linewidth=2)
			# ax.plot(t, plaintext_x_series[i,:],'C'+str(i)+'--',linewidth=2)

		ax.set(xlabel='Time (s)', ylabel='State x',
		       title='Evolution of the estimates')
		ax.grid()
		plt.legend(('$\hat x_1$', '$\hat x_6$', '$\hat x_2$', '$\hat x_7$', '$\hat x_3$', '$\hat x_8$',
			'$\hat x_4$', '$\hat x_9$', '$\hat x_5$', '$\hat x_{10}$'),
		           loc='lower right', shadow=True)
		fig.savefig("Figures/estimates.png")
		fig.show()

		fig2, ax = plt.subplots(figsize=(16,8))

		t = Ts*np.arange(0., T)
		for i in range(int(n/2)):
			ax.plot(t, client.x_series[i,:-1], 'C'+str(i), linewidth=2)
			ax.plot(t, client.x_series[int(n/2)+i,:-1], 'C'+str(int(n/2)+i)+'--', linewidth=2)
			# ax.plot(t, plaintext_x_series[i,:],'C'+str(i)+'--',linewidth=2)

		ax.set(xlabel='Time (s)', ylabel='State x',
		       title='Evolution of the true states')
		ax.grid()
		plt.legend(('$x_1$', '$x_6$', '$x_2$', '$x_7$', '$x_3$', '$x_8$',
			'$x_4$', '$x_9$', '$x_5$', '$x_{10}$'),
		           loc='lower right', shadow=True)
		fig.savefig("Figures/states.png")
		plt.show()
Exemple #9
0
    #TODO tempDrink = CocoDrink2(CocoDrink2.NONE, CocoDrink2.NONE, CocoDrink2.NONE, CocoDrink2.NONE, CocoDrink2.NONE, CocoDrink2.NONE, CocoDrink2.NONE, CocoDrink2.NONE)
    #TODO tempDrink = CocoDrink(CocoDrink.NONE, CocoDrink.NONE, CocoDrink.NONE, CocoDrink.NONE, CocoDrink.NONE, CocoDrink.NONE, CocoDrink.NONE, CocoDrink.NONE)
    vendQueue = np.array(MAX_VEND_QUEUE_SIZE)

    GuiPi = RaspPi()
    BackendPi = RaspPi()

    # Actuators as define in schematic tab at https://upverter.com/design/blazesandersinc/tapomatic-v2020-1
    immunityHealthAdditivePins = [
        Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.BOARD7
    ]
    vitaminsHealthAdditivePins = [
        Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.BOARD11
    ]
    actuatorList = [
        Actuator('S', IMMUNITY_ADDITIVE_SERVO, immunityHealthAdditivePins,
                 "Immunity Boost Servo: Seamuing MG996R", Actuator.CW)
    ]
    actuatorList.append(
        Actuator('S', VITAMIN_ADDITIVE_SERVO, vitaminsHealthAdditivePins,
                 "Daily Vitamins Servo: Seamuing MG996R", Actuator.CW))
    powderActuatorList = actuatorList

    rumFlavorPins = [
        Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME,
        BackendPi.I2C_SCL1_NAME
    ]
    pinaColadaFlavorPins = [
        Actuator.HIGH_PWR_12V, Actuator.GND, BackendPi.I2C_SDA1_NAME,
        BackendPi.I2C_SCL1_NAME
    ]
    pineappleFlavorPins = [
Exemple #10
0
def OrderedAliases(category=None):
    return Actuator.OrderedAliases(category)
Exemple #11
0
def ActuatorCategories():
    return Actuator.ActuatorCategories()
Exemple #12
0
def ToggleActuator(name):
    actuator = Actuator.Find(name)
    if actuator:
        actuator.SetState(not actuator.State())
Exemple #13
0
def NextOrder():
    return Actuator.NextOrder()
Exemple #14
0
def FindActuator(name):
    return Actuator.Find(name)
Exemple #15
0
def DeleteActuator(actuator_name):
    actuator = Actuator.Find(actuator_name)
    if actuator:
        Actuator.Delete(actuator)
Exemple #16
0
    return ControllerType.GetTypes()


def GetControllerNames():
    return Controller.GetNames()


def ActuatorCategories():
    return Actuator.ActuatorCategories()


def ControllerCategories():
    return Controller.ControllerCategories()


if __name__ == '__main__':
    AutomationConfig.Read()
    print "===== Controller Types ====="
    ControllerType.Dump()
    print "===== Controllers ====="
    Controller.DumpControllers()
    print "===== Actuators ====="
    Actuator.DumpActuators()
    if False:
        print "=== Config ==="
        config = AutomationConfig.Config()
        for section in config.sections():
            print '[', section, ']'
            for item in config.items(section):
                print '  ', item[0], '=', item[1]