Skip to main content

A Bluetooth scale integration for coffee machines

Project description

pyfelicita

Felicita integration package for python

Example code:

import asyncio
from pyfelicita import Felicita

async def main():
    addresses = await Felicita.find_felicita_devices()
    
    if not addresses:
        print("No devices found")
        return
        
    address = addresses[0]
    
    client = await Felicita.create(address)
        
    if not client:
        print("Failed to connect to the scale")
        return
    
    try:
        await client.set_weight_and_timer_mode()
        await asyncio.sleep(0.1)
        await client.tare()
        await asyncio.sleep(0.1)
        await client.reset_timer()
        await asyncio.sleep(0.1)
        await client.start_timer()
        
        while client.is_connected():
            await asyncio.sleep(0.1)
            print(
                f"Weight: {client.current_weight} {client.current_scale_unit}, "
                f"Battery: {client.current_battery_level:.2f}%"
            )
            
            if(client.is_timer_running):
                print(f"Time elapsed: {client.timer_time_elapsed}")
                
            if(client.current_weight > 69):
                await client.stop_timer()
                print("Criteria met, stopping program")
                break
                    
    finally:
        if client.is_connected():
            await client.disconnect()
        else:
            print("Scale stopped responding")

asyncio.run(main())

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

pyfelicita-0.1.7.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

pyfelicita-0.1.7-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pyfelicita-0.1.7.tar.gz.

File metadata

  • Download URL: pyfelicita-0.1.7.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyfelicita-0.1.7.tar.gz
Algorithm Hash digest
SHA256 c3ddd7991ac62a14e1f0d9c526ee72e58021c3b38cb839755665e8eefd58d446
MD5 2c8c0fb1e0e4355655271e95eb2b8dd0
BLAKE2b-256 5a518b5062ce12282099ad321a35ca0ca952560f944e94a3aafea7f1ccfb21af

See more details on using hashes here.

File details

Details for the file pyfelicita-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pyfelicita-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyfelicita-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 962b20e3c320de6a21feb8eb94d3ef59a9541edf7daad81fed37703247de21b1
MD5 a8c71e48d256b8b815eafa3877c6a0f9
BLAKE2b-256 e20c81384364d936b0622b8986121152e8dc77d1b5749bae11b9a608f54ba858

See more details on using hashes here.

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