BleService
homey.ble_service
A BLE service of a peripheral.
This class must not be initialized by the developer,
but retrieved through BlePeripheral.services
or by calling BlePeripheral.discover_services()
or BlePeripheral.get_service().
Ancestors
- SimpleClass
- homey.util.event_emitter.EventEmitter
- typing.Generic
Instance variables
id
var id : Final[str]The ID of the service assigned by Homey.
uuid
var uuid : Final[str]characteristics
var characteristics : tuple[BleCharacteristic, ...]BleCharacteristics of the service.
Methods
get_characteristic
async def get_characteristic(self, uuid: str) ‑> BleCharacteristicGet the characteristic with the given UUID.
Raises
NotConnected: NotFound:
discover_characteristics
async def discover_characteristics(self, uuid_filter: list[str] | None = None) ‑> tuple[BleCharacteristic, ...]Discover the characteristics of this service.
Args
| Name | Type | Description |
|---|---|---|
uuid_filter |
list[str] | None | A collection of characteristic UUIDs to limit the discovery to. |
Raises
NotConnected:
read
async def read(self, characteristic_uuid: str) ‑> bytesRead the current value of the characteristic with the given UUID.
Raises
NotConnected: NotFound:
write
async def write(self, characteristic_uuid: str, data: bytes) ‑> NoneWrite the data to the characteristic with the given UUID.
Raises
NotConnected: NotFound: