diff --git a/homeassistant/components/matter/binary_sensor.py b/homeassistant/components/matter/binary_sensor.py index a82614cbcc6..bd65b3a0925 100644 --- a/homeassistant/components/matter/binary_sensor.py +++ b/homeassistant/components/matter/binary_sensor.py @@ -104,7 +104,7 @@ DISCOVERY_SCHEMAS = [ device_class=BinarySensorDeviceClass.BATTERY, name="Battery Status", measurement_to_ha=lambda x: x - != clusters.PowerSource.Enums.BatChargeLevel.kOk, + != clusters.PowerSource.Enums.BatChargeLevelEnum.kOk, ), entity_class=MatterBinarySensor, required_attributes=(clusters.PowerSource.Attributes.BatChargeLevel,), diff --git a/homeassistant/components/matter/light.py b/homeassistant/components/matter/light.py index 10a52eb8805..ae2b7a68c3a 100644 --- a/homeassistant/components/matter/light.py +++ b/homeassistant/components/matter/light.py @@ -1,7 +1,6 @@ """Matter light.""" from __future__ import annotations -from enum import IntFlag from typing import Any from chip.clusters import Objects as clusters @@ -112,7 +111,7 @@ class MatterLight(MatterEntity, LightEntity): await self.send_device_command( clusters.ColorControl.Commands.MoveToColorTemperature( - colorTemperature=color_temp, + colorTemperatureMireds=color_temp, # It's required in TLV. We don't implement transition time yet. transitionTime=0, ) @@ -307,13 +306,22 @@ class MatterLight(MatterEntity, LightEntity): assert capabilities is not None - if capabilities & ColorCapabilities.kHueSaturationSupported: + if ( + capabilities + & clusters.ColorControl.Bitmaps.ColorCapabilities.kHueSaturationSupported + ): supported_color_modes.add(ColorMode.HS) - if capabilities & ColorCapabilities.kXYAttributesSupported: + if ( + capabilities + & clusters.ColorControl.Bitmaps.ColorCapabilities.kXYAttributesSupported + ): supported_color_modes.add(ColorMode.XY) - if capabilities & ColorCapabilities.kColorTemperatureSupported: + if ( + capabilities + & clusters.ColorControl.Bitmaps.ColorCapabilities.kColorTemperatureSupported + ): supported_color_modes.add(ColorMode.COLOR_TEMP) self._attr_supported_color_modes = supported_color_modes @@ -344,18 +352,6 @@ class MatterLight(MatterEntity, LightEntity): 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_SCHEMAS = [ MatterDiscoverySchema( @@ -372,10 +368,11 @@ DISCOVERY_SCHEMAS = [ clusters.ColorControl.Attributes.CurrentY, clusters.ColorControl.Attributes.ColorTemperatureMireds, ), - # restrict device type to prevent discovery by the wrong platform - not_device_type=( - device_types.OnOffPlugInUnit, - device_types.DoorLock, + device_type=( + device_types.ColorTemperatureLight, + device_types.DimmableLight, + device_types.ExtendedColorLight, + device_types.OnOffLight, ), ), ] diff --git a/homeassistant/components/matter/lock.py b/homeassistant/components/matter/lock.py index f90d8eb485d..c529ee12c5f 100644 --- a/homeassistant/components/matter/lock.py +++ b/homeassistant/components/matter/lock.py @@ -106,7 +106,7 @@ class MatterLock(MatterEntity, LockEntity): LOGGER.debug("Door state: %s for %s", door_state, self.entity_id) self._attr_is_jammed = ( - door_state is clusters.DoorLock.Enums.DlDoorState.kDoorJammed + door_state is clusters.DoorLock.Enums.DoorStateEnum.kDoorJammed ) diff --git a/homeassistant/components/matter/manifest.json b/homeassistant/components/matter/manifest.json index 190bf33dcf7..5af01f2eea5 100644 --- a/homeassistant/components/matter/manifest.json +++ b/homeassistant/components/matter/manifest.json @@ -6,5 +6,5 @@ "dependencies": ["websocket_api"], "documentation": "https://www.home-assistant.io/integrations/matter", "iot_class": "local_push", - "requirements": ["python-matter-server==3.2.0"] + "requirements": ["python-matter-server==3.4.1"] } diff --git a/homeassistant/components/matter/switch.py b/homeassistant/components/matter/switch.py index 809d0ad7386..2eb3c22c1f7 100644 --- a/homeassistant/components/matter/switch.py +++ b/homeassistant/components/matter/switch.py @@ -69,9 +69,14 @@ DISCOVERY_SCHEMAS = [ required_attributes=(clusters.OnOff.Attributes.OnOff,), # restrict device type to prevent discovery by the wrong platform not_device_type=( - device_types.OnOffLight, + device_types.ColorTemperatureLight, device_types.DimmableLight, + device_types.ExtendedColorLight, + device_types.OnOffLight, device_types.DoorLock, + device_types.ColorDimmerSwitch, + device_types.DimmerSwitch, + device_types.OnOffLightSwitch, ), ), ] diff --git a/requirements_all.txt b/requirements_all.txt index cf5b9fd441f..e700233999c 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2089,7 +2089,7 @@ python-kasa==0.5.1 # python-lirc==1.2.3 # homeassistant.components.matter -python-matter-server==3.2.0 +python-matter-server==3.4.1 # homeassistant.components.xiaomi_miio python-miio==0.5.12 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 7a43f7cee3a..38f0ea09158 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1518,7 +1518,7 @@ python-juicenet==1.1.0 python-kasa==0.5.1 # homeassistant.components.matter -python-matter-server==3.2.0 +python-matter-server==3.4.1 # homeassistant.components.xiaomi_miio python-miio==0.5.12 diff --git a/tests/components/matter/fixtures/nodes/color-temperature-light.json b/tests/components/matter/fixtures/nodes/color-temperature-light.json index 2155f20fe3a..f5a6d5fd1e9 100644 --- a/tests/components/matter/fixtures/nodes/color-temperature-light.json +++ b/tests/components/matter/fixtures/nodes/color-temperature-light.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -202,7 +202,7 @@ ], "1/29/0": [ { - "type": 268, + "deviceType": 268, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/contact-sensor.json b/tests/components/matter/fixtures/nodes/contact-sensor.json index fa90ecff1d5..3500c73f790 100644 --- a/tests/components/matter/fixtures/nodes/contact-sensor.json +++ b/tests/components/matter/fixtures/nodes/contact-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -61,7 +61,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 21, + "deviceType": 21, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/device_diagnostics.json b/tests/components/matter/fixtures/nodes/device_diagnostics.json index 2950a61622c..c0e1e898028 100644 --- a/tests/components/matter/fixtures/nodes/device_diagnostics.json +++ b/tests/components/matter/fixtures/nodes/device_diagnostics.json @@ -12,7 +12,7 @@ "0/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -414,7 +414,7 @@ ], "1/29/0": [ { - "type": 257, + "deviceType": 257, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/dimmable-light.json b/tests/components/matter/fixtures/nodes/dimmable-light.json index f295e3bf154..32dfd29e796 100644 --- a/tests/components/matter/fixtures/nodes/dimmable-light.json +++ b/tests/components/matter/fixtures/nodes/dimmable-light.json @@ -12,7 +12,7 @@ "0/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -354,7 +354,7 @@ ], "1/29/0": [ { - "type": 257, + "deviceType": 257, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/door-lock.json b/tests/components/matter/fixtures/nodes/door-lock.json index f7a9749325f..62162b3c2d7 100644 --- a/tests/components/matter/fixtures/nodes/door-lock.json +++ b/tests/components/matter/fixtures/nodes/door-lock.json @@ -7,7 +7,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -443,7 +443,7 @@ ], "1/29/0": [ { - "type": 10, + "deviceType": 10, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/extended-color-light.json b/tests/components/matter/fixtures/nodes/extended-color-light.json index ac2a840d041..e8c4603ab9c 100644 --- a/tests/components/matter/fixtures/nodes/extended-color-light.json +++ b/tests/components/matter/fixtures/nodes/extended-color-light.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -202,7 +202,7 @@ ], "1/29/0": [ { - "type": 269, + "deviceType": 269, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/flow-sensor.json b/tests/components/matter/fixtures/nodes/flow-sensor.json index 3bbeb51151a..4e9efad2268 100644 --- a/tests/components/matter/fixtures/nodes/flow-sensor.json +++ b/tests/components/matter/fixtures/nodes/flow-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -56,7 +56,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 774, + "deviceType": 774, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/humidity-sensor.json b/tests/components/matter/fixtures/nodes/humidity-sensor.json index 92153e61516..23dcf667c58 100644 --- a/tests/components/matter/fixtures/nodes/humidity-sensor.json +++ b/tests/components/matter/fixtures/nodes/humidity-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -56,7 +56,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 775, + "deviceType": 775, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/light-sensor.json b/tests/components/matter/fixtures/nodes/light-sensor.json index 5ea56033a78..6289cb77da5 100644 --- a/tests/components/matter/fixtures/nodes/light-sensor.json +++ b/tests/components/matter/fixtures/nodes/light-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -56,7 +56,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 262, + "deviceType": 262, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/occupancy-sensor.json b/tests/components/matter/fixtures/nodes/occupancy-sensor.json index a541fdf4e77..cac06cbae20 100644 --- a/tests/components/matter/fixtures/nodes/occupancy-sensor.json +++ b/tests/components/matter/fixtures/nodes/occupancy-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -61,7 +61,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 263, + "deviceType": 263, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/on-off-plugin-unit.json b/tests/components/matter/fixtures/nodes/on-off-plugin-unit.json index f037ba80bc0..376426057af 100644 --- a/tests/components/matter/fixtures/nodes/on-off-plugin-unit.json +++ b/tests/components/matter/fixtures/nodes/on-off-plugin-unit.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -118,7 +118,7 @@ ], "1/29/0": [ { - "type": 266, + "deviceType": 266, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/onoff-light.json b/tests/components/matter/fixtures/nodes/onoff-light.json index fa6ed7afeff..3db9105562a 100644 --- a/tests/components/matter/fixtures/nodes/onoff-light.json +++ b/tests/components/matter/fixtures/nodes/onoff-light.json @@ -12,7 +12,7 @@ "0/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -354,7 +354,7 @@ ], "1/29/0": [ { - "type": 257, + "deviceType": 257, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/pressure-sensor.json b/tests/components/matter/fixtures/nodes/pressure-sensor.json index 7be49b650b5..60335aa602d 100644 --- a/tests/components/matter/fixtures/nodes/pressure-sensor.json +++ b/tests/components/matter/fixtures/nodes/pressure-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -56,7 +56,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 773, + "deviceType": 773, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/temperature-sensor.json b/tests/components/matter/fixtures/nodes/temperature-sensor.json index dd23fbda2cc..426b6653623 100644 --- a/tests/components/matter/fixtures/nodes/temperature-sensor.json +++ b/tests/components/matter/fixtures/nodes/temperature-sensor.json @@ -6,7 +6,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -61,7 +61,7 @@ "1/3/65531": [0, 1, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 770, + "deviceType": 770, "revision": 1 } ], diff --git a/tests/components/matter/fixtures/nodes/window-covering.json b/tests/components/matter/fixtures/nodes/window-covering.json index 5ab0d497278..9214b9511be 100644 --- a/tests/components/matter/fixtures/nodes/window-covering.json +++ b/tests/components/matter/fixtures/nodes/window-covering.json @@ -7,7 +7,7 @@ "attributes": { "0/29/0": [ { - "type": 22, + "deviceType": 22, "revision": 1 } ], @@ -281,7 +281,7 @@ "1/4/65531": [0, 65528, 65529, 65531, 65532, 65533], "1/29/0": [ { - "type": 514, + "deviceType": 514, "revision": 1 } ], diff --git a/tests/components/matter/test_light.py b/tests/components/matter/test_light.py index ef854112008..78ffa477b33 100644 --- a/tests/components/matter/test_light.py +++ b/tests/components/matter/test_light.py @@ -188,7 +188,7 @@ async def test_color_temperature_light( "turn_on", { "entity_id": entity_id, - "color_temp": 3000, + "color_temp": 300, }, blocking=True, ) @@ -200,7 +200,7 @@ async def test_color_temperature_light( node_id=light_node.node_id, endpoint_id=1, command=clusters.ColorControl.Commands.MoveToColorTemperature( - colorTemperature=3003, + colorTemperatureMireds=300, transitionTime=0, ), ),