Skip to content

Commit

Permalink
feat: add new dashboard_link option (see readme) (ulic75#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulic75 authored May 13, 2022
1 parent 12bfd5e commit e979053
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ I recommend looking at the [Example usage section](#example-usage) to understand

#### Card options

| Name | Type | Default | Description |
| ----------------- | -------- | :----------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type | `string` | **required** | `custom:power-flow-card`. |
| entities | `object` | **required** | One or more sensor entities, see [entities object](#entities-object) for additional entity options. |
| inverted_entities | `string` | | Comma seperated list of entities that should be inverted (negative for consumption and positive for production). See [example usage](#inverted-entities-example). |
| kw_decimals | `number` | 1 | Number of decimals rounded to when kilowatts are displayed. |
| min_flow_rate | `number` | .75 | Represents the fastest amount of time in seconds for a flow dot to travel from one end to the other, see [flow formula](#flow-formula). |
| max_flow_rate | `number` | 6 | Represents the slowest amount of time in seconds for a flow dot to travel from one end to the other, see [flow formula](#flow-formula). |
| watt_threshold | `number` | 0 | The number of watts to display before converting to and displaying kilowatts. Setting of 0 will always display in kilowatts. |
| Name | Type | Default | Description |
| ----------------- | -------- | :----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type | `string` | **required** | `custom:power-flow-card`. |
| entities | `object` | **required** | One or more sensor entities, see [entities object](#entities-object) for additional entity options. |
| dashboard_link | `string` | | Shows a link to an Energy Dashboard. Should be a url path to location of your choice. If you wanted to link to the built-in dashboard you would enter `/energy` for example. |
| inverted_entities | `string` | | Comma seperated list of entities that should be inverted (negative for consumption and positive for production). See [example usage](#inverted-entities-example). |
| kw_decimals | `number` | 1 | Number of decimals rounded to when kilowatts are displayed. |
| min_flow_rate | `number` | .75 | Represents the fastest amount of time in seconds for a flow dot to travel from one end to the other, see [flow formula](#flow-formula). |
| max_flow_rate | `number` | 6 | Represents the slowest amount of time in seconds for a flow dot to travel from one end to the other, see [flow formula](#flow-formula). |
| watt_threshold | `number` | 0 | The number of watts to display before converting to and displaying kilowatts. Setting of 0 will always display in kilowatts. |

#### Entities object

Expand Down
1 change: 1 addition & 0 deletions src/power-flow-card-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface PowerFlowCardConfig extends LovelaceCardConfig {
};
solar?: string;
};
dashboard_link?: string;
inverted_entities: string | string[];
kw_decimals: number;
min_flow_rate: number;
Expand Down
20 changes: 18 additions & 2 deletions src/power-flow-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,21 @@ export class PowerFlowCard extends LitElement {
: ""}
</svg>
</div>
</div></ha-card
>
</div>
${this._config.dashboard_link
? html`
<div class="card-actions">
<a href=${this._config.dashboard_link}
><mwc-button>
${this.hass.localize(
"ui.panel.lovelace.cards.energy.energy_distribution.go_to_energy_dashboard"
)}
</mwc-button></a
>
</div>
`
: ""}
</ha-card>
`;
}

Expand Down Expand Up @@ -707,6 +720,9 @@ export class PowerFlowCard extends LitElement {
stroke-dasharray: 238.76104;
}
}
.card-actions a {
text-decoration: none;
}
`;
}

Expand Down

0 comments on commit e979053

Please sign in to comment.