Co-authored-by: Jean-Marc Collin <jean-marc.collin-extern@renault.com>
This commit is contained in:
@@ -39,6 +39,7 @@ from .const import (
|
|||||||
CONF_USE_WINDOW_FEATURE,
|
CONF_USE_WINDOW_FEATURE,
|
||||||
CONF_THERMOSTAT_TYPE,
|
CONF_THERMOSTAT_TYPE,
|
||||||
CONF_THERMOSTAT_CENTRAL_CONFIG,
|
CONF_THERMOSTAT_CENTRAL_CONFIG,
|
||||||
|
CONF_USE_CENTRAL_BOILER_FEATURE,
|
||||||
CONF_CENTRAL_BOILER_ACTIVATION_SRV,
|
CONF_CENTRAL_BOILER_ACTIVATION_SRV,
|
||||||
CONF_CENTRAL_BOILER_DEACTIVATION_SRV,
|
CONF_CENTRAL_BOILER_DEACTIVATION_SRV,
|
||||||
overrides,
|
overrides,
|
||||||
@@ -63,10 +64,13 @@ async def async_setup_entry(
|
|||||||
name = entry.data.get(CONF_NAME)
|
name = entry.data.get(CONF_NAME)
|
||||||
vt_type = entry.data.get(CONF_THERMOSTAT_TYPE)
|
vt_type = entry.data.get(CONF_THERMOSTAT_TYPE)
|
||||||
|
|
||||||
|
entities = None
|
||||||
|
|
||||||
if vt_type == CONF_THERMOSTAT_CENTRAL_CONFIG:
|
if vt_type == CONF_THERMOSTAT_CENTRAL_CONFIG:
|
||||||
entities = [
|
if entry.data.get(CONF_USE_CENTRAL_BOILER_FEATURE):
|
||||||
CentralBoilerBinarySensor(hass, unique_id, name, entry.data),
|
entities = [
|
||||||
]
|
CentralBoilerBinarySensor(hass, unique_id, name, entry.data),
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
entities = [
|
entities = [
|
||||||
SecurityBinarySensor(hass, unique_id, name, entry.data),
|
SecurityBinarySensor(hass, unique_id, name, entry.data),
|
||||||
@@ -81,7 +85,8 @@ async def async_setup_entry(
|
|||||||
if entry.data.get(CONF_USE_POWER_FEATURE):
|
if entry.data.get(CONF_USE_POWER_FEATURE):
|
||||||
entities.append(OverpoweringBinarySensor(hass, unique_id, name, entry.data))
|
entities.append(OverpoweringBinarySensor(hass, unique_id, name, entry.data))
|
||||||
|
|
||||||
async_add_entities(entities, True)
|
if entities:
|
||||||
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class SecurityBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity):
|
class SecurityBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity):
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ from .const import (
|
|||||||
CONF_USE_PRESETS_CENTRAL_CONFIG,
|
CONF_USE_PRESETS_CENTRAL_CONFIG,
|
||||||
CONF_USE_PRESENCE_CENTRAL_CONFIG,
|
CONF_USE_PRESENCE_CENTRAL_CONFIG,
|
||||||
CONF_USE_PRESENCE_FEATURE,
|
CONF_USE_PRESENCE_FEATURE,
|
||||||
|
CONF_USE_CENTRAL_BOILER_FEATURE,
|
||||||
overrides,
|
overrides,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -153,9 +154,10 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
# For central config only
|
# For central config only
|
||||||
else:
|
else:
|
||||||
entities.append(
|
if entry.data.get(CONF_USE_CENTRAL_BOILER_FEATURE):
|
||||||
ActivateBoilerThresholdNumber(hass, unique_id, name, entry.data)
|
entities.append(
|
||||||
)
|
ActivateBoilerThresholdNumber(hass, unique_id, name, entry.data)
|
||||||
|
)
|
||||||
for preset in CONF_PRESETS_WITH_AC_VALUES:
|
for preset in CONF_PRESETS_WITH_AC_VALUES:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"%s - configuring Number central, AC, non AWAY for preset %s",
|
"%s - configuring Number central, AC, non AWAY for preset %s",
|
||||||
@@ -178,7 +180,8 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
async_add_entities(entities, True)
|
if len(entities) > 0:
|
||||||
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class ActivateBoilerThresholdNumber(
|
class ActivateBoilerThresholdNumber(
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ async def async_setup_entry(
|
|||||||
entities = [
|
entities = [
|
||||||
NbActiveDeviceForBoilerSensor(hass, unique_id, name, entry.data)
|
NbActiveDeviceForBoilerSensor(hass, unique_id, name, entry.data)
|
||||||
]
|
]
|
||||||
async_add_entities(entities, True)
|
|
||||||
else:
|
else:
|
||||||
entities = [
|
entities = [
|
||||||
LastTemperatureSensor(hass, unique_id, name, entry.data),
|
LastTemperatureSensor(hass, unique_id, name, entry.data),
|
||||||
@@ -108,6 +107,7 @@ async def async_setup_entry(
|
|||||||
RegulatedTemperatureSensor(hass, unique_id, name, entry.data)
|
RegulatedTemperatureSensor(hass, unique_id, name, entry.data)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if entities:
|
||||||
async_add_entities(entities, True)
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user