Exemple #1
0
def process_lights(lights: Any, status: str) -> List[Dict[str, Any]]:
    result = []

    # process lights

    for light in lights:
        if status == 'passed':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'light',
                'name':
                light.name,
                'active':
                static_light(light.name, color.get_passed()),
                'status':
                status
            })
        if status == 'process':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'light',
                'name':
                light.name,
                'active':
                static_light(light.name, color.get_process()),
                'status':
                status
            })
        if status == 'errored':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'light',
                'name':
                light.name,
                'active':
                pulsate_light(light.name, color.get_errored()),
                'status':
                status
            })
        if status == 'failed':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'light',
                'name':
                light.name,
                'active':
                pulsate_light(light.name, color.get_failed()),
                'status':
                status
            })
    return result
def test_get_process() -> None:
    state = color.get_process()

    assert 'rgb' in state
    assert 'hue' in state
    assert 'saturation' in state
    assert 'brightness' in state
    assert 'kelvin' in state
def process_devices(devices: Any, status: str) -> List[Dict[str, Any]]:
    result = []

    # process devices

    for device in devices:
        if status == 'passed':
            result.append({
                'consumer': 'razer_chroma',
                'type': 'device',
                'name': device.name,
                'active': static_device(device, color.get_passed()),
                'status': status
            })
        if status == 'process':
            result.append({
                'consumer': 'razer_chroma',
                'type': 'device',
                'name': device.name,
                'active': static_device(device, color.get_process()),
                'status': status
            })
        if status == 'errored':
            result.append({
                'consumer':
                'razer_chroma',
                'type':
                'device',
                'name':
                device.name,
                'active':
                pulsate_device(device, color.get_errored())
                or breath_device(device, color.get_errored()),
                'status':
                status
            })
        if status == 'failed':
            result.append({
                'consumer':
                'razer_chroma',
                'type':
                'device',
                'name':
                device.name,
                'active':
                pulsate_device(device, color.get_failed())
                or breath_device(device, color.get_failed()),
                'status':
                status
            })
    return result
Exemple #4
0
def process_lights(status, lights):
	result = []

	# process lights

	for light in lights:
		light_name = light.get_label()

		if status == 'passed':
			result.append(
			{
				'consumer': 'lifx_light',
				'type': 'light',
				'name': light_name,
				'active': static_light(light, color.get_passed()),
				'status': status
			})
		if status == 'process':
			result.append(
			{
				'consumer': 'lifx_light',
				'type': 'light',
				'name': light_name,
				'active': static_light(light, color.get_process()),
				'status': status
			})
		if status == 'errored':
			result.append(
			{
				'consumer': 'lifx_light',
				'type': 'light',
				'name': light_name,
				'active': static_light(light, color.get_errored()),
				'status': status
			})
		if status == 'failed':
			result.append(
			{
				'consumer': 'lifx_light',
				'type': 'light',
				'name': light_name,
				'active': static_light(light, color.get_failed()),
				'status': status
			})
	return result
Exemple #5
0
def process_devices(status, devices):
	result = []

	# process devices

	for device in devices:
		if status == 'passed':
			result.append(
			{
				'consumer': 'razer_chroma',
				'type': 'device',
				'name': device.name,
				'active': static_device(device, color.get_passed()),
				'status': status
			})
		if status == 'process':
			result.append(
			{
				'consumer': 'razer_chroma',
				'type': 'device',
				'name': device.name,
				'active': static_device(device, color.get_process()),
				'status': status
			})
		if status == 'errored':
			result.append(
			{
				'consumer': 'razer_chroma',
				'type': 'device',
				'name': device.name,
				'active': pulsate_device(device, color.get_errored()),
				'status': status
			})
		if status == 'failed':
			result.append(
			{
				'consumer': 'razer_chroma',
				'type': 'device',
				'name': device.name,
				'active': pulsate_device(device, color.get_failed()),
				'status': status
			})
	return result
Exemple #6
0
def process_devices(devices : Any, status : str) -> List[Dict[str, Any]]:
	result = []

	# process devices

	for device in devices:
		if status == 'passed':
			result.append(
			{
				'consumer': 'thingm_blink',
				'type': 'device',
				'name': device,
				'active': static_device(color.get_passed()),
				'status': status
			})
		if status == 'process':
			result.append(
			{
				'consumer': 'thingm_blink',
				'type': 'device',
				'name': device,
				'active': static_device(color.get_process()),
				'status': status
			})
		if status == 'errored':
			result.append(
			{
				'consumer': 'thingm_blink',
				'type': 'device',
				'name': device,
				'active': static_device(color.get_errored()),
				'status': status
			})
		if status == 'failed':
			result.append(
			{
				'consumer': 'thingm_blink',
				'type': 'device',
				'name': device,
				'active': static_device(color.get_failed()),
				'status': status
			})
	return result
Exemple #7
0
def process_lights(lights: Any, status: str) -> List[Dict[str, Any]]:
    result = []

    # process lights

    for light in lights:
        light_name = light.get_properties()['name']

        if status == 'passed':
            result.append({
                'consumer': 'xiaomi_yeelight',
                'type': 'light',
                'name': light_name,
                'active': static_light(light, color.get_passed()),
                'status': status
            })
        if status == 'process':
            result.append({
                'consumer': 'xiaomi_yeelight',
                'type': 'light',
                'name': light_name,
                'active': static_light(light, color.get_process()),
                'status': status
            })
        if status == 'errored':
            result.append({
                'consumer': 'xiaomi_yeelight',
                'type': 'light',
                'name': light_name,
                'active': static_light(light, color.get_errored()),
                'status': status
            })
        if status == 'failed':
            result.append({
                'consumer': 'xiaomi_yeelight',
                'type': 'light',
                'name': light_name,
                'active': static_light(light, color.get_failed()),
                'status': status
            })
    return result
Exemple #8
0
def process_groups(status, groups):
    result = []

    # process groups

    for group in groups:
        group_name = get_group_name(group)

        if status == 'passed':
            result.append({
                'consumer': 'lifx_light',
                'type': 'group',
                'name': group_name,
                'active': static_group(group, color.get_passed()),
                'status': status
            })
        if status == 'process':
            result.append({
                'consumer': 'lifx_light',
                'type': 'group',
                'name': group_name,
                'active': static_group(group, color.get_process()),
                'status': status
            })
        if status == 'errored':
            result.append({
                'consumer': 'lifx_light',
                'type': 'group',
                'name': group_name,
                'active': static_group(group, color.get_errored()),
                'status': status
            })
        if status == 'failed':
            result.append({
                'consumer': 'lifx_light',
                'type': 'group',
                'name': group_name,
                'active': static_group(group, color.get_failed()),
                'status': status
            })
    return result
Exemple #9
0
def process_groups(groups: Any, status: str) -> List[Dict[str, Any]]:
    result = []

    # process groups

    for group in groups:
        group_name = groups[group]['name']

        if status == 'passed':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'group',
                'name':
                group_name,
                'active':
                static_group(group_name, color.get_passed()),
                'status':
                status
            })
        if status == 'process':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'group',
                'name':
                group_name,
                'active':
                static_group(group_name, color.get_process()),
                'status':
                status
            })
        if status == 'errored':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'group',
                'name':
                group_name,
                'active':
                pulsate_group(group_name, color.get_errored()),
                'status':
                status
            })
        if status == 'failed':
            result.append({
                'consumer':
                'philips_hue',
                'type':
                'group',
                'name':
                group_name,
                'active':
                pulsate_group(group_name, color.get_failed()),
                'status':
                status
            })
    return result