diff --git a/mqttc.py b/mqttc.py index fb906d5..ac50bb9 100644 --- a/mqttc.py +++ b/mqttc.py @@ -54,8 +54,8 @@ def save_items(payload): data['timex'] = datetime.strptime(item['time'], "%Y%m%d%H%M%S").replace(tzinfo=tz.gettz('Asia/Shanghai')) data['mpoint_id'] = item['name'] last_timex: datetime = mpoint_dict.get(data['mpoint_id'], None) - if data["timex"].second not in getattr(conf, "SAVE_SECONDS", [2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57]) or ( - last_timex and last_timex.second == data["timex"].second): + if data["timex"].minute not in getattr(conf, "SAVE_MINUTES", [2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57]) or ( + last_timex and last_timex.minute == data["timex"].minute): continue try: val_float = float(item["value"])