|
|
@ -6,6 +6,7 @@ import { Connection } from 'home-assistant-js-websocket';
|
|
|
|
import { supported, CSS_STYLE } from './const';
|
|
|
|
import { supported, CSS_STYLE } from './const';
|
|
|
|
import Plex from './modules/Plex';
|
|
|
|
import Plex from './modules/Plex';
|
|
|
|
import PlayController from './modules/PlayController';
|
|
|
|
import PlayController from './modules/PlayController';
|
|
|
|
|
|
|
|
import ContentCardEditor from './editor';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
escapeHtml,
|
|
|
|
escapeHtml,
|
|
|
|
getOffset,
|
|
|
|
getOffset,
|
|
|
@ -21,6 +22,12 @@ import {
|
|
|
|
} from './modules/utils';
|
|
|
|
} from './modules/utils';
|
|
|
|
import style from './modules/style';
|
|
|
|
import style from './modules/style';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
|
|
|
interface Window {
|
|
|
|
|
|
|
|
customCards: any;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
plexProtocol: 'http' | 'https' = 'http';
|
|
|
|
plexProtocol: 'http' | 'https' = 'http';
|
|
|
|
|
|
|
|
|
|
|
@ -129,6 +136,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static getConfigElement() {
|
|
|
|
|
|
|
|
return document.createElement('content-card-editor');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static getStubConfig() {
|
|
|
|
|
|
|
|
return { entity: 'sun.sun' };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderNewElementsIfNeeded = (): void => {
|
|
|
|
renderNewElementsIfNeeded = (): void => {
|
|
|
|
const loadAdditionalRowsCount = 2; // todo: make this configurable
|
|
|
|
const loadAdditionalRowsCount = 2; // todo: make this configurable
|
|
|
|
const height = getHeight(this.content);
|
|
|
|
const height = getHeight(this.content);
|
|
|
@ -1542,4 +1557,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
customElements.define('content-card-editor', ContentCardEditor);
|
|
|
|
customElements.define('plex-meets-homeassistant', PlexMeetsHomeAssistant);
|
|
|
|
customElements.define('plex-meets-homeassistant', PlexMeetsHomeAssistant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.customCards = window.customCards || [];
|
|
|
|
|
|
|
|
window.customCards.push({
|
|
|
|
|
|
|
|
type: 'plex-meets-homeassistant',
|
|
|
|
|
|
|
|
name: 'Plex meets Home Assistant',
|
|
|
|
|
|
|
|
preview: false,
|
|
|
|
|
|
|
|
description: 'Integrates Plex into Home Assistant. Browse and launch media with a simple click.' // Optional
|
|
|
|
|
|
|
|
});
|
|
|
|