From f2d94cd93eb5fa55790f44f66a2ac206eeeeb5e1 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Thu, 30 Jun 2022 15:38:39 +0300 Subject: sound_sensor_server: fix for non-exisiting sensor_to_camera_nodes_relations --- src/sound_sensor_server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sound_sensor_server.py b/src/sound_sensor_server.py index 90e5993..c63d14a 100755 --- a/src/sound_sensor_server.py +++ b/src/sound_sensor_server.py @@ -19,9 +19,12 @@ server: SoundSensorServer def get_related_nodes(node_type: MediaNodeType, sensor_name: str) -> List[str]: - if sensor_name not in config[f'sensor_to_{node_type.name.lower()}_nodes_relations']: - raise ValueError(f'unexpected sensor name {sensor_name}') - return config[f'sensor_to_{node_type.name.lower()}_nodes_relations'][sensor_name] + try: + if sensor_name not in config[f'sensor_to_{node_type.name.lower()}_nodes_relations']: + raise ValueError(f'unexpected sensor name {sensor_name}') + return config[f'sensor_to_{node_type.name.lower()}_nodes_relations'][sensor_name] + except KeyError: + return [] def get_node_config(node_type: MediaNodeType, -- cgit v1.2.3