From 32d48eb05e062f19d795b3de6579f6b1ba7b2625 Mon Sep 17 00:00:00 2001 From: Oscar Gonzalez Date: Fri, 9 Jul 2021 16:15:13 +0200 Subject: [PATCH] Avoid posting non recognised sensors --- scdata/device/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scdata/device/__init__.py b/scdata/device/__init__.py index b2b0e25f..92046245 100644 --- a/scdata/device/__init__.py +++ b/scdata/device/__init__.py @@ -664,7 +664,12 @@ def post_sensors(self, dry_run = False): rd = dict() df = self.readings.copy().dropna(axis = 0, how='all') - for col in self.readings: rd[col] = self.sensors[col]['id'] + for col in self.readings: + if col not in rd: + std_out(f'Column ({col}) not in recognised IDs. Ignoring', 'WARNING') + df.drop(col, axis=1, inplace=True) + continue + rd[col] = self.sensors[col]['id'] df.rename(columns=rd, inplace=True)