Skip to content

Commit

Permalink
Add remote option
Browse files Browse the repository at this point in the history
  • Loading branch information
iantrich committed Jan 25, 2019
1 parent 48ed2a1 commit 211324e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


[![Version](https://img.shields.io/badge/version-0.0.4-green.svg?style=for-the-badge)](#) [![mantained](https://img.shields.io/maintenance/yes/2019.svg?style=for-the-badge)](#)
[![Version](https://img.shields.io/badge/version-0.0.5-green.svg?style=for-the-badge)](#) [![mantained](https://img.shields.io/maintenance/yes/2019.svg?style=for-the-badge)](#)

[![maintainer](https://img.shields.io/badge/maintainer-Ian%20Richardson%20%40iantrich-blue.svg?style=for-the-badge)](#)

Expand All @@ -23,6 +23,7 @@ This card is for [Lovelace](https://www.home-assistant.io/lovelace) on [Home Ass
| ---- | ---- | ------- | -----------
| type | string | **Required** | `custom:roku-card`
| entity | string | **Required** | `media_player` entity of Roku device
| remote | string | **Optional** | `remote` entity of Roku device. Default assume named like `entity`
| name | string | **Optional** | Card name
| theme | string | **Optional** | Card theme
| tv | boolean | **Optional** | If `true` shows volume and power buttons. Default `false`
Expand Down
29 changes: 27 additions & 2 deletions roku-card-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class RokuCardEditor extends LitElement {
return this._config.entity || "";
}

get _remote() {
return this._config.remote || "";
}

get _theme() {
return this._config.theme;
}
Expand All @@ -56,7 +60,7 @@ export class RokuCardEditor extends LitElement {
<div class="card-config">
<div class="side-by-side">
<paper-input
label="Name"
label="Name (Optional)"
.value="${this._name}"
.configValue="${"name"}"
@value-changed="${this._valueChanged}"
Expand All @@ -82,6 +86,27 @@ export class RokuCardEditor extends LitElement {
></paper-input>
`
}
${
customElements.get("ha-entity-picker")
? html`
<ha-entity-picker
.hass="${this.hass}"
.value="${this._remote}"
.configValue=${"remote"}
domain-filter="remote"
@change="${this._valueChanged}"
allow-custom-entity
></ha-entity-picker>
`
: html`
<paper-input
label="Remote (Optional)"
.value="${this._remote}"
.configValue="${"remote"}"
@value-changed="${this._valueChanged}"
></paper-input>
`
}
</div>
<div class="side-by-side">
${
Expand All @@ -96,7 +121,7 @@ export class RokuCardEditor extends LitElement {
`
: html`
<paper-input
label="Theme"
label="Theme (Optional)"
.value="${this._theme}"
.configValue="${"theme"}"
@value-changed="${this._valueChanged}"
Expand Down
2 changes: 1 addition & 1 deletion roku-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class RokuCard extends LitElement {
}

handleActionClick(e) {
let remote = this._config.entity.split(".")[1];
let remote = this._config.remote ? this._config.remote : this._config.entity.split(".")[1];
this.hass.callService("remote", "send_command", {
entity_id: "remote." + remote,
command: e.currentTarget.action
Expand Down

0 comments on commit 211324e

Please sign in to comment.