Pinecil V2 interface library
Overview
Pinecil is a lightweight Python library designed to inetrafce with Pinecil V2 soldering iron.
Requirements
- Python 3.9 or higher
- bluez
Installation
pip install pinecil
Usage Example
A complete from-scratch example:
from pinecil import find_pinecils # if running in a cloned repo, use `from src.pinecil`
import asyncio
async def main():
devices = await find_pinecils()
iron = devices[0]
await iron.connect()
settings = await iron.get_all_settings()
await iron.set_one_setting('SetTemperature', 250)
await iron.save_to_flash() # this is required to preserve settings after powering off
info = await iron.get_info()
live = await iron.get_live_data()
print(settings)
print('----------')
print(info)
print('----------')
print(live)
if __name__ == '__main__':
asyncio.run(main())
If you already know the address of your pinecil, you can use it directly:
from pinecil import BLE, Pinecil
import asyncio
if __name__ == '__main__':
p = Pinecil(BLE('<your-address>'))
asyncio.run(p.get_all_settings())
To find addresses of all pinecils nearby:
from pinecil import find_device_addresses
import asyncio
if __name__ == '__main__':
asyncio.run(find_device_addresses('pinecil'))
Testing
poetry shell
pytest -v
# for development convenience:
ptw --runner 'pytest -v'
Publish to test.pypi
You will need a PyPi token first: https://test.pypi.org/manage/account/token/
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi pypi-XXXXXXXX
poetry build
poetry publish -r test-pypi
References
- Originally started as PineSAM
Docs
Exceptions
ValueOutOfRangeException: Attempting to set a settings value that is out of range.InvalidSettingException: Setting does not exist.DeviceNotFoundException: Indicates the device was not found.DeviceDisconnectedException: Indicates the device was disconnected.
Classes and Functions
Class: Pinecil
- Constructor:
__init__(self, ble: BLE): Initializes Pinecil withBLEinstance. - Properties:
is_connected -> bool: True if Pinecil is connected.
- Methods:
connect(self): Connects to Pinecil.get_all_settings(self) -> Dict[str, int]: Retrieves all settings.set_one_setting(self, setting: str, value: int): Sets a single setting - does not save to flash.save_to_flash(self): Saves all settings to flash.get_info(self) -> Dict[str, str]: Retrieves basic Pinecil info.get_live_data(self) -> Dict[str, int]: Retrieves live data.
Class: BLE
- Constructor:
__init__(self, address: str): Initializes BLE device wrapper. - Properties:
is_connected -> bool: True if connected to the device.
- Methods:
ensure_connected(self): Connects to the device if not connected (does nothing if connected)get_services(self) -> List[str]: Gets list of services.get_characteristics(self, service_uuid: str) -> List[BleakGATTCharacteristic]: Gets characteristics of a service.read_characteristic(self, handle: BleakGATTCharacteristic) -> bytes: Reads value of a characteristicwrite_characteristic(self, handle: BleakGATTCharacteristic, value: bytes): Writes value to a characteristic.
Function: find_device_addresses
- Description: Finds devices matching a given name and returns their UUIDs
- Returns:
List[str]: List of device addresses.
Function: find_pinecils
- Description: Finds nearby pinecils and returns their list.
- Returns:
List[Pinecil]: List of found device instances.
Metadata
Release files for pinecil 0.2.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pinecil-0.2.15.tar.gz | 9.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pinecil-0.2.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / pinecil-0.2.15.tar.gz
| Download URL | pinecil-0.2.15.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23d63600d8af3c7b6e4a9662b3dbccaa6a86fdcbcba321c363e08560bd2c4ee3
|
|
BLAKE2b-256 checksum How to use checksums |
ea23391186ca695a7a57044ca15c17909276182f3c8ba9244b6fff271fdcbda1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / pinecil-0.2.15-py3-none-any.whl
| Download URL | pinecil-0.2.15-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27769587122075c0d9dc0242cb60ed44c5cf52faca4af054d78b7d13b822b8c0
|
|
BLAKE2b-256 checksum How to use checksums |
62e9781de146a94242cb9e7a0399e5a3be077ed87495a3d5abe8b1b0bbd21e58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for pinecil 0.2.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.