python-ember-mug 1.3.0b7__tar.gz → 1.3.1__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.4
2
2
  Name: python-ember-mug
3
- Version: 1.3.0b7
3
+ Version: 1.3.1
4
4
  Summary: Python Library for Ember Mugs.
5
5
  Project-URL: Changelog, https://sopelj.github.io/python-ember-mug/changelog/
6
6
  Project-URL: Documentation, https://sopelj.github.io/python-ember-mug/
@@ -5,5 +5,5 @@ from .mug import EmberMug
5
5
  __all__ = ("EmberMug",)
6
6
 
7
7
  __author__ = """Jesse Sopel"""
8
- __email__ = "jesse.sopel@gmail.com"
9
- __version__ = "1.3.0b7"
8
+ __email__ = "jesse@sopelj.ca"
9
+ __version__ = "1.3.1"
@@ -12,7 +12,7 @@ from typing import TYPE_CHECKING, ClassVar
12
12
 
13
13
  from bleak import AdvertisementData, BleakError
14
14
 
15
- from ember_mug.consts import ATTR_LABELS, EMBER_BLE_SIG, EXTRA_ATTRS, IS_LINUX, VolumeLevel
15
+ from ember_mug.consts import ATTR_LABELS, EMBER_BLE_SIG, EXTRA_ATTRS, IS_LINUX, TESTING_BLE_SIG, VolumeLevel
16
16
  from ember_mug.data import Colour, DeviceModel
17
17
  from ember_mug.mug import EmberMug
18
18
  from ember_mug.scanner import discover_devices, find_device
@@ -33,9 +33,10 @@ get_attribute_names = [n.replace("_", "-") for n in all_attrs]
33
33
  async def get_device(args: Namespace) -> EmberMug:
34
34
  """Help to get the devices based on command args."""
35
35
  device, advertisement = await find_device_cmd(args)
36
+ manufacturer_data = advertisement.manufacturer_data
36
37
  model_info = get_model_info_from_advertiser_data(advertisement)
37
38
  if model_info.model == DeviceModel.UNKNOWN_DEVICE and not args.raw:
38
- data = advertisement.manufacturer_data.get(EMBER_BLE_SIG, None)
39
+ data = manufacturer_data.get(EMBER_BLE_SIG, manufacturer_data.get(TESTING_BLE_SIG, None))
39
40
  print(f"Warning: No model found matching advertisement data: {data!r}")
40
41
 
41
42
  mug = EmberMug(
@@ -14,6 +14,7 @@ UUID_TEMPLATE = "fc54{:0>4x}-236c-4c94-8fa9-944a3e5353fa"
14
14
 
15
15
  # Registered SIG for BLE Manufacturer Data
16
16
  EMBER_BLE_SIG = 0x03C1
17
+ TESTING_BLE_SIG = 0xFFFF
17
18
  DEFAULT_NAME = "Ember Device"
18
19
 
19
20
 
@@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any
10
10
 
11
11
  from bleak import AdvertisementData, BleakError
12
12
 
13
- from ember_mug.consts import EMBER_BLE_SIG, TRAVEL_MUG_SERVICE_UUIDS, DeviceColour, DeviceModel
13
+ from ember_mug.consts import EMBER_BLE_SIG, TESTING_BLE_SIG, TRAVEL_MUG_SERVICE_UUIDS, DeviceColour, DeviceModel
14
14
 
15
15
  if TYPE_CHECKING:
16
16
  from bleak import BleakClient
@@ -134,7 +134,9 @@ def get_model_info_from_advertiser_data(advertisement: AdvertisementData) -> Mod
134
134
  """Extract model info from manufacturer data in advertiser data."""
135
135
  from ember_mug.data import ModelInfo # noqa: PLC0415
136
136
 
137
- model_data = advertisement.manufacturer_data.get(EMBER_BLE_SIG, None)
137
+ manufacturer_data = advertisement.manufacturer_data
138
+
139
+ model_data = manufacturer_data.get(EMBER_BLE_SIG, manufacturer_data.get(TESTING_BLE_SIG, None))
138
140
  if model_data is not None:
139
141
  if len(model_data) < 4:
140
142
  model_id = bytes_to_big_int(model_data, signed=True)