Skip to content

Commit

Permalink
fix(chart): add fuel gauge temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Oct 13, 2023
1 parent f1166d0 commit 5fa6797
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lambda/chartSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ export type Summary = {
d: number,
][]
solGain?: Readings
// Fuel gauge readings
// Fuel gauge readings, see https://github.com/NordicSemiconductor/asset-tracker-cloud-docs/blob/4713549af719a7e119324853aa117d752ac856e3/docs/cloud-protocol/Reported.ts#L111
fgSoC?: Readings
fgI?: Readings
fgTTE?: Readings
fgTTF?: Readings
fgT?: Readings
base: Date
}

Expand Down Expand Up @@ -99,7 +100,7 @@ export const createChartSummary = async ({
historicaldataDatabaseName: string
historicaldataTableName: string
}): Promise<Summaries> => {
const [bat, temp, solBat, solGain, fgSoC, fgI, fgTTE, fgTTF] =
const [bat, temp, solBat, solGain, fgSoC, fgI, fgTTE, fgTTF, fgT] =
await Promise.all([
timestream.send(
new QueryCommand({
Expand Down Expand Up @@ -181,6 +182,16 @@ export const createChartSummary = async ({
}),
}),
),
timestream.send(
new QueryCommand({
QueryString: summaryQuery({
db: historicaldataDatabaseName,
table: historicaldataTableName,
measureName: 'fg.T',
hours: 1,
}),
}),
),
])
const now = new Date()
const summaries: Summaries = {}
Expand All @@ -192,6 +203,7 @@ export const createChartSummary = async ({
groupResult(summaries, 'fgI', fgI, now)
groupResult(summaries, 'fgTTE', fgTTE, now)
groupResult(summaries, 'fgTTF', fgTTF, now)
groupResult(summaries, 'fgT', fgT, now)

// Get battery values from 8 hours ago
const batLevels = (
Expand Down

0 comments on commit 5fa6797

Please sign in to comment.