python-ember-mug 1.3.0b6__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.
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/PKG-INFO +1 -1
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/__init__.py +2 -2
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/cli/commands.py +3 -2
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/consts.py +1 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/mug.py +1 -1
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/utils.py +9 -7
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/.gitignore +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/LICENSE +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/README.md +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/__main__.py +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/cli/__init__.py +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/cli/helpers.py +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/data.py +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/formatting.py +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/ember_mug/scanner.py +0 -0
- {python_ember_mug-1.3.0b6 → python_ember_mug-1.3.1}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-ember-mug
|
|
3
|
-
Version: 1.3.
|
|
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/
|
|
@@ -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 =
|
|
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(
|
|
@@ -313,7 +313,7 @@ class EmberMug:
|
|
|
313
313
|
unit = TemperatureUnit.FAHRENHEIT if self.data.use_metric is False else TemperatureUnit.CELSIUS
|
|
314
314
|
min_temp, max_temp = MIN_MAX_TEMPS[unit]
|
|
315
315
|
if target_temp != 0 and not (min_temp <= target_temp <= max_temp):
|
|
316
|
-
raise ValueError(f"Temperature
|
|
316
|
+
raise ValueError(f"Temperature '{target_temp}' is not between {min_temp} and {max_temp} or 0.")
|
|
317
317
|
|
|
318
318
|
target_temp = self._convert_to_device_unit(target_temp)
|
|
319
319
|
target = bytearray(round(target_temp / 0.01).to_bytes(2, "little"))
|
|
@@ -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
|
|
@@ -67,13 +67,13 @@ def get_colour_from_int(colour_id: int) -> DeviceColour | None: # noqa: PLR0911
|
|
|
67
67
|
return DeviceColour.BLACK
|
|
68
68
|
if colour_id in (-126, -62, 2):
|
|
69
69
|
return DeviceColour.WHITE
|
|
70
|
-
if colour_id in (
|
|
70
|
+
if colour_id in (-120, -117, -63, -56, -53, 8, 11):
|
|
71
71
|
return DeviceColour.RED
|
|
72
|
-
if colour_id in (-131, -125, -61, 3, 83):
|
|
72
|
+
if colour_id in (-131, -125, -61, 3, 51, 83):
|
|
73
73
|
return DeviceColour.COPPER
|
|
74
74
|
if colour_id in (-124, -60):
|
|
75
75
|
return DeviceColour.ROSE_GOLD
|
|
76
|
-
if colour_id in (-
|
|
76
|
+
if colour_id in (-123, -59):
|
|
77
77
|
return DeviceColour.STAINLESS_STEEL
|
|
78
78
|
return {
|
|
79
79
|
-51: DeviceColour.SANDSTONE,
|
|
@@ -95,7 +95,7 @@ def get_model_from_single_int_and_services( # noqa PLR0911
|
|
|
95
95
|
return DeviceModel.MUG_1_10_OZ
|
|
96
96
|
if model_id == 65:
|
|
97
97
|
return DeviceModel.MUG_1_14_OZ
|
|
98
|
-
if model_id in (-51, -59, -63, -61, -62):
|
|
98
|
+
if model_id in (-51, -59, -63, -61, -62, 120):
|
|
99
99
|
return DeviceModel.MUG_2_14_OZ
|
|
100
100
|
if model_id == -60:
|
|
101
101
|
return DeviceModel.CUP_6_OZ
|
|
@@ -108,7 +108,7 @@ def get_model_from_id_and_gen(model_id: int, generation: int) -> DeviceModel | N
|
|
|
108
108
|
"""Extract model from identifier in advertiser data."""
|
|
109
109
|
if model_id == 1:
|
|
110
110
|
return DeviceModel.MUG_1_10_OZ if generation < 2 else DeviceModel.MUG_2_10_OZ
|
|
111
|
-
if model_id
|
|
111
|
+
if model_id in (2, 120):
|
|
112
112
|
return DeviceModel.MUG_1_14_OZ if generation < 2 else DeviceModel.MUG_2_14_OZ
|
|
113
113
|
if model_id == 3:
|
|
114
114
|
return DeviceModel.TRAVEL_MUG_12_OZ
|
|
@@ -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
|
-
|
|
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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|