Skip to content

Commit

Permalink
Switch to serial based filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Oct 1, 2022
1 parent a02d81d commit fa70e23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions chroma_feedback/consumer/compulab_fit_statusb/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ def init(program : ArgumentParser) -> None:
global ARGS

if not ARGS:
program.add_argument('--compulab-fit-statusb-light-id', action = 'append')
program.add_argument('--compulab-fit-statusb-light-serial', action = 'append')
ARGS = helper.get_first(program.parse_known_args())


def run(producer_report : List[ProducerReport]) -> List[Consumer]:
light = filter_lights(get_lights(), ARGS.compulab_fit_statusb_light_id)
light = filter_lights(get_lights(), ARGS.compulab_fit_statusb_light_serial)

if not light:
logger.error(wording.get('device_not_found') + wording.get('exclamation_mark'))
Expand Down
8 changes: 4 additions & 4 deletions chroma_feedback/consumer/compulab_fit_statusb/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def get_lights() -> Any:
return LIGHTS


def filter_lights(lights : Any, light_ids : List[str]) -> Any:
if light_ids:
def filter_lights(lights : Any, light_serials : List[str]) -> Any:
if light_serials:
for light in copy.copy(lights):
if light.path not in light_ids:
if light.info['serial_number'] not in light_serials:
lights.remove(light)
return lights

Expand All @@ -36,7 +36,7 @@ def process_lights(lights : Any, producer_report : List[ProducerReport]) -> List
{
'name': 'compulab_fit_statusb',
'type': 'light',
'description': helper.create_description(light.info['product_string'], light.path),
'description': helper.create_description(light.info['product_string'], light.info['serial_number']),
'status': status
})
return result
Expand Down

0 comments on commit fa70e23

Please sign in to comment.