mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 15:27:08 +00:00
Add unique id to mold_indicator setup from yaml (#126992)
This commit is contained in:
parent
e87542e091
commit
0b3d69aa8e
@ -20,6 +20,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
CONF_UNIQUE_ID,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
@ -64,6 +65,7 @@ PLATFORM_SCHEMA = SENSOR_PLATFORM_SCHEMA.extend(
|
|||||||
vol.Required(CONF_INDOOR_HUMIDITY): cv.entity_id,
|
vol.Required(CONF_INDOOR_HUMIDITY): cv.entity_id,
|
||||||
vol.Optional(CONF_CALIBRATION_FACTOR): vol.Coerce(float),
|
vol.Optional(CONF_CALIBRATION_FACTOR): vol.Coerce(float),
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||||
|
vol.Optional(CONF_UNIQUE_ID): cv.string,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -80,6 +82,7 @@ async def async_setup_platform(
|
|||||||
outdoor_temp_sensor: str = config[CONF_OUTDOOR_TEMP]
|
outdoor_temp_sensor: str = config[CONF_OUTDOOR_TEMP]
|
||||||
indoor_humidity_sensor: str = config[CONF_INDOOR_HUMIDITY]
|
indoor_humidity_sensor: str = config[CONF_INDOOR_HUMIDITY]
|
||||||
calib_factor: float = config[CONF_CALIBRATION_FACTOR]
|
calib_factor: float = config[CONF_CALIBRATION_FACTOR]
|
||||||
|
unique_id: str | None = config.get(CONF_UNIQUE_ID)
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[
|
[
|
||||||
@ -91,7 +94,7 @@ async def async_setup_platform(
|
|||||||
outdoor_temp_sensor,
|
outdoor_temp_sensor,
|
||||||
indoor_humidity_sensor,
|
indoor_humidity_sensor,
|
||||||
calib_factor,
|
calib_factor,
|
||||||
None,
|
unique_id,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
False,
|
False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user