Bump Matter server library to 3.4.1 and address changes (#93411)

* bump python matter server to 3.4.1

* address renamed attribute names in sdk 1.1

* ignore AllClustersAppServerExample

* clusters.ColorControl.Bitmaps.ColorCapabilities

* address discovery schemas

* fix all fixtures due to attribute rename

* bump python matter server to 3.4.1

* address renamed attribute names in sdk 1.1

* ignore AllClustersAppServerExample

* clusters.ColorControl.Bitmaps.ColorCapabilities

* address discovery schemas

* fix all fixtures due to attribute rename

* lint

* update requirements_all
This commit is contained in:
Marcel van der Veldt 2023-05-23 20:42:09 +02:00 committed by GitHub
parent 46103f56c4
commit 56d2048ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 61 additions and 59 deletions

View File

@ -104,7 +104,7 @@ DISCOVERY_SCHEMAS = [
device_class=BinarySensorDeviceClass.BATTERY, device_class=BinarySensorDeviceClass.BATTERY,
name="Battery Status", name="Battery Status",
measurement_to_ha=lambda x: x measurement_to_ha=lambda x: x
!= clusters.PowerSource.Enums.BatChargeLevel.kOk, != clusters.PowerSource.Enums.BatChargeLevelEnum.kOk,
), ),
entity_class=MatterBinarySensor, entity_class=MatterBinarySensor,
required_attributes=(clusters.PowerSource.Attributes.BatChargeLevel,), required_attributes=(clusters.PowerSource.Attributes.BatChargeLevel,),

View File

@ -1,7 +1,6 @@
"""Matter light.""" """Matter light."""
from __future__ import annotations from __future__ import annotations
from enum import IntFlag
from typing import Any from typing import Any
from chip.clusters import Objects as clusters from chip.clusters import Objects as clusters
@ -112,7 +111,7 @@ class MatterLight(MatterEntity, LightEntity):
await self.send_device_command( await self.send_device_command(
clusters.ColorControl.Commands.MoveToColorTemperature( clusters.ColorControl.Commands.MoveToColorTemperature(
colorTemperature=color_temp, colorTemperatureMireds=color_temp,
# It's required in TLV. We don't implement transition time yet. # It's required in TLV. We don't implement transition time yet.
transitionTime=0, transitionTime=0,
) )
@ -307,13 +306,22 @@ class MatterLight(MatterEntity, LightEntity):
assert capabilities is not None assert capabilities is not None
if capabilities & ColorCapabilities.kHueSaturationSupported: if (
capabilities
& clusters.ColorControl.Bitmaps.ColorCapabilities.kHueSaturationSupported
):
supported_color_modes.add(ColorMode.HS) supported_color_modes.add(ColorMode.HS)
if capabilities & ColorCapabilities.kXYAttributesSupported: if (
capabilities
& clusters.ColorControl.Bitmaps.ColorCapabilities.kXYAttributesSupported
):
supported_color_modes.add(ColorMode.XY) supported_color_modes.add(ColorMode.XY)
if capabilities & ColorCapabilities.kColorTemperatureSupported: if (
capabilities
& clusters.ColorControl.Bitmaps.ColorCapabilities.kColorTemperatureSupported
):
supported_color_modes.add(ColorMode.COLOR_TEMP) supported_color_modes.add(ColorMode.COLOR_TEMP)
self._attr_supported_color_modes = supported_color_modes self._attr_supported_color_modes = supported_color_modes
@ -344,18 +352,6 @@ class MatterLight(MatterEntity, LightEntity):
self._attr_brightness = self._get_brightness() self._attr_brightness = self._get_brightness()
# This enum should be removed once the ColorControlCapabilities enum is added to the CHIP (Matter) library
# clusters.ColorControl.Bitmap.ColorCapabilities
class ColorCapabilities(IntFlag):
"""Color control capabilities bitmap."""
kHueSaturationSupported = 0x1
kEnhancedHueSupported = 0x2
kColorLoopSupported = 0x4
kXYAttributesSupported = 0x8
kColorTemperatureSupported = 0x10
# 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(
@ -372,10 +368,11 @@ DISCOVERY_SCHEMAS = [
clusters.ColorControl.Attributes.CurrentY, clusters.ColorControl.Attributes.CurrentY,
clusters.ColorControl.Attributes.ColorTemperatureMireds, clusters.ColorControl.Attributes.ColorTemperatureMireds,
), ),
# restrict device type to prevent discovery by the wrong platform device_type=(
not_device_type=( device_types.ColorTemperatureLight,
device_types.OnOffPlugInUnit, device_types.DimmableLight,
device_types.DoorLock, device_types.ExtendedColorLight,
device_types.OnOffLight,
), ),
), ),
] ]

View File

@ -106,7 +106,7 @@ class MatterLock(MatterEntity, LockEntity):
LOGGER.debug("Door state: %s for %s", door_state, self.entity_id) LOGGER.debug("Door state: %s for %s", door_state, self.entity_id)
self._attr_is_jammed = ( self._attr_is_jammed = (
door_state is clusters.DoorLock.Enums.DlDoorState.kDoorJammed door_state is clusters.DoorLock.Enums.DoorStateEnum.kDoorJammed
) )

View File

@ -6,5 +6,5 @@
"dependencies": ["websocket_api"], "dependencies": ["websocket_api"],
"documentation": "https://www.home-assistant.io/integrations/matter", "documentation": "https://www.home-assistant.io/integrations/matter",
"iot_class": "local_push", "iot_class": "local_push",
"requirements": ["python-matter-server==3.2.0"] "requirements": ["python-matter-server==3.4.1"]
} }

View File

@ -69,9 +69,14 @@ DISCOVERY_SCHEMAS = [
required_attributes=(clusters.OnOff.Attributes.OnOff,), required_attributes=(clusters.OnOff.Attributes.OnOff,),
# restrict device type to prevent discovery by the wrong platform # restrict device type to prevent discovery by the wrong platform
not_device_type=( not_device_type=(
device_types.OnOffLight, device_types.ColorTemperatureLight,
device_types.DimmableLight, device_types.DimmableLight,
device_types.ExtendedColorLight,
device_types.OnOffLight,
device_types.DoorLock, device_types.DoorLock,
device_types.ColorDimmerSwitch,
device_types.DimmerSwitch,
device_types.OnOffLightSwitch,
), ),
), ),
] ]

View File

@ -2089,7 +2089,7 @@ python-kasa==0.5.1
# python-lirc==1.2.3 # python-lirc==1.2.3
# homeassistant.components.matter # homeassistant.components.matter
python-matter-server==3.2.0 python-matter-server==3.4.1
# homeassistant.components.xiaomi_miio # homeassistant.components.xiaomi_miio
python-miio==0.5.12 python-miio==0.5.12

View File

@ -1518,7 +1518,7 @@ python-juicenet==1.1.0
python-kasa==0.5.1 python-kasa==0.5.1
# homeassistant.components.matter # homeassistant.components.matter
python-matter-server==3.2.0 python-matter-server==3.4.1
# homeassistant.components.xiaomi_miio # homeassistant.components.xiaomi_miio
python-miio==0.5.12 python-miio==0.5.12

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -202,7 +202,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 268, "deviceType": 268,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -61,7 +61,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 21, "deviceType": 21,
"revision": 1 "revision": 1
} }
], ],

View File

@ -12,7 +12,7 @@
"0/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "0/4/65531": [0, 65528, 65529, 65531, 65532, 65533],
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -414,7 +414,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 257, "deviceType": 257,
"revision": 1 "revision": 1
} }
], ],

View File

@ -12,7 +12,7 @@
"0/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "0/4/65531": [0, 65528, 65529, 65531, 65532, 65533],
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -354,7 +354,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 257, "deviceType": 257,
"revision": 1 "revision": 1
} }
], ],

View File

@ -7,7 +7,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -443,7 +443,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 10, "deviceType": 10,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -202,7 +202,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 269, "deviceType": 269,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -56,7 +56,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 774, "deviceType": 774,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -56,7 +56,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 775, "deviceType": 775,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -56,7 +56,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 262, "deviceType": 262,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -61,7 +61,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 263, "deviceType": 263,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -118,7 +118,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 266, "deviceType": 266,
"revision": 1 "revision": 1
} }
], ],

View File

@ -12,7 +12,7 @@
"0/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "0/4/65531": [0, 65528, 65529, 65531, 65532, 65533],
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -354,7 +354,7 @@
], ],
"1/29/0": [ "1/29/0": [
{ {
"type": 257, "deviceType": 257,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -56,7 +56,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 773, "deviceType": 773,
"revision": 1 "revision": 1
} }
], ],

View File

@ -6,7 +6,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -61,7 +61,7 @@
"1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 770, "deviceType": 770,
"revision": 1 "revision": 1
} }
], ],

View File

@ -7,7 +7,7 @@
"attributes": { "attributes": {
"0/29/0": [ "0/29/0": [
{ {
"type": 22, "deviceType": 22,
"revision": 1 "revision": 1
} }
], ],
@ -281,7 +281,7 @@
"1/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "1/4/65531": [0, 65528, 65529, 65531, 65532, 65533],
"1/29/0": [ "1/29/0": [
{ {
"type": 514, "deviceType": 514,
"revision": 1 "revision": 1
} }
], ],

View File

@ -188,7 +188,7 @@ async def test_color_temperature_light(
"turn_on", "turn_on",
{ {
"entity_id": entity_id, "entity_id": entity_id,
"color_temp": 3000, "color_temp": 300,
}, },
blocking=True, blocking=True,
) )
@ -200,7 +200,7 @@ async def test_color_temperature_light(
node_id=light_node.node_id, node_id=light_node.node_id,
endpoint_id=1, endpoint_id=1,
command=clusters.ColorControl.Commands.MoveToColorTemperature( command=clusters.ColorControl.Commands.MoveToColorTemperature(
colorTemperature=3003, colorTemperatureMireds=300,
transitionTime=0, transitionTime=0,
), ),
), ),