Config UI: improve device updates (#18405)
This commit is contained in:
parent
0a83391856
commit
8694917440
1 changed files with 10 additions and 9 deletions
|
|
@ -619,16 +619,17 @@ export default {
|
|||
async updateValues() {
|
||||
clearTimeout(this.deviceValueTimeout);
|
||||
if (!this.offline) {
|
||||
const promises = [
|
||||
...this.meters.map((meter) => this.updateDeviceValue("meter", meter.name)),
|
||||
...this.vehicles.map((vehicle) =>
|
||||
this.updateDeviceValue("vehicle", vehicle.name)
|
||||
),
|
||||
];
|
||||
|
||||
await Promise.all(promises);
|
||||
for (const meter of this.meters) {
|
||||
await this.updateDeviceValue("meter", meter.name);
|
||||
}
|
||||
for (const vehicle of this.vehicles) {
|
||||
await this.updateDeviceValue("vehicle", vehicle.name);
|
||||
}
|
||||
}
|
||||
this.deviceValueTimeout = setTimeout(this.updateValues, 10000);
|
||||
// ensure that component is still mounted
|
||||
if (!this.$el) return;
|
||||
const interval = (store.state?.interval || 30) * 1000;
|
||||
this.deviceValueTimeout = setTimeout(this.updateValues, interval);
|
||||
},
|
||||
deviceTags(type, id) {
|
||||
return this.deviceValues[type]?.[id] || [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue