From ae23fb79214ace5247c6ef9d0b1d8c5a2c707920 Mon Sep 17 00:00:00 2001 From: Ely Deckers Date: Sat, 26 Feb 2022 23:57:18 +0100 Subject: [PATCH] Fix sensor incorrect parameter bug --- src/zabbix-hue.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/zabbix-hue.py b/src/zabbix-hue.py index a029c7a..2051f50 100755 --- a/src/zabbix-hue.py +++ b/src/zabbix-hue.py @@ -1,11 +1,9 @@ #!/usr/bin/env python3 from fcntl import LOCK_EX, LOCK_NB, flock -from fileinput import filename import json import logging import logging.config -import math import os import sys from tempfile import mkstemp @@ -87,7 +85,8 @@ def __cache(self, type: str, fn_call): lock_file = CachedApi.__tf(f"{temp_filename}.lock") does_cache_file_exist = exists(cache_file_path) - cache_age_seconds = time.time() - os.path.getmtime(cache_file_path) + cache_age_seconds = time.time( + ) - os.path.getmtime(cache_file_path) if does_cache_file_exist else 0 is_cache_file_expired = not does_cache_file_exist or cache_age_seconds >= MAX_CACHE_AGE_SECONDS is_cache_hit = not is_cache_file_expired @@ -286,8 +285,8 @@ def sensor(self, arguments): LOG.error("Received unknown action '%s' for `sensor` command", action) return - self.__process(self.__map_sensor( - device_id, CommandHandler.__SENSOR_ACTION_MAP[action](device_id))) + CommandHandler.__process(self.__map_sensor( + device_id, CommandHandler.__SENSOR_ACTION_MAP[action])) LOG.debug("Finished `sensor` command (arguments=%s)", arguments) def light(self, arguments):