Add device_class
and state_class
in config flow for SQL (#95020)
* Add device_class and state_class in config flow for SQL * Update when selected NONE_SENTINEL * Add tests * Use SensorDeviceClass and SensorStateClass in tests * Add volatile_organic_compounds_parts in strings selector * Add test_attributes_from_entry_config * Remove test_attributes_from_entry_config and complement test_device_state_class * Add test_attributes_from_entry_config in test_sensor.py
This commit is contained in:
parent
b2bf360297
commit
4b1d096e6b
6 changed files with 264 additions and 7 deletions
|
@ -101,6 +101,8 @@ async def async_setup_entry(
|
|||
unit: str | None = entry.options.get(CONF_UNIT_OF_MEASUREMENT)
|
||||
template: str | None = entry.options.get(CONF_VALUE_TEMPLATE)
|
||||
column_name: str = entry.options[CONF_COLUMN_NAME]
|
||||
device_class: SensorDeviceClass | None = entry.options.get(CONF_DEVICE_CLASS, None)
|
||||
state_class: SensorStateClass | None = entry.options.get(CONF_STATE_CLASS, None)
|
||||
|
||||
value_template: Template | None = None
|
||||
if template is not None:
|
||||
|
@ -122,8 +124,8 @@ async def async_setup_entry(
|
|||
entry.entry_id,
|
||||
db_url,
|
||||
False,
|
||||
None,
|
||||
None,
|
||||
device_class,
|
||||
state_class,
|
||||
async_add_entities,
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue