Python Library for Ember Mugs.
Project description
Python Ember Mug
Python Library for Ember Mugs
- Documentation: https://sopelj.github.io/python-ember-mug
- GitHub: https://github.com/sopelj/python-ember-mug
- PyPI: https://pypi.org/project/python-ember-mug/
- Free software: MIT
Summary
Library to attempt to interact with Ember Mugs via Bluetooth using the bleak library. This was created for use with my Home Assistant integration, but could be useful separately and has a simple CLI interface too.
Note: I have only tested with my Ember Mug 2, but others should work. (Please let me know)
Features
- Finding mugs
- Connecting to Mugs
- Reading Information (Colour, temp, liquid level, etc.)
- Polling for changes
Usage
CLI
Put your mug in pairing mode (hold button five seconds or until blue)
python -m ember_mug discover # Finds the mug in pairing mode for the first time
python -m ember_mug poll # fetches info and keeps listening for notifications
Python
from ember_mug.scanner import find_mug, discover_mugs
from ember_mug.mug import EmberMug
# if first time with mug in pairing
mugs = await discover_mugs()
device = mugs[0]
# after paired you can simply use
device = await find_mug()
mug = EmberMug(device)
async with mug.connection() as con:
print('Connected.\nFetching Info')
await con.update_all()
print(mug.formatted_data)
Caveats
- Since this api is not public, a lot of guesswork and reverse engineering is involved, so it's not perfect.
- Only works with one mug at a time
- These mugs do not broadcast data unless paired. So you can only have one device connected to it. You need to reset them to change to another device and make sure the previous device doesn't try to reconnect.
- Reading data from the mug seems to work pretty well, but I have been unable to write to it so far... I always get NotPermitted errors.
- I haven't figured out some attributes like udsk, dsk, location,
Credits
This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-ember-mug-0.1.2.tar.gz
(13.1 kB
view hashes)
Built Distribution
Close
Hashes for python_ember_mug-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec37c3538852ebb32053164dc42715a2b1a95e2ea715dede73353299131b309b |
|
MD5 | 807250df8479e3339ac8138a1855039a |
|
BLAKE2b-256 | e2741091f97a176ae999a9db293b47e75a2607c739e6cd0e0bc2f0182b574f70 |