esphome / esphome/feature-requests
Support enum sensors
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Describe the problem you have/What new integration you would like
Please add support for device_class: enum, and "options:" to text_sensor.
Please describe your use case for this integration and alternatives you've tried:
There are devices (for example Sonicare, that can be conneced via BLE), that report state as one value of a given set. Running/Idle/Off/Charging for example. Currently, we have 2 ways to deal with this:
- Use text_sensor (which currently doesn't support enum/options). That is pain to use in HA automations, as HA doesn't know the possible states to offer you drop down list, so you have to write the expected value letter by letter. Easy to make a typo, hard to update for any changes. That's far from ideal.
- Or, use select.template . That works in HA automations, but... You have to set empty set_action, and in HA, device view, it offers you dropdown list to change the value. Again, not ideal.
What we need is read only value (as text_sensor is), with a way to tell HA what are the possible values (as select sensor has). That could be achieved by adding support for "device_class: enum" and "options:" to text_sensor. It would then expose "options:" attribute on the entity to HA.
Additional context
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing text_sensor and select.template integrations, then inspect how device classes and options are exposed to Home Assistant. Done should mean a read-only enum text sensor can declare its possible values and Home Assistant exposes those options for automation use.
Written by the indexing model from the issue text.
Assessment
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100