diff --git a/smartmeter/__init__.py b/smartmeter/__init__.py index bd01a477d..b4e1c5c3f 100755 --- a/smartmeter/__init__.py +++ b/smartmeter/__init__.py @@ -205,7 +205,7 @@ def create_items(self, data: dict = {}, file: str = '') -> bool: if not file: dir = self._sh._items_dir - file = os.path.join(dir, f'smartmeter-{id}') + file = os.path.join(dir, f'smartmeter-{id}.yaml') if os.path.exists(file): self.logger.warning(f'output file {file} exists, not overwriting.') @@ -242,7 +242,7 @@ def create_items(self, data: dict = {}, file: str = '') -> bool: } try: - yaml_save(file, result) + yaml_save(file, {id: result}) except Exception as e: self.logger.warning(f'saving item file {file} failed with error: {e}') return False