From a17e502adc60b844815e23daec93bf3cc9c14afd Mon Sep 17 00:00:00 2001 From: hjelev Date: Fri, 3 Feb 2023 23:03:03 +0200 Subject: [PATCH] added used_space_path to config --- src/config.py.example | 1 + src/rpi-cpu2mqtt.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.py.example b/src/config.py.example index 29018b5..55a12fc 100644 --- a/src/config.py.example +++ b/src/config.py.example @@ -26,6 +26,7 @@ sleep_time = 0.5 cpu_load = True cpu_temp = True used_space = True +used_space_path = '/mnt' voltage = True sys_clock_speed = True swap = True diff --git a/src/rpi-cpu2mqtt.py b/src/rpi-cpu2mqtt.py index 4f4bea4..0ee5515 100644 --- a/src/rpi-cpu2mqtt.py +++ b/src/rpi-cpu2mqtt.py @@ -301,13 +301,15 @@ if __name__ == '__main__': # delay the execution of the script time.sleep(config.random_delay) + if hasattr(config, 'used_space_path'): used_space_path = config.used_space_path + else: used_space_path = '/' # collect the monitored values if config.cpu_load: cpu_load = check_cpu_load() if config.cpu_temp: cpu_temp = check_cpu_temp() if config.used_space: - used_space = check_used_space('/') + used_space = check_used_space(used_space_path) if config.voltage: voltage = check_voltage() if config.sys_clock_speed: