Skip to content

Commit

Permalink
config renamed to card
Browse files Browse the repository at this point in the history
  • Loading branch information
iantrich committed Mar 20, 2019
1 parent 65ce252 commit 2683532
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This card is for [Lovelace](https://www.home-assistant.io/lovelace) on [Home Ass
| Name | Type | Requirement | Description
| ---- | ---- | ------- | -----------
| type | string | **Required** | `custom:config-template-card`
| config | object | **Required** | Card object
| card | object | **Required** | Card object
| entities | list | **Optional** | List of entity strings that should be watched for updates
| variables | list | **Optional** | List of variables, which can be templates, that can be used in your `config` and indexed using `vars`

Expand Down Expand Up @@ -69,7 +69,7 @@ entities:
- cover.garage_door
- alarm_control_panel.ha_alarm
- climate.ecobee
config:
card:
type: "${vars[0] === 'on' ? 'custom:hui-glance-card' : 'custom:hui-entities-card'}"
entities:
- entity: alarm_control_panel.ha_alarm
Expand Down
4 changes: 2 additions & 2 deletions dist/config-template-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ const fireEvent = (node, type, detail, options) => {

let ConfigTemplateCard = class ConfigTemplateCard extends LitElement {
setConfig(config) {
if (!config || !config.config || !config.config.type) {
if (!config || !config.card || !config.card.type) {
throw new Error("Invalid configuration");
}
this._config = config;
Expand All @@ -2686,7 +2686,7 @@ let ConfigTemplateCard = class ConfigTemplateCard extends LitElement {
}
// this.hass.states
// this.hass.user.name
let cardConfig = deepcopy(this._config.config);
let cardConfig = deepcopy(this._config.card);
cardConfig = this._evaluateConfig(cardConfig);
// console.log(this._config.config);
// console.log(cardConfig);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "config-template-card",
"version": "1.0.4",
"version": "1.0.5",
"description": "Lovelace config-template-card",
"keywords": [
"home-assistant",
Expand Down
4 changes: 2 additions & 2 deletions src/config-template-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ConfigTemplateCard extends LitElement {
@property() private _config?: ConfigTemplateConfig;

public setConfig(config: ConfigTemplateConfig): void {
if (!config || !config.config || !config.config.type) {
if (!config || !config.card || !config.card.type) {
throw new Error("Invalid configuration");
}

Expand Down Expand Up @@ -52,7 +52,7 @@ class ConfigTemplateCard extends LitElement {
// this.hass.states
// this.hass.user.name

let cardConfig = deepClone(this._config.config);
let cardConfig = deepClone(this._config.card);
cardConfig = this._evaluateConfig(cardConfig);

// console.log(this._config.config);
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ConfigTemplateConfig {
type: string;
entities?: string[];
variables?: string[];
config?: any;
card?: any;
}

declare global {
Expand Down

0 comments on commit 2683532

Please sign in to comment.