2.0
Juraj Nyíri 3 years ago
parent dafd64afe2
commit bede6f2c57

@ -19480,6 +19480,9 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.ip = this.ip.value; this.config.ip = this.ip.value;
this.config.token = this.token.value; this.config.token = this.token.value;
this.config.port = this.port.value; this.config.port = this.port.value;
if (!this.config.entity) {
this.config.entity = [];
}
if (!lodash.isEmpty(this.libraryName.value)) { if (!lodash.isEmpty(this.libraryName.value)) {
this.config.libraryName = this.libraryName.value; this.config.libraryName = this.libraryName.value;
this.config.sort = `${this.sort.value}:${this.sortOrder.value}`; this.config.sort = `${this.sort.value}:${this.sortOrder.value}`;
@ -21711,6 +21714,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}; };
this.setConfig = (config) => { this.setConfig = (config) => {
this.plexProtocol = 'http'; this.plexProtocol = 'http';
if (!config.ip) {
throw new Error('You need to define a Plex IP Address');
}
if (!config.token) {
throw new Error('You need to define a Plex Token');
}
if (!config.libraryName) {
throw new Error('You need to define a libraryName');
}
if (!config.entity || config.entity.length === 0) { if (!config.entity || config.entity.length === 0) {
throw new Error('You need to define at least one entity'); throw new Error('You need to define at least one entity');
} }
@ -21730,15 +21742,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
else if (!lodash.isString(config.entity) && !lodash.isArray(config.entity)) { else if (!lodash.isString(config.entity) && !lodash.isArray(config.entity)) {
throw new Error('You need to define at least one supported entity'); throw new Error('You need to define at least one supported entity');
} }
if (!config.token) {
throw new Error('You need to define a token');
}
if (!config.ip) {
throw new Error('You need to define a ip');
}
if (!config.libraryName) {
throw new Error('You need to define a libraryName');
}
this.config = config; this.config = config;
if (config.protocol) { if (config.protocol) {
this.plexProtocol = config.protocol; this.plexProtocol = config.protocol;

@ -71,6 +71,9 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.config.ip = this.ip.value; this.config.ip = this.ip.value;
this.config.token = this.token.value; this.config.token = this.token.value;
this.config.port = this.port.value; this.config.port = this.port.value;
if (!this.config.entity) {
this.config.entity = [];
}
if (!_.isEmpty(this.libraryName.value)) { if (!_.isEmpty(this.libraryName.value)) {
this.config.libraryName = this.libraryName.value; this.config.libraryName = this.libraryName.value;

@ -1495,6 +1495,15 @@ class PlexMeetsHomeAssistant extends HTMLElement {
setConfig = (config: any): void => { setConfig = (config: any): void => {
this.plexProtocol = 'http'; this.plexProtocol = 'http';
if (!config.ip) {
throw new Error('You need to define a Plex IP Address');
}
if (!config.token) {
throw new Error('You need to define a Plex Token');
}
if (!config.libraryName) {
throw new Error('You need to define a libraryName');
}
if (!config.entity || config.entity.length === 0) { if (!config.entity || config.entity.length === 0) {
throw new Error('You need to define at least one entity'); throw new Error('You need to define at least one entity');
} }
@ -1513,15 +1522,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} else if (!_.isString(config.entity) && !_.isArray(config.entity)) { } else if (!_.isString(config.entity) && !_.isArray(config.entity)) {
throw new Error('You need to define at least one supported entity'); throw new Error('You need to define at least one supported entity');
} }
if (!config.token) {
throw new Error('You need to define a token');
}
if (!config.ip) {
throw new Error('You need to define a ip');
}
if (!config.libraryName) {
throw new Error('You need to define a libraryName');
}
this.config = config; this.config = config;
if (config.protocol) { if (config.protocol) {
this.plexProtocol = config.protocol; this.plexProtocol = config.protocol;

Loading…
Cancel
Save