From aea1466eb24817706c3a327894f1adb87c871ae3 Mon Sep 17 00:00:00 2001 From: Lukas Berbuer Date: Mon, 29 Jul 2024 08:14:27 +0200 Subject: [PATCH] fix: handle optional signal_strength in PriDatabase.write_status --- src/vallenae/io/pridb.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vallenae/io/pridb.py b/src/vallenae/io/pridb.py index 5c23b20..d4162d5 100644 --- a/src/vallenae/io/pridb.py +++ b/src/vallenae/io/pridb.py @@ -518,7 +518,11 @@ def write_status(self, status: StatusRecord): else None ), "Eny": int(status.energy / parameter["ADC_TE"]), - "SS": int(status.signal_strength / parameter["ADC_SS"]), + "SS": ( + int(status.signal_strength / parameter["ADC_SS"]) + if status.signal_strength and "ADC_SS" in parameter + else None + ), "RMS": int(status.rms * 1e6 / parameter["ADC_µV"] / 0.0065536), }, )