forked from platypush/platypush
Don't perform reads on the serial plugin when refreshing
This commit is contained in:
parent
0dac122db5
commit
75f7fbd67a
1 changed files with 10 additions and 0 deletions
|
@ -35,6 +35,13 @@ Vue.component('sensors', {
|
||||||
|
|
||||||
const promises = this.config.plugins.map(plugin => {
|
const promises = this.config.plugins.map(plugin => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (plugin === 'serial') {
|
||||||
|
// Don't refresh reads over the serial port,
|
||||||
|
// as it might mess up any data transfer already in progress
|
||||||
|
resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
request(plugin + '.get_measurement').then(metrics => {
|
request(plugin + '.get_measurement').then(metrics => {
|
||||||
resolve(metrics);
|
resolve(metrics);
|
||||||
});
|
});
|
||||||
|
@ -42,6 +49,9 @@ Vue.component('sensors', {
|
||||||
});
|
});
|
||||||
|
|
||||||
Vue.set(this, 'metrics', (await Promise.all(promises)).reduce((obj, metrics) => {
|
Vue.set(this, 'metrics', (await Promise.all(promises)).reduce((obj, metrics) => {
|
||||||
|
if (!metrics)
|
||||||
|
return;
|
||||||
|
|
||||||
for (const [name, value] of Object.entries(metrics)) {
|
for (const [name, value] of Object.entries(metrics)) {
|
||||||
obj[name] = value;
|
obj[name] = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue