Add editor support.
This commit is contained in:
@@ -6,6 +6,11 @@ export const CONF_CAMERAS_ARRAY_CAMERA_ENTITY =
|
|||||||
`${CONF_CAMERAS}.#.camera_entity` as const;
|
`${CONF_CAMERAS}.#.camera_entity` as const;
|
||||||
export const CONF_CAMERAS_ARRAY_FRIGATE_CAMERA_NAME =
|
export const CONF_CAMERAS_ARRAY_FRIGATE_CAMERA_NAME =
|
||||||
`${CONF_CAMERAS}.#.frigate.camera_name` as const;
|
`${CONF_CAMERAS}.#.frigate.camera_name` as const;
|
||||||
|
export const CONF_CAMERAS_ARRAY_CAST_METHOD = `${CONF_CAMERAS}.#.cast.method` as const;
|
||||||
|
export const CONF_CAMERAS_ARRAY_CAST_DASHBOARD_DASHBOARD_PATH =
|
||||||
|
`${CONF_CAMERAS}.#.cast.dashboard.dashboard_path` as const;
|
||||||
|
export const CONF_CAMERAS_ARRAY_CAST_DASHBOARD_VIEW_PATH =
|
||||||
|
`${CONF_CAMERAS}.#.cast.dashboard.view_path` as const;
|
||||||
export const CONF_CAMERAS_ARRAY_FRIGATE_CLIENT_ID =
|
export const CONF_CAMERAS_ARRAY_FRIGATE_CLIENT_ID =
|
||||||
`${CONF_CAMERAS}.#.frigate.client_id` as const;
|
`${CONF_CAMERAS}.#.frigate.client_id` as const;
|
||||||
export const CONF_CAMERAS_ARRAY_FRIGATE_LABELS =
|
export const CONF_CAMERAS_ARRAY_FRIGATE_LABELS =
|
||||||
|
|||||||
+39
-1
@@ -1,4 +1,8 @@
|
|||||||
import { fireEvent, HomeAssistant, LovelaceCardEditor } from '@dermotduffy/custom-card-helpers';
|
import {
|
||||||
|
fireEvent,
|
||||||
|
HomeAssistant,
|
||||||
|
LovelaceCardEditor,
|
||||||
|
} from '@dermotduffy/custom-card-helpers';
|
||||||
import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit';
|
import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit';
|
||||||
import { customElement, property, state } from 'lit/decorators.js';
|
import { customElement, property, state } from 'lit/decorators.js';
|
||||||
import { classMap } from 'lit/directives/class-map.js';
|
import { classMap } from 'lit/directives/class-map.js';
|
||||||
@@ -29,6 +33,9 @@ import {
|
|||||||
import {
|
import {
|
||||||
CONF_CAMERAS,
|
CONF_CAMERAS,
|
||||||
CONF_CAMERAS_ARRAY_CAMERA_ENTITY,
|
CONF_CAMERAS_ARRAY_CAMERA_ENTITY,
|
||||||
|
CONF_CAMERAS_ARRAY_CAST_DASHBOARD_DASHBOARD_PATH,
|
||||||
|
CONF_CAMERAS_ARRAY_CAST_DASHBOARD_VIEW_PATH,
|
||||||
|
CONF_CAMERAS_ARRAY_CAST_METHOD,
|
||||||
CONF_CAMERAS_ARRAY_DEPENDENCIES_ALL_CAMERAS,
|
CONF_CAMERAS_ARRAY_DEPENDENCIES_ALL_CAMERAS,
|
||||||
CONF_CAMERAS_ARRAY_DEPENDENCIES_CAMERAS,
|
CONF_CAMERAS_ARRAY_DEPENDENCIES_CAMERAS,
|
||||||
CONF_CAMERAS_ARRAY_FRIGATE_CAMERA_NAME,
|
CONF_CAMERAS_ARRAY_FRIGATE_CAMERA_NAME,
|
||||||
@@ -191,6 +198,7 @@ import {
|
|||||||
|
|
||||||
const MENU_BUTTONS = 'buttons';
|
const MENU_BUTTONS = 'buttons';
|
||||||
const MENU_CAMERAS = 'cameras';
|
const MENU_CAMERAS = 'cameras';
|
||||||
|
const MENU_CAMERAS_CAST = 'cameras.cast';
|
||||||
const MENU_CAMERAS_DEPENDENCIES = 'cameras.dependencies';
|
const MENU_CAMERAS_DEPENDENCIES = 'cameras.dependencies';
|
||||||
const MENU_CAMERAS_ENGINE = 'cameras.engine';
|
const MENU_CAMERAS_ENGINE = 'cameras.engine';
|
||||||
const MENU_CAMERAS_FRIGATE = 'cameras.frigate';
|
const MENU_CAMERAS_FRIGATE = 'cameras.frigate';
|
||||||
@@ -561,6 +569,12 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
{ value: 'grid', label: localize('display_modes.grid') },
|
{ value: 'grid', label: localize('display_modes.grid') },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected _castMethods: EditorSelectOption[] = [
|
||||||
|
{ value: '', label: '' },
|
||||||
|
{ value: 'standard', label: localize('config.cameras.cast.methods.standard') },
|
||||||
|
{ value: 'dashboard', label: localize('config.cameras.cast.methods.dashboard') },
|
||||||
|
];
|
||||||
|
|
||||||
public setConfig(config: RawFrigateCardConfig): void {
|
public setConfig(config: RawFrigateCardConfig): void {
|
||||||
// Note: This does not use Zod to parse the configuration, so it may be
|
// Note: This does not use Zod to parse the configuration, so it may be
|
||||||
// partially or completely invalid. It's more useful to have a partially
|
// partially or completely invalid. It's more useful to have a partially
|
||||||
@@ -1662,6 +1676,30 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
},
|
},
|
||||||
)}`,
|
)}`,
|
||||||
)}
|
)}
|
||||||
|
${this._putInSubmenu(
|
||||||
|
MENU_CAMERAS_CAST,
|
||||||
|
cameraIndex,
|
||||||
|
'config.cameras.cast.editor_label',
|
||||||
|
{ name: 'mdi:cast' },
|
||||||
|
html`
|
||||||
|
${this._renderOptionSelector(
|
||||||
|
getArrayConfigPath(CONF_CAMERAS_ARRAY_CAST_METHOD, cameraIndex),
|
||||||
|
this._castMethods,
|
||||||
|
)}
|
||||||
|
${this._renderStringInput(
|
||||||
|
getArrayConfigPath(
|
||||||
|
CONF_CAMERAS_ARRAY_CAST_DASHBOARD_DASHBOARD_PATH,
|
||||||
|
cameraIndex,
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
${this._renderStringInput(
|
||||||
|
getArrayConfigPath(
|
||||||
|
CONF_CAMERAS_ARRAY_CAST_DASHBOARD_VIEW_PATH,
|
||||||
|
cameraIndex,
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
`,
|
||||||
|
)}
|
||||||
</div>`
|
</div>`
|
||||||
: ``}
|
: ``}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,6 +10,18 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"cameras": {
|
"cameras": {
|
||||||
"camera_entity": "Camera Entity",
|
"camera_entity": "Camera Entity",
|
||||||
|
"cast": {
|
||||||
|
"dashboard": {
|
||||||
|
"dashboard_path": "Dashboard path",
|
||||||
|
"view_path": "View path"
|
||||||
|
},
|
||||||
|
"editor_label": "Cast Options",
|
||||||
|
"method": "Cast method",
|
||||||
|
"methods": {
|
||||||
|
"standard": "Standard",
|
||||||
|
"dashboard": "Dashboard"
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"all_cameras": "Show events for all cameras with this camera",
|
"all_cameras": "Show events for all cameras with this camera",
|
||||||
"cameras": "Show events for specific cameras with this camera",
|
"cameras": "Show events for specific cameras with this camera",
|
||||||
|
|||||||
@@ -10,6 +10,18 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"cameras": {
|
"cameras": {
|
||||||
"camera_entity": "Entità della telecamera",
|
"camera_entity": "Entità della telecamera",
|
||||||
|
"cast": {
|
||||||
|
"dashboard": {
|
||||||
|
"dashboard_path": "",
|
||||||
|
"view_path": ""
|
||||||
|
},
|
||||||
|
"editor_label": "",
|
||||||
|
"method": "",
|
||||||
|
"methods": {
|
||||||
|
"standard": "",
|
||||||
|
"dashboard": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"all_cameras": "Mostra eventi per tutte le telecamere con questa telecamera",
|
"all_cameras": "Mostra eventi per tutte le telecamere con questa telecamera",
|
||||||
"cameras": "Mostra eventi per telecamere specifiche con questa telecamera",
|
"cameras": "Mostra eventi per telecamere specifiche con questa telecamera",
|
||||||
|
|||||||
@@ -10,6 +10,18 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"cameras": {
|
"cameras": {
|
||||||
"camera_entity": "Entidade da Câmera",
|
"camera_entity": "Entidade da Câmera",
|
||||||
|
"cast": {
|
||||||
|
"dashboard": {
|
||||||
|
"dashboard_path": "",
|
||||||
|
"view_path": ""
|
||||||
|
},
|
||||||
|
"editor_label": "",
|
||||||
|
"method": "",
|
||||||
|
"methods": {
|
||||||
|
"standard": "",
|
||||||
|
"dashboard": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"all_cameras": "Mostrar eventos para todas as câmeras nesta câmera",
|
"all_cameras": "Mostrar eventos para todas as câmeras nesta câmera",
|
||||||
"cameras": "Mostrar eventos para câmeras específicas nesta câmera",
|
"cameras": "Mostrar eventos para câmeras específicas nesta câmera",
|
||||||
|
|||||||
@@ -10,6 +10,18 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"cameras": {
|
"cameras": {
|
||||||
"camera_entity": "Entidade da Câmera",
|
"camera_entity": "Entidade da Câmera",
|
||||||
|
"cast": {
|
||||||
|
"dashboard": {
|
||||||
|
"dashboard_path": "",
|
||||||
|
"view_path": ""
|
||||||
|
},
|
||||||
|
"editor_label": "",
|
||||||
|
"method": "",
|
||||||
|
"methods": {
|
||||||
|
"standard": "",
|
||||||
|
"dashboard": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"all_cameras": "Mostrar eventos para todas as câmeras nesta câmera",
|
"all_cameras": "Mostrar eventos para todas as câmeras nesta câmera",
|
||||||
"cameras": "Mostrar eventos para câmeras específicas nesta câmera",
|
"cameras": "Mostrar eventos para câmeras específicas nesta câmera",
|
||||||
|
|||||||
Reference in New Issue
Block a user