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 | None

properties

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

NameTypeDescription
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]) ‑> 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:

unsubscribe_from_notification

async def unsubscribe_from_notification(self) ‑> None

Unsubscribe from BLE notifications from the characteristic.

Raises

NotConnected:

read

async def read(self) ‑> bytes

Read the current value of this characteristic.

Raises

NotConnected:

write

async def write(self, data: bytes) ‑> None

Write the data to this characteristic.

Raises

NotConnected:

Inherited members