Skip to content

Commit

Permalink
Merge pull request #26 from lboue/patch-5
Browse files Browse the repository at this point in the history
Fix temperature_sensor device revision
  • Loading branch information
tannewt authored Nov 27, 2024
2 parents 734fd1d + c72bae6 commit 14140f7
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 14140f7

Please sign in to comment.