-
-
Notifications
You must be signed in to change notification settings - Fork 390
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 (#1886)
- Loading branch information
Showing
7 changed files
with
165 additions
and
74 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
4cf1607
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this programme help a lot