Skip to content

Commit

Permalink
feat: Use updated text based example for CLI instead of old image
Browse files Browse the repository at this point in the history
  • Loading branch information
sopelj committed Jun 15, 2024
1 parent 4a4de4f commit 45de72f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 12 deletions.
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![codecov](https://codecov.io/gh/sopelj/python-ember-mug/graph/badge.svg?token=2Lw2iVjKsG)](https://codecov.io/gh/sopelj/python-ember-mug)
![Project Maintenance](https://img.shields.io/maintenance/yes/2024.svg)
[![Maintainer](https://img.shields.io/badge/maintainer-%40sopelj-blue.svg)](https://github.com/sopelj)
[![License](https://img.shields.io/github/license/sopelj/python-ember-mug.svg)](LICENSE)
[![License](https://img.shields.io/github/license/sopelj/python-ember-mug.svg)](https://github.com/sopelj/python-ember-mug/blob/main/LICENSE)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen)](https://github.com/pre-commit/pre-commit)

Python Library for interacting with Ember Mugs, Cups, and Travel Mugs via Bluetooth
Expand Down Expand Up @@ -54,22 +54,25 @@ Attributes by device:
| Battery Percent | R | R | R | R | Current battery level |
| On Charger | R | R | R | R | Device is on it's charger |

*** Writing may only work if the devices has been set up in the app previously
> **Note**
> Writing may only work if the devices has been set up in the app previously
## Usage

### Python

```python
from ember_mug.scanner import find_device, discover_devices
from ember_mug.utils import get_model_info_from_advertiser_data
from ember_mug.mug import EmberMug

# if first time with mug in pairing
mugs = await discover_devices()
device = mugs[0]
devices = await discover_devices()

# after paired you can simply use
device = await find_device()
mug = EmberMug(device)
device, advertisement = await find_device()
model_info = get_model_info_from_advertiser_data(advertisement)
mug = EmberMug(device, model_info)
await mug.update_all()
print(mug.data.formatted)
await mug.disconnect()
Expand Down Expand Up @@ -105,7 +108,43 @@ Basic options:
| `get` | Get the value(s) of one or more attribute(s) by name |
| `set` | Set one or more values on the device |

![CLI Example](./docs/images/cli-example.png)
Example:
<!-- termynal -->
```
$ ember-mug poll
Found device: C9:0F:59:D6:33:F9: Ember Ceramic Mug
Connecting...
Connected.
Fetching Info
Device Data
+--------------+----------------------+
| Device Name | Jesse's Mug |
+--------------+----------------------+
| Meta | None |
+--------------+----------------------+
| Battery | 64.0% |
| | not on charging base |
+--------------+----------------------+
| Firmware | None |
+--------------+----------------------+
| LED Colour | #ff0fbb |
+--------------+----------------------+
| Liquid State | Empty |
+--------------+----------------------+
| Liquid Level | 0.00% |
+--------------+----------------------+
| Current Temp | 24.50°C |
+--------------+----------------------+
| Target Temp | 55.00°C |
+--------------+----------------------+
| Use Metric | True |
+--------------+----------------------+
Watching for changes
Current Temp changed from "24.50°C" to "25.50°"
Battery changed from "64.0%, on charging base" to "65.5%, on charging base"
```


## Caveats

Expand Down
Binary file removed docs/images/cli-example.png
Binary file not shown.
14 changes: 9 additions & 5 deletions docs/usage/python.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
## In order to

```python
from ember_mug.scanner import find_mug, discover_mugs
from ember_mug.scanner import find_device, discover_devices
from ember_mug.utils import get_model_info_from_advertiser_data
from ember_mug.mug import EmberMug

# if first time with mug in pairing
mugs = await discover_mugs()
device = mugs[0]
devices = await discover_devices()

# after paired you can simply use
device = await find_mug()
mug = EmberMug(device)
device, advertisement = await find_device()
model_info = get_model_info_from_advertiser_data(advertisement)
mug = EmberMug(device, model_info)
await mug.update_all()
print(mug.data.formatted)
await mug.disconnect()
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ markdown_extensions:
- pymdownx.tilde
- pymdownx.tabbed
- attr_list
- admonition
- pymdownx.highlight:
linenums: false
- pymdownx.superfences
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ docs = [
"mkdocs-literate-nav",
"mkdocs-gen-files",
"mkdocstrings-python",
"black",
"termynal",
]

Expand Down

0 comments on commit 45de72f

Please sign in to comment.