Module homey.ble_characteristic
Classes
class BleCharacteristic-
A BLE characteristic of a peripheral.
This class must not be initialized by the developer, but retrieved through BleService#characteristics or by calling
BleService.discover_characteristics()orBleService.get_characteristic().Ancestors
- SimpleClass
- EventEmitter
- typing.Generic
Instance variables
var id : Final[str]-
The ID of this characteristic assigned by Homey.
var uuid : Final[str]var value : bytes | Nonevar properties : Final[tuple[Literal['broadcast', 'read', 'writeWithoutResponse', 'write', 'notify', 'indicate', 'authenticatedSignedWrites', 'extendedProperties'], ...]]prop descriptors : tuple[BleDescriptor, ...]-
The
BleDescriptors of this characteristic.
Methods
async def discover_descriptors(self, uuid_filter: list[str] | None = None) ‑> tuple[BleDescriptor, ...]-
Discover the descriptors of this characteristic.
Args
uuid_filter- A collection of descriptor UUIDs to limit the discovery to.
Raises
NotConnected:
async def subscribe_to_notifications(self, callback: Callable[[bytes], None]) ‑> None-
Subscribe to BLE notifications from the characteristic. The callback is called with the data of any notification that arrives. Only one callback can be active at a time.
Raises
NotConnected:
async def unsubscribe_from_notification(self) ‑> None-
Unsubscribe from BLE notifications from the characteristic.
Raises
NotConnected:
async def read(self) ‑> bytes-
Read the current value of this characteristic.
Raises
NotConnected:
async def write(self, data: bytes) ‑> None-
Write the data to this characteristic.
Raises
NotConnected:
Inherited members