Improve lists in integrations [I-K] (#113221)
This commit is contained in:
parent
dbb07c98e2
commit
7e0aac3feb
21 changed files with 136 additions and 143 deletions
|
@ -25,10 +25,10 @@ async def async_setup_entry(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up discovered binary sensors."""
|
"""Set up discovered binary sensors."""
|
||||||
devs = []
|
async_add_entities(
|
||||||
for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]:
|
(HassAqualinkBinarySensor(dev) for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]),
|
||||||
devs.append(HassAqualinkBinarySensor(dev))
|
True,
|
||||||
async_add_entities(devs, True)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorEntity):
|
class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorEntity):
|
||||||
|
|
|
@ -33,10 +33,13 @@ async def async_setup_entry(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up discovered switches."""
|
"""Set up discovered switches."""
|
||||||
devs = []
|
async_add_entities(
|
||||||
for dev in hass.data[AQUALINK_DOMAIN][CLIMATE_DOMAIN]:
|
(
|
||||||
devs.append(HassAqualinkThermostat(dev))
|
HassAqualinkThermostat(dev)
|
||||||
async_add_entities(devs, True)
|
for dev in hass.data[AQUALINK_DOMAIN][CLIMATE_DOMAIN]
|
||||||
|
),
|
||||||
|
True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkThermostat(AqualinkEntity, ClimateEntity):
|
class HassAqualinkThermostat(AqualinkEntity, ClimateEntity):
|
||||||
|
|
|
@ -31,10 +31,9 @@ async def async_setup_entry(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up discovered lights."""
|
"""Set up discovered lights."""
|
||||||
devs = []
|
async_add_entities(
|
||||||
for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]:
|
(HassAqualinkLight(dev) for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]), True
|
||||||
devs.append(HassAqualinkLight(dev))
|
)
|
||||||
async_add_entities(devs, True)
|
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkLight(AqualinkEntity, LightEntity):
|
class HassAqualinkLight(AqualinkEntity, LightEntity):
|
||||||
|
|
|
@ -22,10 +22,9 @@ async def async_setup_entry(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up discovered sensors."""
|
"""Set up discovered sensors."""
|
||||||
devs = []
|
async_add_entities(
|
||||||
for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]:
|
(HassAqualinkSensor(dev) for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]), True
|
||||||
devs.append(HassAqualinkSensor(dev))
|
)
|
||||||
async_add_entities(devs, True)
|
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkSensor(AqualinkEntity, SensorEntity):
|
class HassAqualinkSensor(AqualinkEntity, SensorEntity):
|
||||||
|
|
|
@ -24,10 +24,9 @@ async def async_setup_entry(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up discovered switches."""
|
"""Set up discovered switches."""
|
||||||
devs = []
|
async_add_entities(
|
||||||
for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]:
|
(HassAqualinkSwitch(dev) for dev in hass.data[AQUALINK_DOMAIN][DOMAIN]), True
|
||||||
devs.append(HassAqualinkSwitch(dev))
|
)
|
||||||
async_add_entities(devs, True)
|
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkSwitch(AqualinkEntity, SwitchEntity):
|
class HassAqualinkSwitch(AqualinkEntity, SwitchEntity):
|
||||||
|
|
|
@ -319,11 +319,12 @@ class IcloudAccount:
|
||||||
|
|
||||||
def get_devices_with_name(self, name: str) -> list[Any]:
|
def get_devices_with_name(self, name: str) -> list[Any]:
|
||||||
"""Get devices by name."""
|
"""Get devices by name."""
|
||||||
result = []
|
|
||||||
name_slug = slugify(name.replace(" ", "", 99))
|
name_slug = slugify(name.replace(" ", "", 99))
|
||||||
for device in self.devices.values():
|
result = [
|
||||||
if slugify(device.name.replace(" ", "", 99)) == name_slug:
|
device
|
||||||
result.append(device)
|
for device in self.devices.values()
|
||||||
|
if slugify(device.name.replace(" ", "", 99)) == name_slug
|
||||||
|
]
|
||||||
if not result:
|
if not result:
|
||||||
raise ValueError(f"No device with name {name}")
|
raise ValueError(f"No device with name {name}")
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -84,10 +84,11 @@ def _remove_override(address, options):
|
||||||
new_options = {}
|
new_options = {}
|
||||||
if options.get(CONF_X10):
|
if options.get(CONF_X10):
|
||||||
new_options[CONF_X10] = options.get(CONF_X10)
|
new_options[CONF_X10] = options.get(CONF_X10)
|
||||||
new_overrides = []
|
new_overrides = [
|
||||||
for override in options[CONF_OVERRIDE]:
|
override
|
||||||
if override[CONF_ADDRESS] != address:
|
for override in options[CONF_OVERRIDE]
|
||||||
new_overrides.append(override)
|
if override[CONF_ADDRESS] != address
|
||||||
|
]
|
||||||
if new_overrides:
|
if new_overrides:
|
||||||
new_options[CONF_OVERRIDE] = new_overrides
|
new_options[CONF_OVERRIDE] = new_overrides
|
||||||
return new_options
|
return new_options
|
||||||
|
@ -100,13 +101,14 @@ def _remove_x10(device, options):
|
||||||
new_options = {}
|
new_options = {}
|
||||||
if options.get(CONF_OVERRIDE):
|
if options.get(CONF_OVERRIDE):
|
||||||
new_options[CONF_OVERRIDE] = options.get(CONF_OVERRIDE)
|
new_options[CONF_OVERRIDE] = options.get(CONF_OVERRIDE)
|
||||||
new_x10 = []
|
new_x10 = [
|
||||||
for existing_device in options[CONF_X10]:
|
existing_device
|
||||||
|
for existing_device in options[CONF_X10]
|
||||||
if (
|
if (
|
||||||
existing_device[CONF_HOUSECODE].lower() != housecode
|
existing_device[CONF_HOUSECODE].lower() != housecode
|
||||||
or existing_device[CONF_UNITCODE] != unitcode
|
or existing_device[CONF_UNITCODE] != unitcode
|
||||||
):
|
)
|
||||||
new_x10.append(existing_device)
|
]
|
||||||
if new_x10:
|
if new_x10:
|
||||||
new_options[CONF_X10] = new_x10
|
new_options[CONF_X10] = new_x10
|
||||||
return new_options, housecode, unitcode
|
return new_options, housecode, unitcode
|
||||||
|
|
|
@ -103,17 +103,18 @@ def add_device_override(config_data, new_override):
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
raise ValueError("Incorrect values") from err
|
raise ValueError("Incorrect values") from err
|
||||||
|
|
||||||
overrides = []
|
overrides = [
|
||||||
|
override
|
||||||
for override in config_data.get(CONF_OVERRIDE, []):
|
for override in config_data.get(CONF_OVERRIDE, [])
|
||||||
if override[CONF_ADDRESS] != address:
|
if override[CONF_ADDRESS] != address
|
||||||
overrides.append(override)
|
]
|
||||||
|
overrides.append(
|
||||||
curr_override = {}
|
{
|
||||||
curr_override[CONF_ADDRESS] = address
|
CONF_ADDRESS: address,
|
||||||
curr_override[CONF_CAT] = cat
|
CONF_CAT: cat,
|
||||||
curr_override[CONF_SUBCAT] = subcat
|
CONF_SUBCAT: subcat,
|
||||||
overrides.append(curr_override)
|
}
|
||||||
|
)
|
||||||
|
|
||||||
new_config = {}
|
new_config = {}
|
||||||
if config_data.get(CONF_X10):
|
if config_data.get(CONF_X10):
|
||||||
|
@ -124,21 +125,20 @@ def add_device_override(config_data, new_override):
|
||||||
|
|
||||||
def add_x10_device(config_data, new_x10):
|
def add_x10_device(config_data, new_x10):
|
||||||
"""Add a new X10 device to X10 device list."""
|
"""Add a new X10 device to X10 device list."""
|
||||||
x10_devices = []
|
x10_devices = [
|
||||||
for x10_device in config_data.get(CONF_X10, []):
|
x10_device
|
||||||
if (
|
for x10_device in config_data.get(CONF_X10, [])
|
||||||
x10_device[CONF_HOUSECODE] != new_x10[CONF_HOUSECODE]
|
if x10_device[CONF_HOUSECODE] != new_x10[CONF_HOUSECODE]
|
||||||
or x10_device[CONF_UNITCODE] != new_x10[CONF_UNITCODE]
|
or x10_device[CONF_UNITCODE] != new_x10[CONF_UNITCODE]
|
||||||
):
|
]
|
||||||
x10_devices.append(x10_device)
|
x10_devices.append(
|
||||||
|
{
|
||||||
curr_device = {}
|
CONF_HOUSECODE: new_x10[CONF_HOUSECODE],
|
||||||
curr_device[CONF_HOUSECODE] = new_x10[CONF_HOUSECODE]
|
CONF_UNITCODE: new_x10[CONF_UNITCODE],
|
||||||
curr_device[CONF_UNITCODE] = new_x10[CONF_UNITCODE]
|
CONF_PLATFORM: new_x10[CONF_PLATFORM],
|
||||||
curr_device[CONF_PLATFORM] = new_x10[CONF_PLATFORM]
|
CONF_DIM_STEPS: new_x10[CONF_DIM_STEPS],
|
||||||
curr_device[CONF_DIM_STEPS] = new_x10[CONF_DIM_STEPS]
|
}
|
||||||
x10_devices.append(curr_device)
|
)
|
||||||
|
|
||||||
new_config = {}
|
new_config = {}
|
||||||
if config_data.get(CONF_OVERRIDE):
|
if config_data.get(CONF_OVERRIDE):
|
||||||
new_config[CONF_OVERRIDE] = config_data[CONF_OVERRIDE]
|
new_config[CONF_OVERRIDE] = config_data[CONF_OVERRIDE]
|
||||||
|
@ -223,17 +223,14 @@ def build_hub_schema(
|
||||||
|
|
||||||
def build_remove_override_schema(data):
|
def build_remove_override_schema(data):
|
||||||
"""Build the schema to remove device overrides in config flow options."""
|
"""Build the schema to remove device overrides in config flow options."""
|
||||||
selection = []
|
selection = [override[CONF_ADDRESS] for override in data]
|
||||||
for override in data:
|
|
||||||
selection.append(override[CONF_ADDRESS])
|
|
||||||
return vol.Schema({vol.Required(CONF_ADDRESS): vol.In(selection)})
|
return vol.Schema({vol.Required(CONF_ADDRESS): vol.In(selection)})
|
||||||
|
|
||||||
|
|
||||||
def build_remove_x10_schema(data):
|
def build_remove_x10_schema(data):
|
||||||
"""Build the schema to remove an X10 device in config flow options."""
|
"""Build the schema to remove an X10 device in config flow options."""
|
||||||
selection = []
|
selection = [
|
||||||
for device in data:
|
f"Housecode: {device[CONF_HOUSECODE].upper()}, Unitcode: {device[CONF_UNITCODE]}"
|
||||||
housecode = device[CONF_HOUSECODE].upper()
|
for device in data
|
||||||
unitcode = device[CONF_UNITCODE]
|
]
|
||||||
selection.append(f"Housecode: {housecode}, Unitcode: {unitcode}")
|
|
||||||
return vol.Schema({vol.Required(CONF_DEVICE): vol.In(selection)})
|
return vol.Schema({vol.Required(CONF_DEVICE): vol.In(selection)})
|
||||||
|
|
|
@ -38,7 +38,15 @@ async def async_setup_entry(
|
||||||
ISYNodeQueryButtonEntity
|
ISYNodeQueryButtonEntity
|
||||||
| ISYNodeBeepButtonEntity
|
| ISYNodeBeepButtonEntity
|
||||||
| ISYNetworkResourceButtonEntity
|
| ISYNetworkResourceButtonEntity
|
||||||
] = []
|
] = [
|
||||||
|
ISYNetworkResourceButtonEntity(
|
||||||
|
node=node,
|
||||||
|
name=node.name,
|
||||||
|
unique_id=isy_data.uid_base(node),
|
||||||
|
device_info=device_info[CONF_NETWORK],
|
||||||
|
)
|
||||||
|
for node in isy_data.net_resources
|
||||||
|
]
|
||||||
|
|
||||||
for node in isy_data.root_nodes[Platform.BUTTON]:
|
for node in isy_data.root_nodes[Platform.BUTTON]:
|
||||||
entities.append(
|
entities.append(
|
||||||
|
@ -61,16 +69,6 @@ async def async_setup_entry(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for node in isy_data.net_resources:
|
|
||||||
entities.append(
|
|
||||||
ISYNetworkResourceButtonEntity(
|
|
||||||
node=node,
|
|
||||||
name=node.name,
|
|
||||||
unique_id=isy_data.uid_base(node),
|
|
||||||
device_info=device_info[CONF_NETWORK],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add entity to query full system
|
# Add entity to query full system
|
||||||
entities.append(
|
entities.append(
|
||||||
ISYNodeQueryButtonEntity(
|
ISYNodeQueryButtonEntity(
|
||||||
|
|
|
@ -64,14 +64,14 @@ async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the ISY thermostat platform."""
|
"""Set up the ISY thermostat platform."""
|
||||||
entities = []
|
|
||||||
|
|
||||||
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
||||||
devices: dict[str, DeviceInfo] = isy_data.devices
|
devices: dict[str, DeviceInfo] = isy_data.devices
|
||||||
for node in isy_data.nodes[Platform.CLIMATE]:
|
|
||||||
entities.append(ISYThermostatEntity(node, devices.get(node.primary_node)))
|
|
||||||
|
|
||||||
async_add_entities(entities)
|
async_add_entities(
|
||||||
|
ISYThermostatEntity(node, devices.get(node.primary_node))
|
||||||
|
for node in isy_data.nodes[Platform.CLIMATE]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ISYThermostatEntity(ISYNodeEntity, ClimateEntity):
|
class ISYThermostatEntity(ISYNodeEntity, ClimateEntity):
|
||||||
|
|
|
@ -27,13 +27,16 @@ async def async_setup_entry(
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the ISY cover platform."""
|
"""Set up the ISY cover platform."""
|
||||||
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
||||||
entities: list[ISYCoverEntity | ISYCoverProgramEntity] = []
|
|
||||||
devices: dict[str, DeviceInfo] = isy_data.devices
|
devices: dict[str, DeviceInfo] = isy_data.devices
|
||||||
for node in isy_data.nodes[Platform.COVER]:
|
entities: list[ISYCoverEntity | ISYCoverProgramEntity] = [
|
||||||
entities.append(ISYCoverEntity(node, devices.get(node.primary_node)))
|
ISYCoverEntity(node, devices.get(node.primary_node))
|
||||||
|
for node in isy_data.nodes[Platform.COVER]
|
||||||
|
]
|
||||||
|
|
||||||
for name, status, actions in isy_data.programs[Platform.COVER]:
|
entities.extend(
|
||||||
entities.append(ISYCoverProgramEntity(name, status, actions))
|
ISYCoverProgramEntity(name, status, actions)
|
||||||
|
for name, status, actions in isy_data.programs[Platform.COVER]
|
||||||
|
)
|
||||||
|
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,15 @@ async def async_setup_entry(
|
||||||
"""Set up the ISY fan platform."""
|
"""Set up the ISY fan platform."""
|
||||||
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
||||||
devices: dict[str, DeviceInfo] = isy_data.devices
|
devices: dict[str, DeviceInfo] = isy_data.devices
|
||||||
entities: list[ISYFanEntity | ISYFanProgramEntity] = []
|
entities: list[ISYFanEntity | ISYFanProgramEntity] = [
|
||||||
|
ISYFanEntity(node, devices.get(node.primary_node))
|
||||||
|
for node in isy_data.nodes[Platform.FAN]
|
||||||
|
]
|
||||||
|
|
||||||
for node in isy_data.nodes[Platform.FAN]:
|
entities.extend(
|
||||||
entities.append(ISYFanEntity(node, devices.get(node.primary_node)))
|
ISYFanProgramEntity(name, status, actions)
|
||||||
|
for name, status, actions in isy_data.programs[Platform.FAN]
|
||||||
for name, status, actions in isy_data.programs[Platform.FAN]:
|
)
|
||||||
entities.append(ISYFanProgramEntity(name, status, actions))
|
|
||||||
|
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,10 @@ async def async_setup_entry(
|
||||||
isy_options = entry.options
|
isy_options = entry.options
|
||||||
restore_light_state = isy_options.get(CONF_RESTORE_LIGHT_STATE, False)
|
restore_light_state = isy_options.get(CONF_RESTORE_LIGHT_STATE, False)
|
||||||
|
|
||||||
entities = []
|
async_add_entities(
|
||||||
for node in isy_data.nodes[Platform.LIGHT]:
|
ISYLightEntity(node, restore_light_state, devices.get(node.primary_node))
|
||||||
entities.append(
|
for node in isy_data.nodes[Platform.LIGHT]
|
||||||
ISYLightEntity(node, restore_light_state, devices.get(node.primary_node))
|
)
|
||||||
)
|
|
||||||
|
|
||||||
async_add_entities(entities)
|
|
||||||
|
|
||||||
|
|
||||||
class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
|
class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
|
||||||
|
|
|
@ -53,12 +53,15 @@ async def async_setup_entry(
|
||||||
"""Set up the ISY lock platform."""
|
"""Set up the ISY lock platform."""
|
||||||
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
|
||||||
devices: dict[str, DeviceInfo] = isy_data.devices
|
devices: dict[str, DeviceInfo] = isy_data.devices
|
||||||
entities: list[ISYLockEntity | ISYLockProgramEntity] = []
|
entities: list[ISYLockEntity | ISYLockProgramEntity] = [
|
||||||
for node in isy_data.nodes[Platform.LOCK]:
|
ISYLockEntity(node, devices.get(node.primary_node))
|
||||||
entities.append(ISYLockEntity(node, devices.get(node.primary_node)))
|
for node in isy_data.nodes[Platform.LOCK]
|
||||||
|
]
|
||||||
|
|
||||||
for name, status, actions in isy_data.programs[Platform.LOCK]:
|
entities.extend(
|
||||||
entities.append(ISYLockProgramEntity(name, status, actions))
|
ISYLockProgramEntity(name, status, actions)
|
||||||
|
for name, status, actions in isy_data.programs[Platform.LOCK]
|
||||||
|
)
|
||||||
|
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
async_setup_lock_services(hass)
|
async_setup_lock_services(hass)
|
||||||
|
|
|
@ -17,14 +17,13 @@ async def async_setup_entry(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the JuiceNet switches."""
|
"""Set up the JuiceNet switches."""
|
||||||
entities = []
|
|
||||||
juicenet_data = hass.data[DOMAIN][config_entry.entry_id]
|
juicenet_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
api = juicenet_data[JUICENET_API]
|
api = juicenet_data[JUICENET_API]
|
||||||
coordinator = juicenet_data[JUICENET_COORDINATOR]
|
coordinator = juicenet_data[JUICENET_COORDINATOR]
|
||||||
|
|
||||||
for device in api.devices:
|
async_add_entities(
|
||||||
entities.append(JuiceNetChargeNowSwitch(device, coordinator))
|
JuiceNetChargeNowSwitch(device, coordinator) for device in api.devices
|
||||||
async_add_entities(entities)
|
)
|
||||||
|
|
||||||
|
|
||||||
class JuiceNetChargeNowSwitch(JuiceNetDevice, SwitchEntity):
|
class JuiceNetChargeNowSwitch(JuiceNetDevice, SwitchEntity):
|
||||||
|
|
|
@ -204,10 +204,10 @@ class KNXClimate(KnxEntity, ClimateEntity):
|
||||||
"""Return the list of available operation/controller modes."""
|
"""Return the list of available operation/controller modes."""
|
||||||
ha_controller_modes: list[HVACMode | None] = []
|
ha_controller_modes: list[HVACMode | None] = []
|
||||||
if self._device.mode is not None:
|
if self._device.mode is not None:
|
||||||
for knx_controller_mode in self._device.mode.controller_modes:
|
ha_controller_modes.extend(
|
||||||
ha_controller_modes.append(
|
CONTROLLER_MODES.get(knx_controller_mode.value)
|
||||||
CONTROLLER_MODES.get(knx_controller_mode.value)
|
for knx_controller_mode in self._device.mode.controller_modes
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._device.supports_on_off:
|
if self._device.supports_on_off:
|
||||||
if not ha_controller_modes:
|
if not ha_controller_modes:
|
||||||
|
|
|
@ -597,17 +597,17 @@ class KNXCommonFlow(ABC, ConfigEntryBaseFlow):
|
||||||
value=CONF_KNX_AUTOMATIC, label=CONF_KNX_AUTOMATIC.capitalize()
|
value=CONF_KNX_AUTOMATIC, label=CONF_KNX_AUTOMATIC.capitalize()
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
for endpoint in self._tunnel_endpoints:
|
tunnel_endpoint_options.extend(
|
||||||
tunnel_endpoint_options.append(
|
selector.SelectOptionDict(
|
||||||
selector.SelectOptionDict(
|
value=str(endpoint.individual_address),
|
||||||
value=str(endpoint.individual_address),
|
label=(
|
||||||
label=(
|
f"{endpoint.individual_address} "
|
||||||
f"{endpoint.individual_address} "
|
f"{'🔐 ' if endpoint.user_id else ''}"
|
||||||
f"{'🔐 ' if endpoint.user_id else ''}"
|
f"(Data Secure GAs: {len(endpoint.group_addresses)})"
|
||||||
f"(Data Secure GAs: {len(endpoint.group_addresses)})"
|
),
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
for endpoint in self._tunnel_endpoints
|
||||||
|
)
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="knxkeys_tunnel_select",
|
step_id="knxkeys_tunnel_select",
|
||||||
data_schema=vol.Schema(
|
data_schema=vol.Schema(
|
||||||
|
|
|
@ -28,21 +28,16 @@ async def async_get_service(
|
||||||
if platform_config := hass.data[DATA_KNX_CONFIG].get(NotifySchema.PLATFORM):
|
if platform_config := hass.data[DATA_KNX_CONFIG].get(NotifySchema.PLATFORM):
|
||||||
xknx: XKNX = hass.data[DOMAIN].xknx
|
xknx: XKNX = hass.data[DOMAIN].xknx
|
||||||
|
|
||||||
notification_devices = []
|
notification_devices = [
|
||||||
for device_config in platform_config:
|
XknxNotification(
|
||||||
notification_devices.append(
|
xknx,
|
||||||
XknxNotification(
|
name=device_config[CONF_NAME],
|
||||||
xknx,
|
group_address=device_config[KNX_ADDRESS],
|
||||||
name=device_config[CONF_NAME],
|
value_type=device_config[CONF_TYPE],
|
||||||
group_address=device_config[KNX_ADDRESS],
|
|
||||||
value_type=device_config[CONF_TYPE],
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return (
|
for device_config in platform_config
|
||||||
KNXNotificationService(notification_devices)
|
]
|
||||||
if notification_devices
|
return KNXNotificationService(notification_devices)
|
||||||
else None
|
|
||||||
)
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -125,9 +125,7 @@ def _make_v2_resultset(*args):
|
||||||
|
|
||||||
def _make_v2_buckets_resultset():
|
def _make_v2_buckets_resultset():
|
||||||
"""Create a mock V2 'buckets()' resultset."""
|
"""Create a mock V2 'buckets()' resultset."""
|
||||||
records = []
|
records = [Record({"name": name}) for name in [DEFAULT_BUCKET, "bucket2"]]
|
||||||
for name in [DEFAULT_BUCKET, "bucket2"]:
|
|
||||||
records.append(Record({"name": name}))
|
|
||||||
|
|
||||||
return [Table(records)]
|
return [Table(records)]
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ DEVICES = []
|
||||||
|
|
||||||
def add_entities(devices):
|
def add_entities(devices):
|
||||||
"""Mock add devices."""
|
"""Mock add devices."""
|
||||||
for device in devices:
|
DEVICES.extend(devices)
|
||||||
DEVICES.append(device)
|
|
||||||
|
|
||||||
|
|
||||||
def test_service_call(hass: HomeAssistant) -> None:
|
def test_service_call(hass: HomeAssistant) -> None:
|
||||||
|
|
|
@ -14,8 +14,7 @@ DEVICES = []
|
||||||
|
|
||||||
def add_entities(devices):
|
def add_entities(devices):
|
||||||
"""Mock add devices."""
|
"""Mock add devices."""
|
||||||
for device in devices:
|
DEVICES.extend(devices)
|
||||||
DEVICES.append(device)
|
|
||||||
|
|
||||||
|
|
||||||
@patch("homeassistant.components.kira.sensor.KiraReceiver.schedule_update_ha_state")
|
@patch("homeassistant.components.kira.sensor.KiraReceiver.schedule_update_ha_state")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue