setSaveEnergy method

Future<void> setSaveEnergy(
  1. bool saveEnergy
)

Must be set to 1 to put the connection into energy saving mode (Recommended after configuration is done). As soon as a new connection is established the save energy mode must be enabled again.

Implementation

Future<void> setSaveEnergy(bool saveEnergy) async {
  if (_saveEnergy == null) {
    _log.warning("Save Energy characteristic not found on device");
    return;
  }
  ByteData data = ByteData(1);
  data.setUint8(0, saveEnergy ? 1 : 0);
  Uint8List byteList = data.buffer.asUint8List();
  await _saveEnergy!.write(byteList);
}