lovelace-multiple-entity-row
lovelace-multiple-entity-row copied to clipboard
FR: Substitution text for a state
It could be great to have a possibility to substitute a sensor's state value by some user-defined text. Particularly it could be useful to write smth like "No data" instead of "Unavailable" - if the sensor is unavailable:
- type: entities
entities:
- type: custom:multiple-entity-row
entity: sun.sun
entities:
- entity: sensor.service_unavailable_value
show_state: false
Another example is to write "cool", "hot", "warm" instead of writing an actual temperature.
To implement this functionality, I propose to add a new option - substitute_if
.
This option should be available:
- for the main entity;
- for each additional entities.
The option should be an object like a "hide_if" option. Below there is a draft of the paragraph from ReadMe:
### Substitution
The `substitute_if` option can be used to substitute an entity's state if its state or attribute value matches the specified criteria.
It can be used directly with a string, number or boolean value (i.e. `substitute_if: 'off'`), as a list with several values,
or as an object with one or more of the options listed below.
| Name | Type | Description |
| ------- | -------- | ------------------------------------------------------------------- |
| text | string | Substitution text |
| above | number | Substitute if entity _number_ value is above the specified value |
| below | number | Substitute if entity _number_ value is below the specified value |
| value | list/any | Substitute if value matches specified value or any value in a list |
+1
I was looking for a way to substitute user-friendly words to state values, with lists of corresponding values. Basic example: I have a sensor for "internet connected" which is a boolean and appears as an additional entity with the value 0 or 1. I would like to substitute something like "connected" / "disconnected" instead, and I think your proposal would do just that.
+1
I want to display my covers state as "open" or "close" rather than 100 or 0.
+1 I want to see the petrol station is opened/closed instead of on/off.
The entity has the state on/off, but the show_as option is set to door. That's why the entity state in default lovelace cards is already shown correctly. But multiple-entity-row unfortunately does not make use of show_as option.