mirror of
https://github.com/home-assistant/core.git
synced 2025-12-23 00:08:50 +00:00
Compare commits
3 Commits
dev
...
window_cov
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
550597310d | ||
|
|
6f11e612d2 | ||
|
|
efc2f7fe34 |
@@ -52,6 +52,34 @@ class MatterCommandButton(MatterEntity, ButtonEntity):
|
|||||||
await self.send_device_command(self.entity_description.command())
|
await self.send_device_command(self.entity_description.command())
|
||||||
|
|
||||||
|
|
||||||
|
class WindowCoveringCalibrationModeButton(MatterEntity, ButtonEntity):
|
||||||
|
"""Button to set WindowCovering calibration mode bit to 1."""
|
||||||
|
|
||||||
|
async def async_press(self) -> None:
|
||||||
|
"""Enable calibration mode by setting the CalibrationMode bit (bit 1)."""
|
||||||
|
# Prefer the defined bitmap constant; fallback to 0x2 (bit 1)
|
||||||
|
mode_bitmap = getattr(clusters.WindowCovering.Bitmaps, "Mode", None)
|
||||||
|
calibration_bit_obj = (
|
||||||
|
getattr(mode_bitmap, "kCalibrationMode", None)
|
||||||
|
if mode_bitmap is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
calibration_bit = (
|
||||||
|
int(calibration_bit_obj) if calibration_bit_obj is not None else 0x2
|
||||||
|
)
|
||||||
|
|
||||||
|
current_mode = self.get_matter_attribute_value(
|
||||||
|
clusters.WindowCovering.Attributes.Mode
|
||||||
|
)
|
||||||
|
|
||||||
|
if not isinstance(current_mode, int):
|
||||||
|
current_mode = 0
|
||||||
|
|
||||||
|
new_mode = current_mode | calibration_bit
|
||||||
|
|
||||||
|
await self.write_attribute(new_mode, clusters.WindowCovering.Attributes.Mode)
|
||||||
|
|
||||||
|
|
||||||
# Discovery schema(s) to map Matter Attributes to HA entities
|
# Discovery schema(s) to map Matter Attributes to HA entities
|
||||||
DISCOVERY_SCHEMAS = [
|
DISCOVERY_SCHEMAS = [
|
||||||
MatterDiscoverySchema(
|
MatterDiscoverySchema(
|
||||||
@@ -155,6 +183,16 @@ DISCOVERY_SCHEMAS = [
|
|||||||
required_attributes=(clusters.SmokeCoAlarm.Attributes.AcceptedCommandList,),
|
required_attributes=(clusters.SmokeCoAlarm.Attributes.AcceptedCommandList,),
|
||||||
value_contains=clusters.SmokeCoAlarm.Commands.SelfTestRequest.command_id,
|
value_contains=clusters.SmokeCoAlarm.Commands.SelfTestRequest.command_id,
|
||||||
),
|
),
|
||||||
|
MatterDiscoverySchema(
|
||||||
|
platform=Platform.BUTTON,
|
||||||
|
entity_description=MatterButtonEntityDescription(
|
||||||
|
key="WindowCoveringCalibrationMode",
|
||||||
|
translation_key="calibration_mode",
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
),
|
||||||
|
entity_class=WindowCoveringCalibrationModeButton,
|
||||||
|
required_attributes=(clusters.WindowCovering.Attributes.Mode,),
|
||||||
|
),
|
||||||
MatterDiscoverySchema(
|
MatterDiscoverySchema(
|
||||||
platform=Platform.BUTTON,
|
platform=Platform.BUTTON,
|
||||||
entity_description=MatterButtonEntityDescription(
|
entity_description=MatterButtonEntityDescription(
|
||||||
|
|||||||
@@ -115,6 +115,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
|
"calibration_mode": {
|
||||||
|
"name": "Calibration mode"
|
||||||
|
},
|
||||||
"cancel_boost": {
|
"cancel_boost": {
|
||||||
"name": "Cancel boost"
|
"name": "Cancel boost"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1369,6 +1369,54 @@
|
|||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_buttons[eve_shutter][button.eve_shutter_switch_20eci1701_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.eve_shutter_switch_20eci1701_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-0000000000000094-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[eve_shutter][button.eve_shutter_switch_20eci1701_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Eve Shutter Switch 20ECI1701 Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.eve_shutter_switch_20eci1701_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_buttons[eve_shutter][button.eve_shutter_switch_20eci1701_identify-entry]
|
# name: test_buttons[eve_shutter][button.eve_shutter_switch_20eci1701_identify-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@@ -3849,6 +3897,150 @@
|
|||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_buttons[window_covering_full][button.mock_full_window_covering_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.mock_full_window_covering_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-0000000000000032-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_full][button.mock_full_window_covering_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Mock Full Window Covering Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.mock_full_window_covering_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_lift][button.mock_lift_window_covering_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.mock_lift_window_covering_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-0000000000000032-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_lift][button.mock_lift_window_covering_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Mock Lift Window Covering Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.mock_lift_window_covering_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_pa_lift][button.longan_link_wncv_da01_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.longan_link_wncv_da01_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-0000000000000001-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_pa_lift][button.longan_link_wncv_da01_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Longan link WNCV DA01 Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.longan_link_wncv_da01_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_buttons[window_covering_pa_lift][button.longan_link_wncv_da01_identify-entry]
|
# name: test_buttons[window_covering_pa_lift][button.longan_link_wncv_da01_identify-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@@ -3898,6 +4090,102 @@
|
|||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_buttons[window_covering_pa_tilt][button.mock_pa_tilt_window_covering_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.mock_pa_tilt_window_covering_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-0000000000000032-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_pa_tilt][button.mock_pa_tilt_window_covering_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Mock PA Tilt Window Covering Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.mock_pa_tilt_window_covering_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_tilt][button.mock_tilt_window_covering_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.mock_tilt_window_covering_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-0000000000000032-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[window_covering_tilt][button.mock_tilt_window_covering_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Mock Tilt Window Covering Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.mock_tilt_window_covering_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
# name: test_buttons[yandex_smart_socket][button.yndx_00540_identify-entry]
|
# name: test_buttons[yandex_smart_socket][button.yndx_00540_identify-entry]
|
||||||
EntityRegistryEntrySnapshot({
|
EntityRegistryEntrySnapshot({
|
||||||
'aliases': set({
|
'aliases': set({
|
||||||
@@ -3947,3 +4235,51 @@
|
|||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_buttons[zemismart_mt25b][button.zemismart_mt25b_roller_motor_calibration_mode-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'config_subentry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'button',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'button.zemismart_mt25b_roller_motor_calibration_mode',
|
||||||
|
'has_entity_name': True,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Calibration mode',
|
||||||
|
'platform': 'matter',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'suggested_object_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': 'calibration_mode',
|
||||||
|
'unique_id': '00000000000004D2-000000000000007A-MatterNodeDevice-1-WindowCoveringCalibrationMode-258-23',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_buttons[zemismart_mt25b][button.zemismart_mt25b_roller_motor_calibration_mode-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Zemismart MT25B Roller Motor Calibration mode',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'button.zemismart_mt25b_roller_motor_calibration_mode',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
|||||||
Reference in New Issue
Block a user