def get_blinds(debug=False):
	state = utils.service_call('get_blinds', get_blinds, [])
	if state:
		if debug:
			print("Blind names are %s" % state.blinds)
		return state.blinds
	return None
Beispiel #2
0
def cct(x, y, cct_val, intensity_val, debug=False):
    if debug:
        print("Changing light (%s,%s) to cct %s and intensity %s" %
              (x, y, cct_val, intensity_val))
    state = utils.service_call('cct', OctaLight_CCT,
                               [cct_val, intensity_val, x, y])
    if state and debug:
        print("Light (%s,%s) is now in state %s" % (x, y, state))
    return state
Beispiel #3
0
def cct_all(cct_val, intensity_val, debug=False):
    if debug:
        print("Changing all lights to cct %s and intensity %s" %
              (cct_val, intensity_val))
    state = utils.service_call('cct_all', OctaLight_CCTAll,
                               [cct_val, intensity_val])
    if state and debug:
        print("Lights are now in state %s" % (state))
    return state
def get_distances_all(debug=False):
	state = utils.service_call('get_distances_all', TOFGetDistancesAll, [])
	if state:
		dist = numpy.asarray(state.data)
		dist = numpy.reshape(dist, (len(state.data)/160, 160))
		dist = dist.tolist()
		if debug:
			print(dist)
		return dist
def get_distances(sensor, debug=False):
	state = utils.service_call('get_distances', TOFGetDistances, [sensor])
	if state:
		dist = numpy.asarray(state.data)
		dist = numpy.reshape(dist, (len(state.data)/20, 20))
		dist = dist.tolist()
		if debug:
			print(dist)
		return dist
Beispiel #6
0
def sources_all(b1, b2, b3, l, a, o, r1, r2, debug=False):
    if debug:
        print(
            "Changing all lights to blue1:%s%% blue2:%s%% blue3:%s%% lime:%s%% amber:%s%% orange:%s%% red1:%s%% red2:%s%%"
            % (b1, b2, b3, l, a, o, r1, r2))
    state = utils.service_call('sources_all', OctaLight_sourcesAll,
                               [b1, b2, b3, l, a, o, r1, r2])
    if state and debug:
        print("Lights are now in state %s" % (state))
    return state
Beispiel #7
0
def get_lights(debug=False):
    state = utils.service_call('get_lights', GetLights, [])
    if state:
        lights = []
        for i in range(0, len(state.lights), 2):
            lights.append((state.lights[i], state.lights[i + 1]))
        if debug:
            print("The available lights are %s" % lights)
        return lights
    return None
Beispiel #8
0
def sources(x, y, b1, b2, b3, l, a, o, r1, r2, debug=False):
    if debug:
        print(
            "Changing light (%s,%s) to blue1:%s%% blue2:%s%% blue3:%s%% lime:%s%% amber:%s%% orange:%s%% red1:%s%% red2:%s%%"
            % (x, y, b1, b2, b3, l, a, o, r1, r2))
    state = utils.service_call('sources', OctaLight_sources,
                               [b1, b2, b3, l, a, o, r1, r2, x, y])
    if state and debug:
        print("Light (%s,%s) is now in state %s" % (x, y, state))
    return state
def read_all(debug=False):
    state = utils.service_call('read_all', COSReadAll, [])
    if state:
        out = []
        for i in range(len(state.data)):
            if (i % state.step == 0):
                out.append([])
            out[-1].append(state.data[i])
        if debug:
            for i in range(len(state.data)):
                if (i % state.step == 0 and i > 1):
                    print()
                print(state.data[i], end=" ")
        return out
def lift(b, val, debug=False):
	state = utils.service_call('lift', BlindLift, [b, val])
	if state:
		if debug:
			print("Blind %s is now lifted to %s%%" % (b, state.lift))
		return state.lift
Beispiel #11
0
def set_temp(temp, debug=False):
    state = utils.service_call('set_temp', HVAC_SetTemp, [temp])
    if state and debug:
        print(state)
def tilt_all(val, debug=False):
	state = utils.service_call('tilt_all', BlindTiltAll, [val])
	if state:
		if debug:
			print("All blinds now tilted to %s%%" % (state.tilt))
		return state.tilt
def tilt(b, val, debug=False):
	state = utils.service_call('tilt', BlindTilt, [b, val])
	if state:
		if debug:
			print("Blind %s is now tilted to %s%%" % (b, state.tilt))
		return state.tilt
def lift_all(val, debug=False):
	state = utils.service_call('lift_all', BlindLiftAll, [val])
	if state:
		if debug:
			print("All blinds now lifted to %s%%" % (state.lift))
		return state.lift
Beispiel #15
0
def set_fansp(speed, debug=False):
    state = utils.service_call('set_fansp', HVAC_SetFanSp, [speed])
    if state and debug:
        print(state)
Beispiel #16
0
def get_temp(debug=False):
    state = utils.service_call('get_temp', HVAC_GetTemp, [])
    if state:
        if debug:
            print(state)
        return state.data
Beispiel #17
0
def set_ep(ep, val, debug=False):
    state = utils.service_call('set_ep', HVAC_SetEp, [ep, val])
    if state and debug:
        print(state)
def read(num, debug=False):
    state = utils.service_call('read', COSReadOne, [num])
    if state and debug:
        print(state)
    return state.data
Beispiel #19
0
def get_rh(debug=False):
    state = utils.service_call('get_rh', HVAC_GetRH, [])
    if state:
        if debug:
            print(state)
        return state.data
Beispiel #20
0
def get_co2(debug=False):
    state = utils.service_call('get_co2', HVAC_GetCO2, [])
    if state:
        if debug:
            print(state)
        return state.data
def inte_time(num, debug=True):
    state = utils.service_call('inte_time', COSInteTime, [num])
    if state and debug:
        print(state)
    return state
Beispiel #22
0
def get_sources(x, y, debug=False):
    state = utils.service_call('get_sources', GetSources, [x, y])
    if state and debug:
        print("The sources of Light (%s,%s) is %s" % (x, y, state.sources))
    return state.sources
Beispiel #23
0
def set_bms(debug=False):
    state = utils.service_call('set_bms', HVAC_SetBms, [])
    if state and debug:
        print(state)