Fix: Critical error when refreshing state of plexPlayer devices

pull/47/head 3.0.8
Juraj Nyíri 3 years ago
parent c940683c1f
commit 973ec4684c

@ -19858,13 +19858,27 @@ class PlayController {
const entityVal = value; const entityVal = value;
if (lodash.isArray(entityVal)) { if (lodash.isArray(entityVal)) {
for (const entity of entityVal) { for (const entity of entityVal) {
// eslint-disable-next-line no-await-in-loop if (!lodash.isNil(this.hass.states[entity])) {
this.entityStates[entity] = await getState(this.hass, entity); try {
// eslint-disable-next-line no-await-in-loop
this.entityStates[entity] = await getState(this.hass, entity);
}
catch (err) {
// pass
}
}
} }
} }
else { else {
// eslint-disable-next-line no-await-in-loop try {
this.entityStates[entityVal] = await getState(this.hass, entityVal); if (!lodash.isNil(this.hass.states[entityVal])) {
// eslint-disable-next-line no-await-in-loop
this.entityStates[entityVal] = await getState(this.hass, entityVal);
}
}
catch (err) {
// pass
}
} }
} }
try { try {

@ -627,12 +627,24 @@ class PlayController {
const entityVal = value; const entityVal = value;
if (_.isArray(entityVal)) { if (_.isArray(entityVal)) {
for (const entity of entityVal) { for (const entity of entityVal) {
// eslint-disable-next-line no-await-in-loop if (!_.isNil(this.hass.states[entity])) {
this.entityStates[entity] = await getState(this.hass, entity); try {
// eslint-disable-next-line no-await-in-loop
this.entityStates[entity] = await getState(this.hass, entity);
} catch (err) {
// pass
}
}
} }
} else { } else {
// eslint-disable-next-line no-await-in-loop try {
this.entityStates[entityVal] = await getState(this.hass, entityVal); if (!_.isNil(this.hass.states[entityVal])) {
// eslint-disable-next-line no-await-in-loop
this.entityStates[entityVal] = await getState(this.hass, entityVal);
}
} catch (err) {
// pass
}
} }
} }
try { try {

Loading…
Cancel
Save