Skip to content

Commit

Permalink
Use vendor namespacing for each consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Oct 2, 2022
1 parent b1a0567 commit af92b07
Show file tree
Hide file tree
Showing 119 changed files with 422 additions and 170 deletions.
28 changes: 14 additions & 14 deletions chroma_feedback/consumer/__init__.py
Expand Up @@ -2,18 +2,18 @@

__all__ =\
[
'agile_innovative_blinkstick',
'compulab_fit_statusb',
'elgato_streamdeck',
'embrava_blynclight',
'kuando_busylight',
'lifx_light',
'luxafor_flag',
'magic_hue',
'nanoleaf_light',
'philips_hue',
'razer_chroma',
'thingm_blink1',
'wiz_light',
'xiaomi_yeelight'
'agile_innovative.blinkstick',
'compulab_fit.statusb',
'elgato.streamdeck',
'embrava.blynclight',
'kuando.busylight',
'lifx.lifx',
'luxafor.flag',
'magic.hue',
'nanoleaf.nanoleaf',
'philips.hue',
'razer.chroma',
'signify.wiz',
'thingm.blink1',
'xiaomi.yeelight'
]
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
try:
api.first_light().acquire()
except (NoLightsFound, LightUnavailable):
logger.error(wording.get('connection_not_found').format('agile_innovative_blinkstick') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('agile_innovative.blinkstick') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'agile_innovative_blinkstick',
'name': 'agile_innovative.blinkstick',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.info['serial_number']),
'status': status
Expand Down
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
try:
api.first_light().acquire()
except (NoLightsFound, LightUnavailable):
logger.error(wording.get('connection_not_found').format('compulab_fit_statusb') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('compulab_fit.statusb') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'compulab_fit_statusb',
'name': 'compulab_fit.statusb',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.info['serial_number']),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
api = DeviceManager()
api.enumerate()
except ProbeError:
logger.error(wording.get('connection_not_found').format('elgato_streamdeck') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('elgato.streamdeck') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -40,7 +40,7 @@ def process_devices(devices : Any, producer_report : List[ProducerReport]) -> Li
if set_device(device, producer_report):
result.append(
{
'name': 'elgato_streamdeck',
'name': 'elgato.streamdeck',
'type': 'device',
'description': helper.create_description(device.deck_type(), device.id()),
'status': status
Expand Down
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
try:
api.first_light().acquire()
except (NoLightsFound, LightUnavailable):
logger.error(wording.get('connection_not_found').format('embrava_blynclight') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('embrava.blynclight') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'embrava_blynclight',
'name': 'embrava.blynclight',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.path),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
try:
api.first_light().acquire()
except (NoLightsFound, LightUnavailable):
logger.error(wording.get('connection_not_found').format('kuando_busylight') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('kuando.busylight') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'kuando_busylight',
'name': 'kuando.busylight',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.path),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -21,7 +21,7 @@ def api_factory() -> Any:
try:
api = LifxLAN()
except WorkflowException:
logger.error(wording.get('connection_not_found').format('lifx_light') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('lifx.lifx') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -18,14 +18,14 @@ def init(program : ArgumentParser) -> None:
global ARGS

if not ARGS:
program.add_argument('--lifx-light-group-name', action = 'append')
program.add_argument('--lifx-light-light-ip', action = 'append')
program.add_argument('--lifx-group-name', action = 'append')
program.add_argument('--lifx-light-ip', action = 'append')
ARGS = helper.get_first(program.parse_known_args())


def run(producer_report : List[ProducerReport]) -> List[Consumer]:
if ARGS.lifx_light_group_name:
groups = get_groups(ARGS.lifx_light_group_name)
groups = get_groups(ARGS.lifx_group_name)

if not groups:
logger.error(wording.get('group_not_found') + wording.get('exclamation_mark'))
Expand All @@ -34,7 +34,7 @@ def run(producer_report : List[ProducerReport]) -> List[Consumer]:

# fallback as needed

lights = filter_lights(get_lights(), ARGS.lifx_light_light_ip)
lights = filter_lights(get_lights(), ARGS.lifx_light_ip)

if not lights:
logger.error(wording.get('light_not_found') + wording.get('exclamation_mark'))
Expand Down
Expand Up @@ -35,7 +35,7 @@ def process_groups(groups : Any, producer_report : List[ProducerReport]) -> List
set_group(group, color.get_by_status(status))
result.append(
{
'name': 'lifx_light',
'name': 'lifx.lifx',
'type': 'group',
'description': get_group_name(group),
'status': status
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
set_light(light, color.get_by_status(status))
result.append(
{
'name': 'lifx_light',
'name': 'lifx.lifx',
'type': 'light',
'description': helper.create_description(light.get_label(), light.get_ip_addr()),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
try:
api.first_light().acquire()
except (LightUnavailable, LightNotFound):
logger.error(wording.get('connection_not_found').format('luxafor_flag') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('luxafor.flag') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'luxafor_flag',
'name': 'luxafor.flag',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.path),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -21,7 +21,7 @@ def api_factory(light_ip : str) -> Any:
try:
api = Light(light_ip)
except OSError:
logger.error(wording.get('connection_not_found').format('magic_hue') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('magic.hue') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
File renamed without changes.
Expand Up @@ -26,7 +26,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
set_light(light, color.get_by_status(status))
result.append(
{
'name': 'magic_hue',
'name': 'magic.hue',
'type': 'light',
'description': light.name,
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -21,10 +21,10 @@ def api_factory(light_ip : str) -> Any:
try:
api = Nanoleaf(light_ip)
except NanoleafConnectionError:
logger.error(wording.get('connection_not_found').format('nanoleaf_light') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('nanoleaf.nanoleaf') + wording.get('exclamation_mark'))
sys.exit()
except NanoleafRegistrationError:
logger.error(wording.get('press_button').format('pairing', 'nanoleaf_light') + wording.get('exclamation_mark'))
logger.error(wording.get('press_button').format('pairing', 'nanoleaf.nanoleaf') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -19,17 +19,17 @@ def init(program : ArgumentParser) -> None:
if not ARGS:
light_ips = None

if not helper.has_argument('--nanoleaf-light-light-ip'):
if not helper.has_argument('--nanoleaf-light-ip'):
light_ips = discover_light_ips()
if light_ips:
program.add_argument('--nanoleaf-light-light-ip', default = light_ips)
program.add_argument('--nanoleaf-light-ip', default = light_ips)
else:
program.add_argument('--nanoleaf-light-light-ip', action = 'append', required = True)
program.add_argument('--nanoleaf-light-ip', action = 'append', required = True)
ARGS = helper.get_first(program.parse_known_args())


def run(producer_report : List[ProducerReport]) -> List[Consumer]:
lights = get_lights(ARGS.nanoleaf_light_light_ip)
lights = get_lights(ARGS.nanoleaf_light_ip)

if not lights:
logger.error(wording.get('light_not_found') + wording.get('exclamation_mark'))
Expand Down
Expand Up @@ -26,7 +26,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'nanoleaf_light',
'name': 'nanoleaf.nanaleaf',
'type': 'light',
'description': helper.create_description(light.get_name(), light.ip),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -21,10 +21,10 @@ def api_factory(bridge_ip : str) -> Any:
try:
api = Bridge(bridge_ip)
except (PhueRequestTimeout, OSError, ValueError):
logger.error(wording.get('connection_not_found').format('philips_hue') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('philips.hue') + wording.get('exclamation_mark'))
sys.exit()
except PhueRegistrationException:
logger.error(wording.get('press_button').format('pairing', 'philips_hue') + wording.get('exclamation_mark'))
logger.error(wording.get('press_button').format('pairing', 'philips.hue') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_groups(groups : Any, producer_report : List[ProducerReport]) -> List
set_group(groups[index]['name'], color.get_by_status(status))
result.append(
{
'name': 'philips_hue',
'name': 'philips.hue',
'type': 'group',
'description': groups[index]['name'],
'status': status
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
set_light(light.name, color.get_by_status(status))
result.append(
{
'name': 'philips_hue',
'name': 'philips.hue',
'type': 'light',
'description': helper.create_description(light.name, light._get('uniqueid')),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -21,7 +21,7 @@ def api_factory() -> Any:
try:
api = DeviceManager()
except DaemonNotFound:
logger.error(wording.get('daemon_not_found').format('razer_chroma') + wording.get('exclamation_mark'))
logger.error(wording.get('daemon_not_found').format('razer.chroma') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_devices(devices : Any, producer_report : List[ProducerReport]) -> Li
if set_device(device, color.get_by_status(status)):
result.append(
{
'name': 'razer_chroma',
'name': 'razer.chroma',
'type': 'device',
'description': helper.create_description(device.name, device.serial),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -22,7 +22,7 @@ def api_factory(light_ip : str) -> Any:
try:
api = wizlight(light_ip)
except (WizLightConnectionError, WizLightTimeOutError):
logger.error(wording.get('connection_not_found').format('wiz_light') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('signify.wiz') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -19,17 +19,17 @@ def init(program : ArgumentParser) -> None:
if not ARGS:
light_ips = None

if not helper.has_argument('--wiz-light-light-ip'):
if not helper.has_argument('--signify-signify-wiz-ip'):
light_ips = discover_light_ips()
if light_ips:
program.add_argument('--wiz-light-light-ip', default = light_ips)
program.add_argument('--signify-wiz-light-ip', default = light_ips)
else:
program.add_argument('--wiz-light-light-ip', action = 'append', required = True)
program.add_argument('--signify-wiz-light-ip', action = 'append', required = True)
ARGS = helper.get_first(program.parse_known_args())


def run(producer_report : List[ProducerReport]) -> List[Consumer]:
lights = get_lights(ARGS.wiz_light_light_ip)
lights = get_lights(ARGS.signify_wiz_light_ip)

if not lights:
logger.error(wording.get('light_not_found') + wording.get('exclamation_mark'))
Expand Down
Expand Up @@ -26,7 +26,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
set_light(light, color.get_by_status(status))
result.append(
{
'name': 'wiz_light',
'name': 'signify.wiz',
'type': 'light',
'description': helper.create_description(get_light_name(light), light.ip),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -22,7 +22,7 @@ def api_factory() -> Any:
try:
api.first_light().acquire()
except (NoLightsFound, LightUnavailable):
logger.error(wording.get('connection_not_found').format('thingm_blink1') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('thingm.blink1') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -34,7 +34,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'thingm_blink1',
'name': 'thingm.blink1',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.info['serial_number']),
'status': status
Expand Down
File renamed without changes.
Expand Up @@ -21,12 +21,12 @@ def api_factory(light_ip : str) -> Any:
try:
api = Bulb(light_ip)
except BulbException:
logger.error(wording.get('connection_not_found').format('xiaomi_yeelight') + wording.get('exclamation_mark'))
logger.error(wording.get('connection_not_found').format('xiaomi.yeelight') + wording.get('exclamation_mark'))
sys.exit()
try:
api.turn_on()
except BulbException:
logger.error(wording.get('enable_feature').format('lan control', 'xiaomi_yeelight') + wording.get('exclamation_mark'))
logger.error(wording.get('enable_feature').format('lan control', 'xiaomi.yeelight') + wording.get('exclamation_mark'))
sys.exit()
return api
except ImportError:
Expand Down
Expand Up @@ -26,7 +26,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
if set_light(light, color.get_by_status(status)):
result.append(
{
'name': 'xiaomi_yeelight',
'name': 'xiaomi.yeelight',
'type': 'light',
'description': helper.create_description(light.get_properties()['name'], light._ip),
'status': status
Expand Down

0 comments on commit af92b07

Please sign in to comment.