diff --git a/circuitmatter/clusters/measurement/__init__.py b/circuitmatter/clusters/measurement/__init__.py new file mode 100644 index 0000000..76abc07 --- /dev/null +++ b/circuitmatter/clusters/measurement/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Scott Shawcroft for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/circuitmatter/clusters/measurement/temperature_measurement.py b/circuitmatter/clusters/measurement/temperature_measurement.py index ef3ce24..54f789d 100644 --- a/circuitmatter/clusters/measurement/temperature_measurement.py +++ b/circuitmatter/clusters/measurement/temperature_measurement.py @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Scott Shawcroft for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +"""Temperature cluster.""" + from circuitmatter import data_model diff --git a/circuitmatter/device_types/sensor/__init__.py b/circuitmatter/device_types/sensor/__init__.py new file mode 100644 index 0000000..76abc07 --- /dev/null +++ b/circuitmatter/device_types/sensor/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Scott Shawcroft for Adafruit Industries +# +# SPDX-License-Identifier: MIT diff --git a/circuitmatter/device_types/sensor/temperature_sensor.py b/circuitmatter/device_types/sensor/temperature_sensor.py index a77ac09..7a91912 100644 --- a/circuitmatter/device_types/sensor/temperature_sensor.py +++ b/circuitmatter/device_types/sensor/temperature_sensor.py @@ -1,15 +1,24 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 Scott Shawcroft for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +"""Temperature sensor device with an random temperature.""" + +import random + from circuitmatter.clusters.general.identify import Identify from circuitmatter.clusters.measurement.temperature_measurement import ( TemperatureMeasurement, ) -from .. import simple_device -import random +from .. import simple_device class TemperatureSensor(simple_device.SimpleDevice): + """Temperature sensor device with an random temperature.""" + DEVICE_TYPE_ID = 0x0302 - REVISION = 4 + REVISION = 2 def __init__(self, name): super().__init__(name) @@ -19,7 +28,4 @@ def __init__(self, name): self._temp = TemperatureMeasurement() self.servers.append(self._temp) - - self._temp.MeasuredValue = random.randint( - 1500, 2500 - ) # Random temp between 15°C and 25°C + self._temp.MeasuredValue = random.randint(1500, 2500) # Random temp between 15°C and 25°C