From c7ade49eeaa53b7c49fe1dd7d97f80d05fdf81da Mon Sep 17 00:00:00 2001 From: James Woglom Date: Fri, 13 Dec 2024 02:09:36 -0500 Subject: [PATCH] devicestatus: tune nightscout output to look more like Loops uploader --- tconnectsync/parser/nightscout.py | 1 + tests/sync/tandemsource/test_process_device_status.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tconnectsync/parser/nightscout.py b/tconnectsync/parser/nightscout.py index 00c6022..d3e39f4 100644 --- a/tconnectsync/parser/nightscout.py +++ b/tconnectsync/parser/nightscout.py @@ -200,6 +200,7 @@ def devicestatus(created_at, batteryVoltage, batteryPercent, pump_event_id=""): "device": ENTERED_BY, "created_at": created_at, "pump": { + "clock": created_at, "battery": { "voltage": float(batteryVoltage), "percent": int(batteryPercent) if batteryPercent else None, diff --git a/tests/sync/tandemsource/test_process_device_status.py b/tests/sync/tandemsource/test_process_device_status.py index 7d4e89f..edb2089 100644 --- a/tests/sync/tandemsource/test_process_device_status.py +++ b/tests/sync/tandemsource/test_process_device_status.py @@ -37,6 +37,7 @@ def test_single_event_no_last_uploaded(self): 'created_at': '2024-12-03 23:40:23-05:00', 'device': 'Pump (tconnectsync)', 'pump': { + 'clock': '2024-12-03 23:40:23-05:00', 'battery': { 'status': '48%', 'percent': 48, @@ -90,6 +91,7 @@ def test_multiple_event_with_last_uploaded(self): 'created_at': '2024-12-04 02:30:23-05:00', 'device': 'Pump (tconnectsync)', 'pump': { + 'clock': '2024-12-04 02:30:23-05:00', 'battery': { 'status': '47%', 'percent': 47, @@ -133,6 +135,7 @@ def test_multiple_event_only_latest_applied(self): 'created_at': '2024-12-04 05:50:23-05:00', 'device': 'Pump (tconnectsync)', 'pump': { + 'clock': '2024-12-04 05:50:23-05:00', 'battery': { 'status': '46%', 'percent': 46,