Skip to content

Commit

Permalink
Merge branch 'adafruit:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ihidchaos authored Nov 28, 2024
2 parents a53ad33 + 14140f7 commit 346a3ad
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
3 changes: 3 additions & 0 deletions circuitmatter/clusters/measurement/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
6 changes: 6 additions & 0 deletions circuitmatter/clusters/measurement/temperature_measurement.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
3 changes: 3 additions & 0 deletions circuitmatter/device_types/sensor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
20 changes: 13 additions & 7 deletions circuitmatter/device_types/sensor/temperature_sensor.py
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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

0 comments on commit 346a3ad

Please sign in to comment.