Add brightness step buttons for Overkiz RTS dimmable lights (#178797)

This commit is contained in:
Mick Vleeshouwer
2026-08-12 13:27:49 +03:00
committed by GitHub
parent 2bfade74c2
commit d0f1274573
6 changed files with 987 additions and 10 deletions
+20 -5
View File
@@ -24,7 +24,7 @@ from .entity import OverkizDescriptiveEntity
class OverkizButtonDescription(ButtonEntityDescription):
"""Class to describe an Overkiz button."""
press_args: OverkizStateType | None = None
press_args: list[OverkizStateType] | None = None
BUTTON_DESCRIPTIONS: list[OverkizButtonDescription] = [
@@ -74,7 +74,7 @@ BUTTON_DESCRIPTIONS: list[OverkizButtonDescription] = [
# DynamicScreen (ogp:blind) uses goToAlias (id 1: favorite1) instead of 'my'
OverkizButtonDescription(
key=OverkizCommand.GO_TO_ALIAS,
press_args="1",
press_args=["1"],
name="My position",
icon="mdi:star",
),
@@ -83,10 +83,25 @@ BUTTON_DESCRIPTIONS: list[OverkizButtonDescription] = [
name="Toggle",
icon="mdi:sync",
),
# DimmerOnOffLight (rts:DimmableLightRTSComponent)
OverkizButtonDescription(
key=OverkizCommand.STEP_POSITIVE,
name="Brightness up",
icon="mdi:brightness-7",
# step (0-127), execution duration (0-15, optional)
press_args=[5],
),
OverkizButtonDescription(
key=OverkizCommand.STEP_NEGATIVE,
name="Brightness down",
icon="mdi:brightness-3",
# step (0-127), execution duration (0-15, optional)
press_args=[5],
),
# SmokeSensor
OverkizButtonDescription(
key=OverkizCommand.CHECK_EVENT_TRIGGER,
press_args=OverkizCommandParam.SHORT,
press_args=[OverkizCommandParam.SHORT],
name="Test",
icon="mdi:smoke-detector",
entity_category=EntityCategory.DIAGNOSTIC,
@@ -138,9 +153,9 @@ class OverkizButton(OverkizDescriptiveEntity, ButtonEntity):
@override
async def async_press(self) -> None:
"""Handle the button press."""
if self.entity_description.press_args:
if (press_args := self.entity_description.press_args) is not None:
await self.executor.async_execute_command(
self.entity_description.key, self.entity_description.press_args
self.entity_description.key, *press_args
)
return
@@ -611,6 +611,97 @@
"type": 1,
"oid": "97f85fd1-53f7-4cdf-8c73-9b2c172dbd62",
"uiClass": "Generic"
},
{
"creationTime": 1613676730000,
"lastUpdateTime": 1613676730000,
"label": "LED Strip",
"deviceURL": "rts://1234-1234-6362/16752757",
"shortcut": false,
"controllableName": "rts:DimmableLightRTSComponent",
"definition": {
"commands": [
{
"commandName": "down",
"nparams": 1
},
{
"commandName": "identify",
"nparams": 0
},
{
"commandName": "my",
"nparams": 1
},
{
"commandName": "off",
"nparams": 0
},
{
"commandName": "on",
"nparams": 0
},
{
"commandName": "onWithTimer",
"nparams": 1
},
{
"commandName": "rest",
"nparams": 1
},
{
"commandName": "stop",
"nparams": 1
},
{
"commandName": "test",
"nparams": 0
},
{
"commandName": "up",
"nparams": 1
},
{
"commandName": "openConfiguration",
"nparams": 1
},
{
"commandName": "stepNegative",
"nparams": 2
},
{
"commandName": "stepPositive",
"nparams": 2
}
],
"states": [],
"dataProperties": [
{
"value": "0",
"qualifiedName": "core:identifyInterval"
}
],
"widgetName": "DimmerOnOffLight",
"uiProfiles": ["SwitchableLight", "Switchable", "UpDown"],
"uiClass": "Light",
"qualifiedName": "rts:DimmableLightRTSComponent",
"type": "ACTUATOR"
},
"states": [],
"attributes": [
{
"name": "rts:diy",
"type": 6,
"value": false
}
],
"available": true,
"enabled": true,
"placeOID": "6133b4a0-f514-4553-b635-d1b7beb7e7b2",
"widget": "DimmerOnOffLight",
"type": 1,
"oid": "1ebe282d-951d-4fb6-97a6-1ebfd2ff7f8f",
"uiClass": "Light"
}
],
"zones": [],
@@ -1793,6 +1793,786 @@
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_jaloezie_my_position-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_jaloezie_my_position',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'My position',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:star',
'original_name': 'My position',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16730044-my',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_jaloezie_my_position-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Jaloezie My position',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:star',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_jaloezie_my_position',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_jaloezie_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_jaloezie_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16730044-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_jaloezie_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Jaloezie Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_jaloezie_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_sheer_screen_my_position-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_kitchen_sheer_screen_my_position',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'My position',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:star',
'original_name': 'My position',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16753206-my',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_sheer_screen_my_position-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Kitchen Sheer Screen My position',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:star',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_kitchen_sheer_screen_my_position',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_sheer_screen_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_kitchen_sheer_screen_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16753206-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_sheer_screen_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Kitchen Sheer Screen Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_kitchen_sheer_screen_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_shutter_my_position-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_kitchen_shutter_my_position',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'My position',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:star',
'original_name': 'My position',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16749917-my',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_shutter_my_position-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Kitchen Shutter My position',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:star',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_kitchen_shutter_my_position',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_shutter_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_kitchen_shutter_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16749917-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_kitchen_shutter_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Kitchen Shutter Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_kitchen_shutter_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_brightness_down-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_led_strip_brightness_down',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Brightness down',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:brightness-3',
'original_name': 'Brightness down',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16752757-stepNegative',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_brightness_down-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Strip Brightness down',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:brightness-3',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_led_strip_brightness_down',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_brightness_up-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_led_strip_brightness_up',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Brightness up',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:brightness-7',
'original_name': 'Brightness up',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16752757-stepPositive',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_brightness_up-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Strip Brightness up',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:brightness-7',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_led_strip_brightness_up',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_my_position-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_led_strip_my_position',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'My position',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:star',
'original_name': 'My position',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16752757-my',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_my_position-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Strip My position',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:star',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_led_strip_my_position',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_led_strip_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16752757-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_led_strip_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Strip Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_led_strip_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_living_room_screen_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_living_room_screen_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16718220-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_living_room_screen_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Living Room Screen Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_living_room_screen_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_office_venetian_blind_my_position-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_office_venetian_blind_my_position',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'My position',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:star',
'original_name': 'My position',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16747291-my',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_office_venetian_blind_my_position-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Office Venetian Blind My position',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:star',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_office_venetian_blind_my_position',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_office_venetian_blind_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_office_venetian_blind_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16747291-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_office_venetian_blind_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Office Venetian Blind Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_office_venetian_blind_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_patio_shutter_my_position-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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': None,
'entity_id': 'button.palm_court_patio_shutter_my_position',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'My position',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:star',
'original_name': 'My position',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16730022-my',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_patio_shutter_my_position-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Patio Shutter My position',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:star',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_patio_shutter_my_position',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_patio_shutter_start_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'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.palm_court_patio_shutter_start_identify',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Start identify',
'options': dict({
}),
'original_device_class': None,
'original_icon': 'mdi:human-greeting-variant',
'original_name': 'Start identify',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16730022-identify',
'unit_of_measurement': None,
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][button.palm_court_patio_shutter_start_identify-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Patio Shutter Start identify',
<EntityStateAttribute.ICON: 'icon'>: 'mdi:human-greeting-variant',
}),
'context': <ANY>,
'entity_id': 'button.palm_court_patio_shutter_start_identify',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_button_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][button.dining_room_studio_shutter_identify-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -176,6 +176,66 @@
'state': 'off',
})
# ---
# name: test_light_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][light.palm_court_led_strip-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
<ColorMode.ONOFF: 'onoff'>,
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'light',
'entity_category': None,
'entity_id': 'light.palm_court_led_strip',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'rts://1234-1234-6362/16752757',
'unit_of_measurement': None,
})
# ---
# name: test_light_entities_snapshot[cloud_somfy_connexoon_rts_asia.json][light.palm_court_led_strip-state]
StateSnapshot({
'attributes': ReadOnlyDict({
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
<LightEntityStateAttribute.COLOR_MODE: 'color_mode'>: None,
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Strip',
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
<ColorMode.ONOFF: 'onoff'>,
]),
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <LightEntityFeature: 0>,
}),
'context': <ANY>,
'entity_id': 'light.palm_court_led_strip',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_light_entities_snapshot[local_somfy_tahoma_switch_europe_3.json][light.dining_room_wall_light-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
+28 -5
View File
@@ -2,6 +2,7 @@
from collections.abc import Generator
from pathlib import Path
from typing import Any
from unittest.mock import patch
from freezegun.api import FrozenDateTimeFactory
@@ -38,11 +39,22 @@ CHECK_EVENT_TRIGGER = FixtureDevice(
"io://1234-5678-1698/8907539",
"button.maple_residence_living_room_smoke_detector_test",
)
STEP_POSITIVE = FixtureDevice(
"setup/cloud_somfy_connexoon_rts_asia.json",
"rts://1234-1234-6362/16752757",
"button.palm_court_led_strip_brightness_up",
)
STEP_NEGATIVE = FixtureDevice(
"setup/cloud_somfy_connexoon_rts_asia.json",
"rts://1234-1234-6362/16752757",
"button.palm_court_led_strip_brightness_down",
)
SNAPSHOT_FIXTURES = [
MY_POSITION,
GO_TO_ALIAS,
CHECK_EVENT_TRIGGER,
STEP_POSITIVE,
]
@@ -94,26 +106,37 @@ async def test_button_press(
)
@pytest.mark.parametrize(
("device", "command_name", "parameters"),
[
pytest.param(GO_TO_ALIAS, "goToAlias", ["1"], id="go_to_alias"),
pytest.param(STEP_POSITIVE, "stepPositive", [5], id="step_positive"),
pytest.param(STEP_NEGATIVE, "stepNegative", [5], id="step_negative"),
],
)
async def test_button_press_with_args(
hass: HomeAssistant,
setup_overkiz_integration: SetupOverkizIntegration,
mock_client: MockOverkizClient,
device: FixtureDevice,
command_name: str,
parameters: list[Any],
) -> None:
"""Test pressing a button with arguments sends the correct command."""
await setup_overkiz_integration(fixture=GO_TO_ALIAS.fixture)
await setup_overkiz_integration(fixture=device.fixture)
await hass.services.async_call(
BUTTON_DOMAIN,
SERVICE_PRESS,
{ATTR_ENTITY_ID: GO_TO_ALIAS.entity_id},
{ATTR_ENTITY_ID: device.entity_id},
blocking=True,
)
assert_command_call(
mock_client,
device_url=GO_TO_ALIAS.device_url,
command_name="goToAlias",
parameters=["1"],
device_url=device.device_url,
command_name=command_name,
parameters=parameters,
)
+8
View File
@@ -52,11 +52,19 @@ RGB_LIGHT = FixtureDevice(
"io://1234-5678-3293/14608095",
"light.light_terras_rgb",
)
# RTS is one-way, thus this dimmable light can only be dimmed via the
# stepPositive/stepNegative buttons and is exposed as an on/off light.
RTS_DIMMABLE_LIGHT = FixtureDevice(
"setup/cloud_somfy_connexoon_rts_asia.json",
"rts://1234-1234-6362/16752757",
"light.palm_court_led_strip",
)
SNAPSHOT_FIXTURES = [
ONOFF_LIGHT,
DIMMABLE_LIGHT,
RGB_LIGHT,
RTS_DIMMABLE_LIGHT,
]