Compare commits

...
4 Commits
4 changed files with 22 additions and 2 deletions
+3 -1
View File
@@ -8,4 +8,6 @@ build
*.egg-info
.env
tconnectsync-check-output.log
ignore_*
ignore_*
.venv/
.vscode/
+1 -1
View File
@@ -1,6 +1,6 @@
[metadata]
name = tconnectsync
version = 2.2.3
version = 2.2.4
author = James Woglom
author_email = j@wogloms.net
description = Syncs Tandem Source (formerly t:connect) insulin pump data to Nightscout for the t:slim X2
+4
View File
@@ -0,0 +1,4 @@
from . import main
if __name__ == "__main__":
main()
@@ -24,6 +24,20 @@ class ChooseDevice:
tconnectDevice = serialNumberToPump[str(self.secret.PUMP_SERIAL_NUMBER)]
# Warn if pump is stale (no events in >3 days)
try:
max_event_date = arrow.get(tconnectDevice["maxDateWithEvents"])
age_days = (arrow.utcnow() - max_event_date).days
if age_days > 3:
logger.warning(
f"The selected pump (serial {tconnectDevice['serialNumber']}) has no events in the last {age_days} days "
f"(last seen: {tconnectDevice['maxDateWithEvents']}). "
"You may have switched to a new pump. Consider removing or updating PUMP_SERIAL_NUMBER in your config."
)
except Exception as e:
logger.debug(f"Could not parse maxDateWithEvents to check for staleness: {e}")
logger.info(f'Using pump with serial: {tconnectDevice["serialNumber"]} (tconnectDeviceId: {tconnectDevice["tconnectDeviceId"]}, last seen: {tconnectDevice["maxDateWithEvents"]})')
else:
maxDateSeen = None