Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions homeassistant/components/matter/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,59 @@ def _update_from_device(self) -> None:
required_attributes=(clusters.DishwasherAlarm.Attributes.State,),
allow_multi=True,
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
key="ValveConfigurationAndControlValveFault_GeneralFault",
translation_key="valve_fault_general_fault",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
device_to_ha=lambda x: (
x
== clusters.ValveConfigurationAndControl.Bitmaps.ValveFaultBitmap.kGeneralFault
),
),
entity_class=MatterBinarySensor,
required_attributes=(
clusters.ValveConfigurationAndControl.Attributes.ValveFault,
),
allow_multi=True,
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
key="ValveConfigurationAndControlValveFault_Blocked",
translation_key="valve_fault_blocked",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
device_to_ha=lambda x: (
x
== clusters.ValveConfigurationAndControl.Bitmaps.ValveFaultBitmap.kBlocked
),
),
entity_class=MatterBinarySensor,
required_attributes=(
clusters.ValveConfigurationAndControl.Attributes.ValveFault,
),
allow_multi=True,
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
key="ValveConfigurationAndControlValveFault_Leaking",
translation_key="valve_fault_leaking",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
device_to_ha=lambda x: (
x
== clusters.ValveConfigurationAndControl.Bitmaps.ValveFaultBitmap.kLeaking
),
),
entity_class=MatterBinarySensor,
required_attributes=(
clusters.ValveConfigurationAndControl.Attributes.ValveFault,
),
),
MatterDiscoverySchema(
platform=Platform.BINARY_SENSOR,
entity_description=MatterBinarySensorEntityDescription(
Expand Down
17 changes: 17 additions & 0 deletions homeassistant/components/matter/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,23 @@ def _update_from_device(self) -> None:
clusters.OccupancySensing.Attributes.PIROccupiedToUnoccupiedDelay,
),
),
MatterDiscoverySchema(
platform=Platform.NUMBER,
entity_description=MatterNumberEntityDescription(
key="ValveConfigurationAndControlDefaultOpenDuration",
entity_category=EntityCategory.CONFIG,
translation_key="valve_configuration_and_control_default_open_duration",
native_max_value=65534,
native_min_value=1,
native_unit_of_measurement=UnitOfTime.SECONDS,
mode=NumberMode.BOX,
),
entity_class=MatterNumber,
required_attributes=(
clusters.ValveConfigurationAndControl.Attributes.DefaultOpenDuration,
),
allow_multi=True,
),
MatterDiscoverySchema(
platform=Platform.NUMBER,
entity_description=MatterRangeNumberEntityDescription(
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/matter/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,4 +1370,19 @@ def _update_from_device(self) -> None:
entity_class=MatterSensor,
required_attributes=(clusters.PumpConfigurationAndControl.Attributes.Speed,),
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="ValveConfigurationAndControlAutoCloseTime",
translation_key="auto_close_time",
device_class=SensorDeviceClass.TIMESTAMP,
state_class=None,
device_to_ha=(lambda x: dt_util.utc_from_timestamp(x) if x > 0 else None),
),
entity_class=MatterSensor,
featuremap_contains=clusters.ValveConfigurationAndControl.Bitmaps.Feature.kTimeSync,
required_attributes=(
clusters.ValveConfigurationAndControl.Attributes.AutoCloseTime,
),
),
]
15 changes: 15 additions & 0 deletions homeassistant/components/matter/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
},
"alarm_door": {
"name": "Door alarm"
},
"valve_fault_blocked": {
"name": "Valve blocked"
},
"valve_fault_general_fault": {
"name": "General fault"
},
"valve_fault_leaking": {
"name": "Valve leaking"
}
},
"button": {
Expand Down Expand Up @@ -206,6 +215,9 @@
},
"led_indicator_intensity_on": {
"name": "LED on intensity"
},
"valve_configuration_and_control_default_open_duration": {
"name": "Default open duration"
}
},
"light": {
Expand Down Expand Up @@ -292,6 +304,9 @@
"activated_carbon_filter_condition": {
"name": "Activated carbon filter condition"
},
"auto_close_time": {
"name": "Auto-close time"
},
"contamination_state": {
"name": "Contamination state",
"state": {
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/matter/valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from .models import MatterDiscoverySchema

ValveConfigurationAndControl = clusters.ValveConfigurationAndControl

ValveStateEnum = ValveConfigurationAndControl.Enums.ValveStateEnum


Expand Down
106 changes: 106 additions & 0 deletions homeassistant/components/mqtt/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
CONF_CERTIFICATE,
CONF_CLIENT_CERT,
CONF_CLIENT_KEY,
CONF_CODE_FORMAT,
CONF_COLOR_MODE_STATE_TOPIC,
CONF_COLOR_MODE_VALUE_TEMPLATE,
CONF_COLOR_TEMP_COMMAND_TEMPLATE,
Expand Down Expand Up @@ -217,15 +218,18 @@
CONF_OSCILLATION_VALUE_TEMPLATE,
CONF_PAYLOAD_AVAILABLE,
CONF_PAYLOAD_CLOSE,
CONF_PAYLOAD_LOCK,
CONF_PAYLOAD_NOT_AVAILABLE,
CONF_PAYLOAD_OPEN,
CONF_PAYLOAD_OSCILLATION_OFF,
CONF_PAYLOAD_OSCILLATION_ON,
CONF_PAYLOAD_PRESS,
CONF_PAYLOAD_RESET,
CONF_PAYLOAD_RESET_PERCENTAGE,
CONF_PAYLOAD_RESET_PRESET_MODE,
CONF_PAYLOAD_STOP,
CONF_PAYLOAD_STOP_TILT,
CONF_PAYLOAD_UNLOCK,
CONF_PERCENTAGE_COMMAND_TEMPLATE,
CONF_PERCENTAGE_COMMAND_TOPIC,
CONF_PERCENTAGE_STATE_TOPIC,
Expand Down Expand Up @@ -262,12 +266,17 @@
CONF_SPEED_RANGE_MIN,
CONF_STATE_CLOSED,
CONF_STATE_CLOSING,
CONF_STATE_JAMMED,
CONF_STATE_LOCKED,
CONF_STATE_LOCKING,
CONF_STATE_OFF,
CONF_STATE_ON,
CONF_STATE_OPEN,
CONF_STATE_OPENING,
CONF_STATE_STOPPED,
CONF_STATE_TOPIC,
CONF_STATE_UNLOCKED,
CONF_STATE_UNLOCKING,
CONF_STATE_VALUE_TEMPLATE,
CONF_SUGGESTED_DISPLAY_PRECISION,
CONF_SUPPORTED_COLOR_MODES,
Expand Down Expand Up @@ -328,6 +337,7 @@
DEFAULT_ON_COMMAND_TYPE,
DEFAULT_PAYLOAD_AVAILABLE,
DEFAULT_PAYLOAD_CLOSE,
DEFAULT_PAYLOAD_LOCK,
DEFAULT_PAYLOAD_NOT_AVAILABLE,
DEFAULT_PAYLOAD_OFF,
DEFAULT_PAYLOAD_ON,
Expand All @@ -337,6 +347,7 @@
DEFAULT_PAYLOAD_PRESS,
DEFAULT_PAYLOAD_RESET,
DEFAULT_PAYLOAD_STOP,
DEFAULT_PAYLOAD_UNLOCK,
DEFAULT_PORT,
DEFAULT_POSITION_CLOSED,
DEFAULT_POSITION_OPEN,
Expand All @@ -345,7 +356,12 @@
DEFAULT_QOS,
DEFAULT_SPEED_RANGE_MAX,
DEFAULT_SPEED_RANGE_MIN,
DEFAULT_STATE_JAMMED,
DEFAULT_STATE_LOCKED,
DEFAULT_STATE_LOCKING,
DEFAULT_STATE_STOPPED,
DEFAULT_STATE_UNLOCKED,
DEFAULT_STATE_UNLOCKING,
DEFAULT_TILT_CLOSED_POSITION,
DEFAULT_TILT_MAX,
DEFAULT_TILT_MIN,
Expand Down Expand Up @@ -458,6 +474,7 @@
Platform.COVER,
Platform.FAN,
Platform.LIGHT,
Platform.LOCK,
Platform.NOTIFY,
Platform.SENSOR,
Platform.SWITCH,
Expand Down Expand Up @@ -1148,6 +1165,7 @@ def validate_light_platform_config(user_data: dict[str, Any]) -> dict[str, str]:
is_schema_default=True,
),
},
Platform.LOCK.value: {},
}
PLATFORM_MQTT_FIELDS: dict[str, dict[str, PlatformField]] = {
Platform.BINARY_SENSOR.value: {
Expand Down Expand Up @@ -2664,6 +2682,93 @@ def validate_light_platform_config(user_data: dict[str, Any]) -> dict[str, str]:
section="advanced_settings",
),
},
Platform.LOCK.value: {
CONF_COMMAND_TOPIC: PlatformField(
selector=TEXT_SELECTOR,
required=True,
validator=valid_publish_topic,
error="invalid_publish_topic",
),
CONF_COMMAND_TEMPLATE: PlatformField(
selector=TEMPLATE_SELECTOR,
required=False,
validator=validate(cv.template),
error="invalid_template",
),
CONF_STATE_TOPIC: PlatformField(
selector=TEXT_SELECTOR,
required=False,
validator=valid_subscribe_topic,
error="invalid_subscribe_topic",
),
CONF_VALUE_TEMPLATE: PlatformField(
selector=TEMPLATE_SELECTOR,
required=False,
validator=validate(cv.template),
error="invalid_template",
),
CONF_CODE_FORMAT: PlatformField(
selector=TEXT_SELECTOR,
required=False,
validator=validate(cv.is_regex),
error="invalid_regular_expression",
),
CONF_PAYLOAD_LOCK: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_PAYLOAD_LOCK,
section="lock_payload_settings",
),
CONF_PAYLOAD_UNLOCK: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_PAYLOAD_UNLOCK,
section="lock_payload_settings",
),
CONF_PAYLOAD_OPEN: PlatformField(
selector=TEXT_SELECTOR,
required=False,
section="lock_payload_settings",
),
CONF_PAYLOAD_RESET: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_PAYLOAD_RESET,
section="lock_payload_settings",
),
CONF_STATE_LOCKED: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_STATE_LOCKED,
section="lock_payload_settings",
),
CONF_STATE_UNLOCKED: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_STATE_UNLOCKED,
section="lock_payload_settings",
),
CONF_STATE_LOCKING: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_STATE_LOCKING,
section="lock_payload_settings",
),
CONF_STATE_UNLOCKING: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_STATE_UNLOCKING,
section="lock_payload_settings",
),
CONF_STATE_JAMMED: PlatformField(
selector=TEXT_SELECTOR,
required=False,
default=DEFAULT_STATE_JAMMED,
section="lock_payload_settings",
),
CONF_RETAIN: PlatformField(selector=BOOLEAN_SELECTOR, required=False),
CONF_OPTIMISTIC: PlatformField(selector=BOOLEAN_SELECTOR, required=False),
},
}
ENTITY_CONFIG_VALIDATOR: dict[
str,
Expand All @@ -2675,6 +2780,7 @@ def validate_light_platform_config(user_data: dict[str, Any]) -> dict[str, str]:
Platform.COVER.value: validate_cover_platform_config,
Platform.FAN.value: validate_fan_platform_config,
Platform.LIGHT.value: validate_light_platform_config,
Platform.LOCK.value: None,
Platform.NOTIFY.value: None,
Platform.SENSOR.value: validate_sensor_platform_config,
Platform.SWITCH.value: None,
Expand Down
Loading
Loading