diff --git a/pyproject.toml b/pyproject.toml index 01c1811..d8122cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "smart_meter_to_openhab" -version = "0.2.10" +version = "0.3.0" description = "Pushing data of ISKRA MT175 smart meter to openhab" authors = ["Heiko Bauer "] repository = "https://github.com/die-bauerei/smart-meter-to-openhab" diff --git a/smart_meter_to_openhab/openhab.py b/smart_meter_to_openhab/openhab.py index ae9c9f9..7824b8c 100644 --- a/smart_meter_to_openhab/openhab.py +++ b/smart_meter_to_openhab/openhab.py @@ -82,7 +82,9 @@ def _get_persistence_values(self, oh_item_names : Tuple[str, ...], timedelta : d def check_if_updated(self, oh_item_names : Tuple[str, ...], timedelta : datetime.timedelta) -> bool: pers_values=self._get_persistence_values(oh_item_names, timedelta) for values in pers_values: - if all(i == values[0] for i in values): + if not values: + return False + elif values[0] > 5.0 and all(i == values[0] for i in values): return False return True diff --git a/smart_meter_to_openhab_scripts/main.py b/smart_meter_to_openhab_scripts/main.py index ee409fe..b82f870 100644 --- a/smart_meter_to_openhab_scripts/main.py +++ b/smart_meter_to_openhab_scripts/main.py @@ -98,8 +98,9 @@ def main() -> None: logger.info(f"Starting smart_meter_to_openhab version {__version__}") logger.setLevel(log_level_from_arg(args.verbose)) try: + process_start_time=datetime.now() while True: - _run(datetime.now(), logger, args.smart_meter_read_count, args.interval_in_sec, args.ping_in_min, args.uhubctl) + _run(process_start_time, logger, args.smart_meter_read_count, args.interval_in_sec, args.ping_in_min, args.uhubctl) except Exception as e: logger.exception("Caught Exception: " + str(e)) except: