ha-core/homeassistant
Faidon Liambotis 9fdad592c2
Add option to disable MQTT Alarm Control Panel supported features (#98363)
* Make MQTT Alarm Control Panel features conditional

The MQTT Alarm Control Panel currently enables all features (arm home,
arm away, arm night, arm vacation, arm custom bypass) unconditionally.
This clutters the interface and can even be potentially dangerous, by
enabling modes that the remote alarm may not support.

Make all the features conditional, by adding a new "supported_features"
configuration option, comprising a list of the supported features as
options. Feature enablement seems inconsistent across the MQTT
component; this implementation is most alike to the Humidifier modes
option, but using a generic "supported_features" name that other
implementations may reuse in the future.

The default value of this new setting remains to be all features, which
while it may be overly expansive, is necessary to maintain backwards
compatibility.

* Apply suggestions from code review

* Use vol.Optional() instead of vol.Required() for "supported_features".
* Move the initialization of _attr_supported_features to _setup_from_config.

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* Apply suggestions from emontnemery's code review

* Use vol.In() instead of cv.multi_seelct()
* Remove superfluous _attr_supported_features initializers, already
  present in the base class.

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Add invalid config tests for the MQTT Alarm Control Panel

* Set expected_features to None in the invalid MQTT Alarm Control Panel tests

* Add another expected_features=None in the invalid tests

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-08-18 08:23:48 +02:00
..
auth
backports Relax typing on cached_property to accept subclasses (#95407) 2023-07-23 20:47:29 -05:00
brands Remove the virtual integration for ultraloq (#96355) 2023-07-17 11:49:42 +02:00
components Add option to disable MQTT Alarm Control Panel supported features (#98363) 2023-08-18 08:23:48 +02:00
generated Change discovergy integration type (#97391) 2023-08-05 22:47:04 +02:00
helpers Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
scripts Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
util Add types-Pillow dependency (#98266) 2023-08-13 11:57:46 -05:00
__init__.py
__main__.py
block_async_io.py
bootstrap.py Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
config.py Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
config_entries.py Reduce overhead to start a config entry flow by optimizing fetching the handler (#97883) 2023-08-06 20:25:03 -10:00
const.py Add wake word integration (#96380) 2023-08-07 22:22:16 -04:00
core.py Log events with no listeners (#98540) 2023-08-16 20:14:49 +02:00
data_entry_flow.py Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
exceptions.py Move device info validation to device registry (#96465) 2023-07-14 08:55:17 -04:00
loader.py Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
package_constraints.txt Bump zeroconf to 0.80.0 (#98416) 2023-08-16 12:03:40 +02:00
requirements.py Replace deprecated pkg_resources with importlib.metadata (#97628) 2023-08-03 09:14:00 +02:00
runner.py Decrease event loop latency by binding time.monotonic to loop.time directly (#98288) 2023-08-13 20:37:45 -04:00
setup.py
strings.json Add more common translations (#96429) 2023-07-12 22:00:05 -04:00