BleCharacteristic
homey.ble_characteristic
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() or BleService.get_characteristic().
Ancestors
- SimpleClass
- homey.util.event_emitter.EventEmitter
- typing.Generic
Instance variables
id
var id : Final[str]The ID of this characteristic assigned by Homey.
uuid
var uuid : Final[str]value
var value : bytes | Noneproperties
var properties : Final[tuple[Literal['broadcast', 'read', 'writeWithoutResponse', 'write', 'notify', 'indicate', 'authenticatedSignedWrites', 'extendedProperties'], ...]]descriptors
var descriptors : tuple[BleDescriptor, ...]The BleDescriptors of this characteristic.
Methods
discover_descriptors
async def discover_descriptors(self, uuid_filter: list[str] | None = None) ‑> tuple[BleDescriptor, ...]Discover the descriptors of this characteristic.
Args
| Name | Type | Description |
|---|---|---|
uuid_filter |
list[str] | None | A collection of descriptor UUIDs to limit the discovery to. |
Raises
NotConnected:
subscribe_to_notifications
async def subscribe_to_notifications(self, callback: Callable[[bytes], None]) ‑> NoneSubscribe 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:
unsubscribe_from_notification
async def unsubscribe_from_notification(self) ‑> NoneUnsubscribe from BLE notifications from the characteristic.
Raises
NotConnected:
read
async def read(self) ‑> bytesRead the current value of this characteristic.
Raises
NotConnected:
write
async def write(self, data: bytes) ‑> NoneWrite the data to this characteristic.
Raises
NotConnected: