Skip to content

Commit

Permalink
Bump chip wheels to 2024.4.1 (Matter SDK 1.3) (#675)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Agner <[email protected]>
Co-authored-by: Martin Hjelmare <[email protected]>
  • Loading branch information
3 people authored May 1, 2024
1 parent 5fc265a commit 5f5cf3f
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 21 deletions.
177 changes: 162 additions & 15 deletions matter_server/client/models/device_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __hash__(self) -> int:
return self.device_type


class OrphanClusters(DeviceType, device_type=0xF001):
class OrphanClusters(DeviceType, device_type=0xFFF10001):
"""Orphan Clusters."""

clusters = {
Expand Down Expand Up @@ -65,6 +65,7 @@ class RootNode(DeviceType, device_type=0x0016):
all_clusters.EthernetNetworkDiagnostics,
all_clusters.WiFiNetworkDiagnostics,
all_clusters.ThreadNetworkDiagnostics,
all_clusters.IcdManagement,
}


Expand All @@ -77,6 +78,17 @@ class PowerSource(DeviceType, device_type=0x0011):
}


class ElectricalSensor(DeviceType, device_type=0x0510):
"""Electrical Sensor."""

clusters = {
all_clusters.Descriptor,
all_clusters.PowerTopology,
all_clusters.ElectricalEnergyMeasurement,
all_clusters.ElectricalPowerMeasurement,
}


class OtaRequestor(DeviceType, device_type=0x0012):
"""OTA Requestor."""

Expand Down Expand Up @@ -122,7 +134,7 @@ class OnOffLight(DeviceType, device_type=0x0100):
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.LevelControl,
}
Expand All @@ -136,7 +148,7 @@ class DimmableLight(DeviceType, device_type=0x0101):
all_clusters.Descriptor,
all_clusters.Binding,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.LevelControl,
}
Expand All @@ -149,7 +161,7 @@ class ColorTemperatureLight(DeviceType, device_type=0x010C):
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.LevelControl,
all_clusters.ColorControl,
Expand All @@ -163,7 +175,7 @@ class ExtendedColorLight(DeviceType, device_type=0x010D):
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.LevelControl,
all_clusters.ColorControl,
Expand All @@ -177,7 +189,7 @@ class OnOffPlugInUnit(DeviceType, device_type=0x010A):
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.LevelControl,
}
Expand All @@ -190,7 +202,7 @@ class DimmablePlugInUnit(DeviceType, device_type=0x010B):
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.LevelControl,
}
Expand All @@ -204,7 +216,7 @@ class Pump(DeviceType, device_type=0x0303):
all_clusters.Descriptor,
all_clusters.Binding,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.OnOff,
all_clusters.PumpConfigurationAndControl,
all_clusters.LevelControl,
Expand Down Expand Up @@ -384,7 +396,7 @@ class WindowCovering(DeviceType, device_type=0x0202):
clusters = {
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.Groups,
all_clusters.WindowCovering,
}
Expand All @@ -408,7 +420,7 @@ class HeatingCoolingUnit(DeviceType, device_type=0x0300):
all_clusters.Descriptor,
all_clusters.Binding,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.FanControl,
all_clusters.LevelControl,
all_clusters.OnOff,
Expand All @@ -422,7 +434,7 @@ class Thermostat(DeviceType, device_type=0x0301):
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.Binding,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.Groups,
all_clusters.Thermostat,
all_clusters.TimeSynchronization,
Expand Down Expand Up @@ -569,8 +581,9 @@ class RoomAirConditioner(DeviceType, device_type=0x0072):
all_clusters.OnOff,
all_clusters.Descriptor,
all_clusters.Groups,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.Thermostat,
all_clusters.ThermostatUserInterfaceConfiguration,
all_clusters.FanControl,
all_clusters.TemperatureMeasurement,
all_clusters.RelativeHumidityMeasurement,
Expand All @@ -589,6 +602,7 @@ class SmokeCoAlarm(DeviceType, device_type=0x0076):
all_clusters.TemperatureMeasurement,
all_clusters.CarbonMonoxideConcentrationMeasurement,
all_clusters.PowerSource,
all_clusters.Descriptor,
}


Expand Down Expand Up @@ -641,6 +655,28 @@ class Dishwasher(DeviceType, device_type=0x0075):
}


class Oven(DeviceType, device_type=0x007B):
"""Oven."""

clusters = {
all_clusters.Identify,
all_clusters.Descriptor,
}


class MicrowaveOven(DeviceType, device_type=0x0079):
"""Microwave Oven."""

clusters = {
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.FanControl,
all_clusters.MicrowaveOvenMode,
all_clusters.MicrowaveOvenControl,
all_clusters.OperationalState,
}


class Refrigerator(DeviceType, device_type=0x0070):
"""Refrigerator."""

Expand All @@ -666,6 +702,32 @@ class LaundryWasher(DeviceType, device_type=0x0073):
}


class LaundryDryer(DeviceType, device_type=0x007C):
"""Laundry Dryer."""

clusters = {
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.OnOff,
all_clusters.LaundryWasherMode,
all_clusters.LaundryDryerControls,
all_clusters.TemperatureControl,
all_clusters.OperationalState,
}


class ExtractorHood(DeviceType, device_type=0x007A):
"""Extractor Hood."""

clusters = {
all_clusters.Identify,
all_clusters.Descriptor,
all_clusters.HepaFilterMonitoring,
all_clusters.ActivatedCarbonFilterMonitoring,
all_clusters.FanControl,
}


class RoboticVacuumCleaner(DeviceType, device_type=0x0074):
"""Robotic Vacuum Cleaner."""

Expand All @@ -686,10 +748,63 @@ class TemperatureControlledCabinet(DeviceType, device_type=0x0071):
all_clusters.TemperatureControl,
all_clusters.TemperatureMeasurement,
all_clusters.RefrigeratorAndTemperatureControlledCabinetMode,
all_clusters.OvenMode,
all_clusters.OvenCavityOperationalState,
}


class WaterFreezeDetector(DeviceType, device_type=0x0041):
"""Water Freeze Detector."""

clusters = {
all_clusters.Identify,
all_clusters.BooleanState,
all_clusters.BooleanStateConfiguration,
all_clusters.Descriptor,
}


class AllClustersAppServerExample(DeviceType, device_type=0x0000):
class WaterValve(DeviceType, device_type=0x0042):
"""Water Valve."""

clusters = {
all_clusters.Identify,
all_clusters.ValveConfigurationAndControl,
all_clusters.Descriptor,
}


class WaterLeakDetector(DeviceType, device_type=0x0043):
"""Water Leak Detector."""

clusters = {
all_clusters.Identify,
all_clusters.BooleanState,
all_clusters.BooleanStateConfiguration,
all_clusters.Descriptor,
}


class RainSensor(DeviceType, device_type=0x0044):
"""Rain Sensor."""

clusters = {
all_clusters.Identify,
all_clusters.BooleanState,
all_clusters.BooleanStateConfiguration,
all_clusters.Descriptor,
}


class NetworkInfrastructureManager(DeviceType, device_type=0xFFF10010):
"""Network Infrastructure Manager."""

clusters = {
all_clusters.Descriptor,
}


class AllClustersAppServerExample(DeviceType, device_type=0xFFF10003):
"""All-clusters-app Server Example."""

clusters = {
Expand All @@ -702,15 +817,47 @@ class AllClustersAppServerExample(DeviceType, device_type=0x0000):
all_clusters.Groups,
all_clusters.LevelControl,
all_clusters.OnOff,
all_clusters.Scenes,
all_clusters.ScenesManagement,
all_clusters.TemperatureMeasurement,
}


class SecondaryNetworkCommissioningDeviceType(DeviceType, device_type=0xF002):
class SecondaryNetworkCommissioningDeviceType(DeviceType, device_type=0xFFF10002):
"""Secondary Network Commissioning Device Type."""

clusters = {
all_clusters.NetworkCommissioning,
all_clusters.Descriptor,
}


class Cooktop(DeviceType, device_type=0x0078):
"""Cooktop."""

clusters = {
all_clusters.Descriptor,
all_clusters.Identify,
all_clusters.OnOff,
}


class CookSurface(DeviceType, device_type=0x0077):
"""Cook Surface."""

clusters = {
all_clusters.Descriptor,
all_clusters.TemperatureControl,
all_clusters.TemperatureMeasurement,
}


class Evse(DeviceType, device_type=0x050C):
"""EVSE."""

clusters = {
all_clusters.Descriptor,
all_clusters.Identify,
all_clusters.EnergyEvse,
all_clusters.EnergyEvseMode,
all_clusters.TemperatureMeasurement,
}
5 changes: 4 additions & 1 deletion matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from chip.clusters import Attribute, Objects as Clusters
from chip.clusters.Attribute import ValueDecodeFailure
from chip.clusters.ClusterObjects import ALL_ATTRIBUTES, ALL_CLUSTERS, Cluster
from chip.discovery import DiscoveryType
from chip.exceptions import ChipStackError
from chip.native import PyChipError
from zeroconf import BadTypeInNameException, IPVersion, ServiceStateChange, Zeroconf
Expand Down Expand Up @@ -256,7 +257,9 @@ async def commission_with_code(
self.chip_controller.CommissionWithCode,
setupPayload=code,
nodeid=node_id,
networkOnly=network_only,
discoveryType=DiscoveryType.DISCOVERY_NETWORK_ONLY
if network_only
else DiscoveryType.DISCOVERY_ALL,
)
if result and result.is_success:
break
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies = [
"coloredlogs",
"dacite",
"orjson",
"home-assistant-chip-clusters==2024.3.2",
"home-assistant-chip-clusters==2024.4.1",
]
description = "Python Matter WebSocket Server"
license = {text = "Apache-2.0"}
Expand All @@ -33,7 +33,7 @@ version = "0.0.0"

[project.optional-dependencies]
server = [
"home-assistant-chip-core==2024.3.2",
"home-assistant-chip-core==2024.4.1",
"cryptography==42.0.5",
"zeroconf==0.132.2",
]
Expand Down
11 changes: 8 additions & 3 deletions scripts/generate_devices.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
"""Generate device types from matter-devices.xml."""

import pathlib
import urllib.request

import black
import xmltodict

REPO_ROOT = pathlib.Path(__file__).parent.parent

CHIP_ROOT = REPO_ROOT / "../../project-chip/connectedhomeip"
DEVICE_XML = CHIP_ROOT / "src/app/zap-templates/zcl/data-model/chip/matter-devices.xml"
DEVICE_XML = (
"https://raw.githubusercontent.com/project-chip/connectedhomeip"
"/master/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml"
)

OUTPUT_PYTHON = REPO_ROOT / "matter_server/client/models/device_types.py"

Expand Down Expand Up @@ -42,7 +45,9 @@ def gen_cls_name(name: str):

def main():
"""Generate device types from matter-devices.xml."""
data = xmltodict.parse(DEVICE_XML.read_text())
with urllib.request.urlopen(DEVICE_XML) as response: # noqa: S310
xml_data = response.read().decode("utf-8")
data = xmltodict.parse(xml_data)
output = [
'''
"""
Expand Down

0 comments on commit 5f5cf3f

Please sign in to comment.