Overview
Home Assistant entity fields in the configuration forms should display a fixed, non-editable domain prefix (e.g. sensor., switch.) as a chip, so the user only types the entity id and cannot enter an inconsistent/invalid prefix.
This already exists for Energy Monitor and Energy Load History Provider via the sensorPrefix flag on ConfigSchemaForm, but it has two limitations:
- It is hardcoded to
sensor. — every entity field gets the same sensor. prefix.
- It is not enabled everywhere — Forecast Provider, Energy Load Forecast Provider and Miner Controller currently render the full entity id as free text.
Problem
The single sensor. prefix cannot represent forms that mix entity domains. The clearest example is the Generic Socket (Home Assistant) miner controller, whose config mixes:
entity_switch → switch.miner_socket (domain switch.)
entity_power → sensor.miner_power (domain sensor.)
A global sensor. prefix would be wrong for entity_switch.
Proposed solution
- Make the fixed prefix per-field instead of a single global
sensor.: derive the entity domain for each field (e.g. from the field's default value such as switch.miner_socket → switch., or sensor.… → sensor.), falling back to sensor. when no hint is available.
- Render that per-field prefix as the fixed chip, with the user typing only the entity id (object id) after it.
- Enable the prefix on the remaining Home Assistant forms: Forecast Provider, Energy Load Forecast Provider and Miner Controller, for a consistent experience across all HA-based configuration forms.
Overview
Home Assistant entity fields in the configuration forms should display a fixed, non-editable domain prefix (e.g.
sensor.,switch.) as a chip, so the user only types the entity id and cannot enter an inconsistent/invalid prefix.This already exists for Energy Monitor and Energy Load History Provider via the
sensorPrefixflag onConfigSchemaForm, but it has two limitations:sensor.— every entity field gets the samesensor.prefix.Problem
The single
sensor.prefix cannot represent forms that mix entity domains. The clearest example is the Generic Socket (Home Assistant) miner controller, whose config mixes:entity_switch→switch.miner_socket(domainswitch.)entity_power→sensor.miner_power(domainsensor.)A global
sensor.prefix would be wrong forentity_switch.Proposed solution
sensor.: derive the entity domain for each field (e.g. from the field's default value such asswitch.miner_socket→switch., orsensor.…→sensor.), falling back tosensor.when no hint is available.