Metadata-Version: 2.5
Name: pyanova-ble
Version: 0.1.0
Summary: Control the original Bluetooth Anova Precision Cooker
Project-URL: Homepage, https://github.com/lanrat/pyanova-ble
Project-URL: Issues, https://github.com/lanrat/pyanova-ble/issues
Author: Ian Foster
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Home Automation
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: bleak-retry-connector>=3.5
Requires-Dist: bleak>=0.22
Description-Content-Type: text/markdown

# pyanova-ble

Async Python library for the original Bluetooth Anova Precision Cooker (the
model before Wi-Fi, which Anova no longer supports). Used by the Home
Assistant `anova_ble` integration.

```python
from bleak import BleakScanner
from pyanova_ble import AnovaBLE, TemperatureUnit

device = await BleakScanner.find_device_by_address("AA:BB:CC:DD:EE:FF")
cooker = AnovaBLE(device)
print(await cooker.async_get_state())
await cooker.async_set_target_temperature(56.5, TemperatureUnit.CELSIUS)
await cooker.async_start()
await cooker.async_start_timer(90)
await cooker.async_disconnect()
```

Run `python -m pyanova_ble` to list nearby cookers, or
`python -m pyanova_ble <address>` to print one's details and state.

The cooker accepts one connection at a time and does not advertise while
connected, so call `async_disconnect()` when done to let other clients in.

## Protocol

Checked against a cooker with firmware 2.7.6.

- The cooker advertises the name `Anova` and service
  `0000ffe0-0000-1000-8000-00805f9b34fb`.
- Commands are ASCII ending in `\r`, written without response to
  characteristic `0000ffe1-0000-1000-8000-00805f9b34fb`. Replies end in `\r`
  and arrive as notifications on the same characteristic; replies longer than
  20 bytes are split over several notifications.
- Replies do not name the command they answer, so send one command at a time.
  Unknown commands get no reply.
- The cooker drops a command written within about 0.25 s of subscribing to
  notifications; the client waits 1 s.
- For a few seconds after power-up the cooker does not answer commands.

| Command | Reply | Notes |
| --- | --- | --- |
| `status` | `running`, `stopped`, `low water`, `power loss` | Alarms stay until cleared or fixed. |
| `read unit` / `set unit c` | `c` or `f` | Changing the unit converts the target. |
| `read set temp` / `set temp 56.5` | `56.5` | Range 0.0–99.5 °C or 32.0–211.8 °F. Out-of-range values are ignored and the reply is the old target. |
| `read temp` | `55.9` | Water temperature. |
| `start` / `stop` | `start` / `stop` | `start` also starts the last timer set; `stop` resets the time left. |
| `set timer 90` | `90` | Minutes, 0–6000. Shown by `read timer` only once started. The cooker keeps it and runs it on every `start`; `set timer 0` turns that off. |
| `start time` / `stop time` | `start time` / `stop time` | Start or pause the timer; only works while cooking (no reply otherwise). The cooker keeps cooking when the timer ends. |
| `read timer` | `42 running` | Minutes left, `running` or `stopped`. |
| `read cal` / `cal 0.5` | `0.5` / `cal 0.5` | Calibration offset, −9.9 to 9.9; kept when the unit changes. |
| `clear alarm` | `clear alarm` | |
| `version` | `ver 2.7.6` | |
| `get id card` | `anova f56-0123456789a` | Unique per cooker. |

## Development

```bash
uv sync
uv run pytest
uv run ruff check && uv run ruff format --check && uv run mypy
```

## Releasing

Bump `version` in `pyproject.toml`, then publish a GitHub release. The
release workflow builds the package and uploads it to PyPI with trusted
publishing (configure the `pypi` environment and the trusted publisher on
PyPI first).
