python-ember-mug 1.3.0b3__tar.gz → 1.3.0b4__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.0b3 → python_ember_mug-1.3.0b4}/PKG-INFO +1 -1
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/__init__.py +1 -1
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/mug.py +20 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/.gitignore +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/LICENSE +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/README.md +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/__main__.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/cli/__init__.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/cli/commands.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/cli/helpers.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/consts.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/data.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/formatting.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/scanner.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/ember_mug/utils.py +0 -0
- {python_ember_mug-1.3.0b3 → python_ember_mug-1.3.0b4}/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.0b4
|
|
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,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import contextlib
|
|
7
7
|
import logging
|
|
8
|
+
import os
|
|
8
9
|
from datetime import UTC, datetime
|
|
9
10
|
from enum import Enum
|
|
10
11
|
from functools import cached_property
|
|
@@ -275,6 +276,25 @@ class EmberMug:
|
|
|
275
276
|
"""Get Battery percent from mug gatt."""
|
|
276
277
|
return BatteryInfo.from_bytes(await self._read(MugCharacteristic.BATTERY))
|
|
277
278
|
|
|
279
|
+
async def make_writable(self) -> bool:
|
|
280
|
+
"""Try to make device writable if need be."""
|
|
281
|
+
if self.can_write:
|
|
282
|
+
return True
|
|
283
|
+
try:
|
|
284
|
+
await self._ensure_connection()
|
|
285
|
+
# Attempt to write a random string
|
|
286
|
+
await self.set_udsk(os.urandom(14).hex())
|
|
287
|
+
return True
|
|
288
|
+
except BleakError as e:
|
|
289
|
+
logger.debug("Failed to make device writable: %s", e)
|
|
290
|
+
return False
|
|
291
|
+
|
|
292
|
+
async def pair(self) -> None:
|
|
293
|
+
"""Attempt to pair."""
|
|
294
|
+
with contextlib.suppress(BleakError, EOFError):
|
|
295
|
+
await self._ensure_connection()
|
|
296
|
+
await self._client.pair()
|
|
297
|
+
|
|
278
298
|
@require_attribute("led_colour")
|
|
279
299
|
async def get_led_colour(self) -> Colour:
|
|
280
300
|
"""Get RGBA colours from mug gatt."""
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|