Allow selecting of counter entities in derivative/integration config flow (#105321)

This commit is contained in:
SLaks 2024-01-05 10:46:12 -05:00 committed by GitHub
parent be6cf7d3ae
commit 9be9bbad61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -6,6 +6,7 @@ from typing import Any, cast
import voluptuous as vol
from homeassistant.components.counter import DOMAIN as COUNTER_DOMAIN
from homeassistant.components.input_number import DOMAIN as INPUT_NUMBER_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import CONF_NAME, CONF_SOURCE, UnitOfTime
@ -66,7 +67,9 @@ CONFIG_SCHEMA = vol.Schema(
{
vol.Required(CONF_NAME): selector.TextSelector(),
vol.Required(CONF_SOURCE): selector.EntitySelector(
selector.EntitySelectorConfig(domain=[INPUT_NUMBER_DOMAIN, SENSOR_DOMAIN]),
selector.EntitySelectorConfig(
domain=[COUNTER_DOMAIN, INPUT_NUMBER_DOMAIN, SENSOR_DOMAIN]
),
),
}
).extend(OPTIONS_SCHEMA.schema)

View File

@ -1,6 +1,7 @@
{
"domain": "derivative",
"name": "Derivative",
"after_dependencies": ["counter"],
"codeowners": ["@afaucogney"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/derivative",

View File

@ -6,6 +6,7 @@ from typing import Any, cast
import voluptuous as vol
from homeassistant.components.counter import DOMAIN as COUNTER_DOMAIN
from homeassistant.components.input_number import DOMAIN as INPUT_NUMBER_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import CONF_METHOD, CONF_NAME, UnitOfTime
@ -58,7 +59,9 @@ CONFIG_SCHEMA = vol.Schema(
{
vol.Required(CONF_NAME): selector.TextSelector(),
vol.Required(CONF_SOURCE_SENSOR): selector.EntitySelector(
selector.EntitySelectorConfig(domain=[INPUT_NUMBER_DOMAIN, SENSOR_DOMAIN])
selector.EntitySelectorConfig(
domain=[COUNTER_DOMAIN, INPUT_NUMBER_DOMAIN, SENSOR_DOMAIN]
),
),
vol.Required(CONF_METHOD, default=METHOD_TRAPEZOIDAL): selector.SelectSelector(
selector.SelectSelectorConfig(

View File

@ -1,6 +1,7 @@
{
"domain": "integration",
"name": "Integration - Riemann sum integral",
"after_dependencies": ["counter"],
"codeowners": ["@dgomes"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/integration",