Fix is_closed state for DynamicGate covers in Overkiz (#170130)

This commit is contained in:
Mick Vleeshouwer
2026-05-08 20:42:50 +02:00
committed by GitHub
parent 1647c0bf84
commit 15943a737a
4 changed files with 176 additions and 1 deletions
+12 -1
View File
@@ -171,6 +171,17 @@ COVER_DESCRIPTIONS: list[OverkizCoverDescription] = [
stop_command=OverkizCommand.STOP,
is_closed_state=OverkizState.CORE_OPEN_CLOSED_PARTIAL,
),
# Needs override since DiscreteGateWithPedestrianPosition reports
# core:OpenClosedPedestrianState instead of core:OpenClosedState
# uiClass is Gate
OverkizCoverDescription(
key=UIWidget.DISCRETE_GATE_WITH_PEDESTRIAN_POSITION,
device_class=CoverDeviceClass.GATE,
open_command=OverkizCommand.OPEN,
close_command=OverkizCommand.CLOSE,
is_closed_state=OverkizState.CORE_OPEN_CLOSED_PEDESTRIAN,
stop_command=OverkizCommand.STOP,
),
# Needs override to support this Generic device (rts:GenericRTSComponent)
# uiClass is Generic (not mapped to cover as this is a Generic device class)
OverkizCoverDescription(
@@ -255,7 +266,7 @@ COVER_DESCRIPTIONS: list[OverkizCoverDescription] = [
device_class=CoverDeviceClass.GATE,
open_command=OverkizCommand.OPEN,
close_command=OverkizCommand.CLOSE,
is_closed_state=OverkizState.CORE_OPEN_CLOSED_PEDESTRIAN,
is_closed_state=OverkizState.CORE_OPEN_CLOSED,
stop_command=OverkizCommand.STOP,
),
OverkizCoverDescription(
@@ -7672,6 +7672,106 @@
"type": 1,
"oid": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
"uiClass": "GarageDoor"
},
{
"creationTime": 1660551260000,
"lastUpdateTime": 1660551260000,
"label": "OGP Gate",
"deviceURL": "ogp://1234-1234-6233/10410217",
"shortcut": false,
"controllableName": "ogp:Gate",
"definition": {
"commands": [
{
"commandName": "close",
"nparams": 0
},
{
"commandName": "identify",
"nparams": 0
},
{
"commandName": "open",
"nparams": 0
},
{
"commandName": "setName",
"nparams": 1
},
{
"commandName": "stop",
"nparams": 0
}
],
"states": [
{
"type": "DiscreteState",
"values": ["available", "unavailable"],
"qualifiedName": "core:AvailabilityState"
},
{
"type": "DataState",
"qualifiedName": "core:NameState"
},
{
"type": "DiscreteState",
"values": ["closed", "open"],
"qualifiedName": "core:OpenClosedState"
},
{
"type": "DiscreteState",
"values": ["available", "unavailable"],
"qualifiedName": "core:StatusState"
}
],
"dataProperties": [],
"widgetName": "DynamicGate",
"uiProfiles": ["StatefulOpenClose", "OpenClose"],
"uiClass": "Gate",
"qualifiedName": "ogp:Gate",
"type": "ACTUATOR"
},
"states": [
{
"name": "core:NameState",
"type": 3,
"value": "OGP Gate"
},
{
"name": "core:AvailabilityState",
"type": 3,
"value": "available"
},
{
"name": "core:StatusState",
"type": 3,
"value": "available"
},
{
"name": "core:OpenClosedState",
"type": 3,
"value": "open"
}
],
"attributes": [
{
"name": "core:Technology",
"type": 3,
"value": "io2way"
},
{
"name": "core:Manufacturer",
"type": 3,
"value": "Somfy"
}
],
"available": true,
"enabled": true,
"placeOID": "bcbb34ef-2241-43a1-9c5b-523aa0563ec3",
"type": 1,
"widget": "DynamicGate",
"oid": "a8d3e9f1-4b2c-4d5e-8f6a-1234567890ab",
"uiClass": "Gate"
}
],
"zones": [],
@@ -1779,6 +1779,59 @@
'state': 'closed',
})
# ---
# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.ogp_gate-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': 'cover',
'entity_category': None,
'entity_id': 'cover.ogp_gate',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': None,
'options': dict({
}),
'original_device_class': <CoverDeviceClass.GATE: 'gate'>,
'original_icon': None,
'original_name': None,
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': <CoverEntityFeature: 11>,
'translation_key': None,
'unique_id': 'ogp://1234-1234-6233/10410217',
'unit_of_measurement': None,
})
# ---
# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.ogp_gate-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'gate',
'friendly_name': 'OGP Gate',
'is_closed': False,
'supported_features': <CoverEntityFeature: 11>,
}),
'context': <ANY>,
'entity_id': 'cover.ogp_gate',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'open',
})
# ---
# name: test_cover_entities_snapshot[cloud_somfy_tahoma_v2_europe.json][cover.partial_garage_door-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
+11
View File
@@ -124,6 +124,11 @@ PARTIAL_GARAGE_DOOR = FixtureDevice(
"io://1234-1234-6233/7433515",
"cover.partial_garage_door",
)
DYNAMIC_GATE = FixtureDevice(
"setup/cloud_somfy_tahoma_v2_europe.json",
"ogp://1234-1234-6233/10410217",
"cover.ogp_gate",
)
SNAPSHOT_FIXTURES = [
AWNING,
@@ -171,6 +176,7 @@ async def test_cover_entities_snapshot(
(GARAGE, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING),
(DYNAMIC_GARAGE_DOOR, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING),
(DYNAMIC_GARAGE_DOOR_OGP, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING),
(DYNAMIC_GATE, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING),
(PARTIAL_GARAGE_DOOR, SERVICE_OPEN_COVER, "open", None, CoverState.OPENING),
(
UP_DOWN_BIOCLIMATIC_PERGOLA,
@@ -192,6 +198,7 @@ async def test_cover_entities_snapshot(
None,
CoverState.CLOSING,
),
(DYNAMIC_GATE, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING),
(PARTIAL_GARAGE_DOOR, SERVICE_CLOSE_COVER, "close", None, CoverState.CLOSING),
(
UP_DOWN_BIOCLIMATIC_PERGOLA,
@@ -213,6 +220,7 @@ async def test_cover_entities_snapshot(
(GARAGE, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED),
(DYNAMIC_GARAGE_DOOR, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED),
(DYNAMIC_GARAGE_DOOR_OGP, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED),
(DYNAMIC_GATE, SERVICE_STOP_COVER, "stop", None, CoverState.OPEN),
(PARTIAL_GARAGE_DOOR, SERVICE_STOP_COVER, "stop", None, CoverState.CLOSED),
(
UP_DOWN_BIOCLIMATIC_PERGOLA,
@@ -272,6 +280,7 @@ async def test_cover_entities_snapshot(
"open-garage-door",
"open-dynamic-garage-door",
"open-dynamic-garage-door-ogp",
"open-dynamic-gate",
"open-partial-garage-door",
"open-up-down-bioclimatic-pergola",
"open-tilt-only-venetian-blind",
@@ -281,6 +290,7 @@ async def test_cover_entities_snapshot(
"close-garage-door",
"close-dynamic-garage-door",
"close-dynamic-garage-door-ogp",
"close-dynamic-gate",
"close-partial-garage-door",
"close-up-down-bioclimatic-pergola",
"close-tilt-only-venetian-blind",
@@ -290,6 +300,7 @@ async def test_cover_entities_snapshot(
"stop-garage-door",
"stop-dynamic-garage-door",
"stop-dynamic-garage-door-ogp",
"stop-dynamic-gate",
"stop-partial-garage-door",
"stop-up-down-bioclimatic-pergola",
"stop-tilt-only-venetian-blind",