-
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(history): add moonraker sensors to total statistic
Signed-off-by: Stefan Dej <[email protected]>
- Loading branch information
Showing
7 changed files
with
167 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Vue from 'vue' | ||
import Component from 'vue-class-component' | ||
|
||
@Component | ||
export default class HistoryMixin extends Vue { | ||
get moonrakerHistoryFields() { | ||
const config = this.$store.state.server.config?.config ?? {} | ||
const sensors = Object.keys(config).filter((key) => key.startsWith('sensor ')) | ||
const historyFields: { desc: string; unit: string; provider: string; name: string; parameter: string }[] = [] | ||
|
||
sensors.forEach((configName) => { | ||
const sensor = config[configName] ?? {} | ||
|
||
Object.keys(sensor) | ||
.filter((key) => key.startsWith('history_field_')) | ||
.forEach((key) => { | ||
const historyField = sensor[key] | ||
|
||
historyFields.push({ | ||
desc: historyField.desc, | ||
unit: historyField.units, | ||
provider: configName, | ||
parameter: historyField.parameter, | ||
name: key, | ||
}) | ||
}) | ||
}) | ||
|
||
return historyFields | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters