Skip to content

Commit

Permalink
Support entity override on more-info action (closes #46)
Browse files Browse the repository at this point in the history
  • Loading branch information
benct committed Mar 7, 2020
1 parent 8b26034 commit 17b6d56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ If `toggle` is set to `true` the default action is `toggle`, otherwise it is `mo
| service_data | object | | Optional data to include when `action` is `call-service`
| url_path | string | | URL to open when `action` is `url`
| confirmation | bool/string | `false` | Enable/set text to present in a confirmation dialog
| entity | string | | A valid entity_id override when `action` is `more-info`

## Examples

Expand Down
8 changes: 6 additions & 2 deletions multiple-entity-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
this.lastChanged = config.secondary_info === 'last-changed';
this.stateHeader = config.state_header !== undefined ? config.state_header : null;
this.onRowClick = (!config.tap_action || config.tap_action.action !== 'none')
? () => this.fireEvent('hass-more-info', config.entity)
? this.moreInfoAction(config.tap_action, config.entity)
: null;
this.onStateClick = this.getAction(config.tap_action, config.entity);

Expand Down Expand Up @@ -263,7 +263,11 @@
}
}
}
return () => this.fireEvent('hass-more-info', entityId);
return this.moreInfoAction(config, entityId);
}

moreInfoAction(config, entityId) {
return () => this.fireEvent('hass-more-info', (config && config.entity) || entityId);
}

fireEvent(type, entity, options = {}) {
Expand Down

0 comments on commit 17b6d56

Please sign in to comment.