Skip to content

Commit

Permalink
Fetch CAN bus stats from venus-platform #375
Browse files Browse the repository at this point in the history
  • Loading branch information
blammit committed Jul 20, 2023
1 parent a3de9d6 commit f79449c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 0 additions & 6 deletions data/SystemSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ QtObject {
}
}

// TODO get canBusStats from venus-platform when available, as equivalent of vePlatform.canBusStats(gateway)
property var _canBusStats: ({})
function canBusStatistics(gateway) {
return _canBusStats[gateway] || ""
}

function reset() {
// no-op
}
Expand Down
13 changes: 7 additions & 6 deletions pages/settings/PageCanbusStatus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ Page {
if (!root.gateway) {
return
}
const statsText = Global.systemSettings.canBusStatistics(root.gateway)
let stats
try {
stats = JSON.parse(statsText)[0]
stats = JSON.parse(canBusStats.value)[0]
} catch (e) {
console.warn("Unable to parse JSON:", statsText, "exception:", e)

// TODO requires venus-platform backend
console.warn("TODO Global.systemSettings.canBusStatistics() not yet implemented!!")
console.warn("Unable to parse JSON:", canBusStats.value, "exception:", e)
return
}
if (!stats) {
Expand Down Expand Up @@ -119,4 +115,9 @@ Page {
}
}
}

DataPoint {
id: canBusStats
source: "com.victronenergy.platform/CanBus/Interface/" + gateway + "/Statistics"
}
}

0 comments on commit f79449c

Please sign in to comment.