Skip to content

Commit

Permalink
devicestatus: tune nightscout output to look more like Loops uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoglom committed Dec 13, 2024
1 parent 1f0fbd7 commit c7ade49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tconnectsync/parser/nightscout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions tests/sync/tandemsource/test_process_device_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c7ade49

Please sign in to comment.