Skip to main content

Python API to interact with the Anova Nano.

Project description

PyAnova-Nano

Code style: black License

Control the Anova Nano via BLE.

This is a rough translation of dengelke/node-sous-vide.

Notes:

  • The code should be considered experimental at this point.
  • Presumably this library is not compatible with any other Anova model!
  • The PyAnova class is not compatible with c3V6a2Vy/pyanova.

Installation

pip install pyanova-nano

Examples

Automatic discovery

The device should be found automatically based on the service uuid it provides.

Context manager: auto connect and disconnect

import asyncio
from pyanova_nano import PyAnova

async def print_device_sensors():
    async with PyAnova() as client:
        print(await client.get_sensor_values())

asyncio.run(print_device_sensors())

No context manager

import asyncio

from pyanova_nano import PyAnova


async def get_timer():
    client = PyAnova()
    await client.connect()

    print(await client.get_timer())

    await client.disconnect()


asyncio.run(get_timer())

Manual connection

To use a custom address, first discover all relevant devices, then use PyAnova.connect(device=my_anova) with my_anova being the bleak.BLEDevice you want to connect to.

import asyncio

from bleak import BLEDevice

from pyanova_nano import PyAnova


async def print_target_temp():
    client = PyAnova()
    devices: list[BLEDevice] = await client.discover(connect=False, list_all=True)
    # Select the device to use.
    my_anova = next(iter(devices))

    print(f"Found: {my_anova.address}")

    await client.connect(device=my_anova)

    temperature = await client.get_target_temperature()
    print(temperature)
    
    await client.disconnect()


asyncio.run(print_target_temp())

Subscription to status updates

The Anova Nano deos not update the client on it's own. We have to ask it for updates. This library allows you to poll the device for updates and subscribe to be notified.

import asyncio

from pyanova_nano import PyAnova


async def main():
    async with PyAnova() as client:

        def handle_update():
            print(client.last_status)

        client.set_poll_interval(4)
        client.subscribe(handle_update)
        client.start_poll()

        # We should get 3 updates in 10 seconds before stopping the polling.
        await asyncio.sleep(10)
        await client.stop_poll()


asyncio.run(main())

Troubleshooting

Cannot connect to your Anova Nano.

  1. The Anova Nano can only maintain a connection to a single client. Ensure that nothing else is connected to your Anova Nano.
  2. Try turning the device off and on by holding the start/stop button.

Disclaimer

This software may harm your device. Use it at your own risk.

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyanova_nano-0.3.4.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyanova_nano-0.3.4-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file pyanova_nano-0.3.4.tar.gz.

File metadata

  • Download URL: pyanova_nano-0.3.4.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyanova_nano-0.3.4.tar.gz
Algorithm Hash digest
SHA256 1b96cd58de12482bcc63d83064105837e68743f55bbc052459617fa1d2df96c4
MD5 6c8e8cebcad8d58d3579b36ae5b8eb31
BLAKE2b-256 362f08dd403b3af5b4fc5406bf0fd301ebd6beb9a432cd772199cd3fae5ce76c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyanova_nano-0.3.4.tar.gz:

Publisher: publish.yml on filmkorn/pyanova-nano

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyanova_nano-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: pyanova_nano-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyanova_nano-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 750df3625e1d7915a473b525db504512da475782f182d4f433df6e09e41802f6
MD5 49711076e3c50b66e43e082840935251
BLAKE2b-256 8d02af6a9eefbe036a51866bda73816a96e6961816401107dfbac58e0da3a0c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyanova_nano-0.3.4-py3-none-any.whl:

Publisher: publish.yml on filmkorn/pyanova-nano

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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