diff --git a/README.md b/README.md index a08c964..4e7033e 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ If your brand is on the list of supported models, you should be able to get away | stats | Provide the states of `entity` defined as main status sensor, then a list of entities with configuration details as shown in [`entity`-items](#entity-items). Defines the datatable statistics (stats) in lower part of card. It may change depending on status of charger, or it is possible to define `default` as a state. See example. | | toolbar_left | Provide the states of `entity` defined as main status sensor, then a list of entities with configuration details as shown in [`entity`-items](#entity-items). Defines the left aligned command buttons on the toolbar at the bottom of the card. It may change depending on status of charger, or it is possible to define `default` as a state. See example. | | toolbar_right | Same as `toolbar_left` but right aligned command buttons on the toolbar. | -| currentlimits | Override the card default current limits by specifying a list of numbers. Used for current limit features of the card (if configured).| +| currentlimits | Override the card default current limits by specifying a list of numbers. Used for current limit features of the card (if configured). You can also use `dropdownitems` for each item to customize the dropdown if you prefer. | | statetext | Override or custom-translate the status sensor state by providing better or cleaner text. See example. You may force off translation by adding a leading '_' to your text, but it is usually not neccessary.| | collapsiblebuttons | Specify `text` and/or `icon` to customize the collapsible-buttons `group1`,`group2` and `group3` respectively. See example.| @@ -164,6 +164,7 @@ If your brand is on the list of supported models, you should be able to get away | icon | Card will use the entity icon as default, and will try to detect device class icons as well. If you want to override it, do it here by specifying a valid icon.| | round | If you would like to round down the number, specify an integer to define the number of digits.| | type | Choose between `info`, `service` and `dropdown`. Info-items will appear as icons with tooltip, clicking them opens the more-info popup for the entity. Service-items will do the same, but call a service when clicked (if it is provided). Dropdown-items will show a dropdown list to select from a list and call a specified service with this number as service data. | +| dropdownitems | List of items used for dropdown values if the type is `dropdown`. Defaults to `currentlimits` if not specified. | | calc_function | Choose between `min`, `max`, `mean`, `sum` to define a mathematical function to be performed on a specified list of entities or attributes. The result will be used on the sensor provided you specify `calculated` instead of a real `entity_id`. Then add a list of entities to be calculated in `calc_entities`.| | calc_entities | A list of entites or entity attributes that are used for the mathematical function. Specify a list of `entity_id`s and add `attribute`s if you prefer to use that.| | conditional_entity | Specify a boolean entity (returning on/off or true/false) to define if the entity should be shown based on state condition.| diff --git a/src/charger-card.ts b/src/charger-card.ts index 143cc94..873f780 100644 --- a/src/charger-card.ts +++ b/src/charger-card.ts @@ -256,6 +256,7 @@ export class ChargerCard extends LitElement { data['useval'] = this.getEntityState(data["entity_id"]); data['service'] = val.service !== undefined ? val.service : null; data['service_data'] = val.service_data !== undefined ? val.service_data : null; + data['dropdownitems'] = val.dropdownitems !== undefined ? val.dropdownitems : null; data['type'] = val.type !== undefined ? val.type : null; data['conditional_entity'] = val.conditional_entity !== undefined ? val.conditional_entity : null; data['conditional_attribute'] = val.conditional_attribute !== undefined ? val.conditional_attribute : null; @@ -746,7 +747,7 @@ export class ChargerCard extends LitElement { } else if (itemtype === 'dropdown') { - const sources = this.currentlimits; + const sources = carddata.dropdownitems != null ? carddata.dropdownitems : this.currentlimits; const selected = sources.indexOf(Number(carddata.useval)); return html`