Skip to main content

Python Library for Ember Mugs.

Project description

Python Ember Mug

pypi python Build Status codecov

Python Library for Ember Mugs

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

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)

CLI

It can also be invoked as a module from command line as python -m ember_mug --help. There are four options with different subsections. You can see them by specifying them before help. eg python -m ember_mug poll --help

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

Basic options:

Command Use
discover Find/List all detected unpaired mugs in pairing mode
find Find one already paired mugs
info Connect to one mug and print its current state
poll Connect to one mug and print its current state and keep watching for changes

CLI Example

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

This version

0.2.3

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.2.3.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

python_ember_mug-0.2.3-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file python-ember-mug-0.2.3.tar.gz.

File metadata

  • Download URL: python-ember-mug-0.2.3.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for python-ember-mug-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e502b5e5d1fe3b6067b8af91eec95e02b7e4e1705a7a11e36dd4eb89fc591c02
MD5 273a82f0489b02c321db4a5c2714e0f9
BLAKE2b-256 49ef3633d2ba67d957d9a3b7ffe6ac16ba5f6575e03ab18d05dd606b69ae0f0e

See more details on using hashes here.

File details

Details for the file python_ember_mug-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for python_ember_mug-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 505ee165f7211f0d193ef4a20b1f22386d00ba6fca395cb07841ebb23266f21d
MD5 69ad2e73705f87a4c256a06e68baf488
BLAKE2b-256 08160c01fa69efbbe5da2ad19007be2f0ef5aff3c3c8e09192bdb3f0a02d6c4f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page