|
|
@ -20818,8 +20818,30 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.renderInitialData = async () => {
|
|
|
|
this.renderInitialData = async () => {
|
|
|
|
let { entity } = JSON.parse(JSON.stringify(this.config));
|
|
|
|
let { entity } = JSON.parse(JSON.stringify(this.config));
|
|
|
|
const processEntity = (entityObj, entityString) => {
|
|
|
|
const processEntity = (entityObj, entityString) => {
|
|
|
|
|
|
|
|
let realEntityString = entityString;
|
|
|
|
|
|
|
|
let isPlexPlayer = false;
|
|
|
|
|
|
|
|
if (lodash.startsWith(entityString, 'plexPlayer | ')) {
|
|
|
|
|
|
|
|
// eslint-disable-next-line prefer-destructuring
|
|
|
|
|
|
|
|
realEntityString = entityString.split(' | ')[3];
|
|
|
|
|
|
|
|
isPlexPlayer = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (lodash.startsWith(entityString, 'androidtv | ') ||
|
|
|
|
|
|
|
|
lodash.startsWith(entityString, 'kodi | ') ||
|
|
|
|
|
|
|
|
lodash.startsWith(entityString, 'cast | ')) {
|
|
|
|
|
|
|
|
// eslint-disable-next-line prefer-destructuring
|
|
|
|
|
|
|
|
realEntityString = entityString.split(' | ')[1];
|
|
|
|
|
|
|
|
isPlexPlayer = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isPlexPlayer) {
|
|
|
|
|
|
|
|
if (lodash.isNil(entityObj.plexPlayer)) {
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
|
|
|
|
entityObj.plexPlayer = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
entityObj.plexPlayer.push(realEntityString);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
lodash.forEach(this.entityRegistry, entityInRegister => {
|
|
|
|
lodash.forEach(this.entityRegistry, entityInRegister => {
|
|
|
|
if (lodash.isEqual(entityInRegister.entity_id, entityString)) {
|
|
|
|
if (lodash.isEqual(entityInRegister.entity_id, realEntityString)) {
|
|
|
|
switch (entityInRegister.platform) {
|
|
|
|
switch (entityInRegister.platform) {
|
|
|
|
case 'cast':
|
|
|
|
case 'cast':
|
|
|
|
if (lodash.isNil(entityObj.cast)) {
|
|
|
|
if (lodash.isNil(entityObj.cast)) {
|
|
|
@ -20846,6 +20868,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(realEntityString);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const entityOrig = entity;
|
|
|
|
const entityOrig = entity;
|
|
|
|
if (lodash.isString(entityOrig)) {
|
|
|
|
if (lodash.isString(entityOrig)) {
|
|
|
@ -20858,6 +20882,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
processEntity(entity, entityStr);
|
|
|
|
processEntity(entity, entityStr);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(entity);
|
|
|
|
this.loading = true;
|
|
|
|
this.loading = true;
|
|
|
|
this.renderPage();
|
|
|
|
this.renderPage();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|