bluetooth-sensor-state-data 1.8.0__tar.gz → 1.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bluetooth-sensor-state-data
3
- Version: 1.8.0
3
+ Version: 1.9.0
4
4
  Summary: Models for storing and converting Bluetooth Sensor State Data
5
5
  License: Apache-2.0
6
6
  Author: J. Nick Koston
@@ -20,7 +20,7 @@ Provides-Extra: docs
20
20
  Requires-Dist: Sphinx (>=5,<8) ; extra == "docs"
21
21
  Requires-Dist: bluetooth-data-tools (>=1.28.0)
22
22
  Requires-Dist: habluetooth (>=3.42.0)
23
- Requires-Dist: myst-parser (>=0.18,<3.1) ; extra == "docs"
23
+ Requires-Dist: myst-parser (>=0.18,<4.1) ; extra == "docs"
24
24
  Requires-Dist: sensor-state-data (>=2.0)
25
25
  Requires-Dist: sphinx-rtd-theme (>=1,<4) ; extra == "docs"
26
26
  Project-URL: Bug Tracker, https://github.com/bluetooth-devices/bluetooth-sensor-state-data/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bluetooth-sensor-state-data"
3
- version = "1.8.0"
3
+ version = "1.9.0"
4
4
  license = "Apache-2.0"
5
5
  description = "Models for storing and converting Bluetooth Sensor State Data"
6
6
  authors = [{ name = "J. Nick Koston", email = "nick@koston.org" }]
@@ -32,7 +32,7 @@ python = ">=3.11,<3.14"
32
32
  # Documentation Dependencies
33
33
  Sphinx = {version = ">=5,<8", optional = true}
34
34
  sphinx-rtd-theme = {version = ">=1,<4", optional = true}
35
- myst-parser = {version = ">=0.18,<3.1", optional = true}
35
+ myst-parser = {version = ">=0.18,<4.1", optional = true}
36
36
  sensor-state-data = ">=2.0"
37
37
  bluetooth-data-tools = ">=1.28.0"
38
38
  habluetooth = ">=3.42.0"
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "1.8.0"
3
+ __version__ = "1.9.0"
4
4
 
5
5
  from abc import abstractmethod
6
6
 
@@ -40,12 +40,16 @@ class BluetoothData(SensorData):
40
40
  if exclude_ids:
41
41
  # If there are specific manufacturer data IDs to exclude,
42
42
  # then remove them from the set of manufacturer data.
43
- return {
43
+ changed_manufacturer_data = {
44
44
  k: v
45
45
  for k, v in changed_manufacturer_data.items()
46
46
  if k not in exclude_ids
47
47
  }
48
- return changed_manufacturer_data
48
+ # If we can't work out the changed manufacturer data
49
+ # fall back to the normal method.
50
+ if changed_manufacturer_data:
51
+ return changed_manufacturer_data
52
+
49
53
  manufacturer_data = data.manufacturer_data
50
54
  source = data.source
51
55
  last_manufacturer_data = self._last_manufacturer_data_by_source.get(source)
@@ -60,13 +64,12 @@ class BluetoothData(SensorData):
60
64
  new_manufacturer_data = manufacturer_data
61
65
 
62
66
  self._last_manufacturer_data_by_source[source] = manufacturer_data
67
+ single_manufacturer_data = len(new_manufacturer_data) == 1
63
68
 
64
- if not last_manufacturer_data:
69
+ if not last_manufacturer_data or single_manufacturer_data:
65
70
  # If there is no previous data and there is only one value
66
71
  # return it
67
- return (
68
- new_manufacturer_data.copy() if len(new_manufacturer_data) == 1 else {}
69
- )
72
+ return new_manufacturer_data if single_manufacturer_data else {}
70
73
 
71
74
  return dict(new_manufacturer_data.items() - last_manufacturer_data.items())
72
75