Skip to content

Commit

Permalink
Fix YAML loading of mapping files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiacrumpton authored Feb 29, 2024
1 parent fa64d0f commit fefb198
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/generate_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def generateSensorsForAnalytics(analytics, sensor_dict):
# Get all sensor mappings and load as a list of dicts
mapping_files = glob.glob(path.join(path.dirname(__file__), "..", "sensors", "*.yaml"))
print("detected the following sensors: {}".format(str(mapping_files)))
mappings = [yaml.load(open(mapping_file,encoding='utf-8').read()) for mapping_file in mapping_files]
with open(mapping_file, encoding='utf-8') as mf:
mapping_data = yaml.safe_load(mf)
mappings.append(mapping_data)
#mappings = [yaml.load(open(mapping_file,encoding='utf-8').read()) for mapping_file in mapping_files]

# Get all data models and load as list of dicts
data_model_files = glob.glob(path.join(path.dirname(__file__), "..", "data_model", "*.yaml"))
Expand Down

0 comments on commit fefb198

Please sign in to comment.